You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/02/17 16:45:10 UTC
[01/28] [OLINGO-161] Refactored Java package names
Repository: incubator-olingo-odata4
Updated Branches:
refs/heads/master c49ff8033 -> 9593b53cc
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
new file mode 100644
index 0000000..565e7e3
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java
@@ -0,0 +1,1141 @@
+/*******************************************************************************
+ * 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.server.core.uri.antlr;
+
+// TODO after adding the external API to the URI processing class this unit test require a mayor rework
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.testutil.FilterValidator;
+import org.apache.olingo.odata4.server.core.testutil.UriResourceValidator;
+import org.apache.olingo.odata4.server.core.testutil.UriValidator;
+import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.junit.Test;
+
+public class TestUriParserImpl {
+ Edm edm = null;
+ private final String PropertyBoolean = "PropertyBoolean=true";
+ private final String PropertyByte = "PropertyByte=1";
+
+ private final String PropertyDate = "PropertyDate=2013-09-25";
+ private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
+ private final String PropertyDecimal = "PropertyDecimal=12";
+ private final String PropertyDuration = "PropertyDuration=duration'P10DT5H34M21.123456789012S'";
+ private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
+ private final String PropertyInt16 = "PropertyInt16=1";
+ private final String PropertyInt32 = "PropertyInt32=12";
+ private final String PropertyInt64 = "PropertyInt64=64";
+ private final String PropertySByte = "PropertySByte=1";
+ private final String PropertyString = "PropertyString='ABC'";
+ 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;
+
+ UriValidator testUri = null;
+ UriResourceValidator testRes = null;
+ FilterValidator testFilter = null;
+
+ public TestUriParserImpl() {
+ edm = new EdmProviderImpl(new EdmTechTestProvider());
+ testUri = new UriValidator().setEdm(edm);
+ testRes = new UriResourceValidator().setEdm(edm);
+ testFilter = new FilterValidator().setEdm(edm);
+ }
+
+ @Test
+ public void testBoundFunctionImport_VarParameters() {
+
+ // no input
+ testRes.run("ESKeyNav(1)/com.sap.odata.test1.BFCETKeyNavRTETKeyNav()")
+ .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
+ .at(1).isUriPathInfoKind(UriResourceKind.function);
+
+ // one input
+ testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')")
+ .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
+ .at(1).isUriPathInfoKind(UriResourceKind.function)
+ .isParameter(0, "ParameterString", "'ABC'");
+
+ // two input
+ testRes.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'");
+ }
+
+ @Test
+ public void testFunctionBound_varReturnType() {
+
+ String esTwoKeyNav = "ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')";
+
+ // returning primitive
+ testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameString)
+ .isCollection(false);
+
+ // returning collection of primitive
+ testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameString)
+ .isCollection(true);
+
+ // returning single complex
+ testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isCollection(false);
+
+ // returning collection of complex
+ testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isCollection(true);
+
+ // returning single entity
+ testRes.run(
+ esTwoKeyNav + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false);
+
+ // returning collection of entity (aka entitySet)
+ testRes.run(esTwoKeyNav + "/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true);
+ }
+
+ @Test
+ public void runActionImport_VarReturnType() {
+
+ testRes.run("AIRTPrimParam").isKind(UriInfoKind.resource)
+ .first()
+ .isActionImport("AIRTPrimParam")
+ .isAction("UARTPrimParam")
+ .isType(EdmTechProvider.nameString, false);
+
+ testRes.run("AIRTPrimCollParam").isKind(UriInfoKind.resource)
+ .first()
+ .isActionImport("AIRTPrimCollParam")
+ .isAction("UARTPrimCollParam")
+ .isType(EdmTechProvider.nameString, true);
+
+ testRes.run("AIRTCompParam").isKind(UriInfoKind.resource)
+ .first()
+ .isActionImport("AIRTCompParam")
+ .isAction("UARTCompParam")
+ .isType(EdmTechProvider.nameCTTwoPrim, false);
+
+ testRes.run("AIRTCompCollParam").isKind(UriInfoKind.resource)
+ .first()
+ .isActionImport("AIRTCompCollParam")
+ .isAction("UARTCompCollParam")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testRes.run("AIRTETParam").isKind(UriInfoKind.resource)
+ .first()
+ .isActionImport("AIRTETParam")
+ .isAction("UARTETParam")
+ .isType(EdmTechProvider.nameETTwoKeyTwoPrim, false);
+
+ // TODO add error test
+ // testUri.run("AIRTPrimParam/invalidElement").isKind(UriInfoKind.resource).goPath().
+ // isUriPathInfoKind(UriResourceKind.action);
+ // testUri.run("InvalidAction");
+ }
+
+ @Test
+ public void runCount() {
+
+ // count entity set
+ testRes.run("ESAllPrim/$count")
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETAllPrim)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ // count on collection of complex
+ testRes.run("ESKeyNav(1)/CollPropertyComplex/$count")
+ .at(0)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(1)
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .at(2)
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ // count on collection of primitive
+ testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
+ .at(1)
+ .isType(EdmTechProvider.nameString, true)
+ .at(2)
+ .isUriPathInfoKind(UriResourceKind.count);
+ }
+
+ @Test
+ public void runCrossJoin() {
+ testUri.run("$crossjoin(ESAllKey)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
+
+ testUri.run("$crossjoin(ESAllKey,ESTwoPrim)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
+ }
+
+ @Test
+ public void testEntity() {
+
+ // simple entity set
+ testUri.run("$entity?$id=ESAllPrim").isKind(UriInfoKind.entityId)
+ .isKind(UriInfoKind.entityId)
+ .isIdText("ESAllPrim");
+
+ // simple entity set; $format before $id
+ testUri.run("$entity?$format=xml&$id=ETAllPrim").isKind(UriInfoKind.entityId)
+ .isFormatText("xml")
+ .isIdText("ETAllPrim");
+
+ testUri.run("$entity?$format=xml&abc=123&$id=ESAllKey").isKind(UriInfoKind.entityId)
+ .isFormatText("xml")
+ .isCustomParameter(0, "abc", "123")
+ .isIdText("ESAllKey");
+
+ // simple entity set; $format after $id
+ testUri.run("$entity?$id=ETAllPrim&$format=xml").isKind(UriInfoKind.entityId)
+ .isIdText("ETAllPrim")
+ .isFormatText("xml");
+
+ // simple entity set; $format and custom parameter after $id
+ testUri.run("$entity?$id=ETAllPrim&$format=xml&abc=123").isKind(UriInfoKind.entityId)
+ .isIdText("ETAllPrim")
+ .isFormatText("xml")
+ .isCustomParameter(0, "abc", "123");
+
+ // simple entity set; $format before $id and custom parameter after $id
+ testUri.run("$entity?$format=xml&$id=ETAllPrim&abc=123").isKind(UriInfoKind.entityId)
+ .isFormatText("xml")
+ .isIdText("ETAllPrim")
+ .isCustomParameter(0, "abc", "123");
+
+ // simple entity set; with qualifiedentityTypeName
+ testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$id=ESBase")
+ .isEntityType(EdmTechProvider.nameETTwoPrim)
+ .isIdText("ESBase");
+
+ // simple entity set; with qualifiedentityTypeName; with filter
+ testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$filter=PropertyInt16 eq 123&$id=ESAllKey")
+ .isIdText("ESAllKey")
+ .goFilter().is("<<PropertyInt16> eq <123>>");
+
+ // simple entity set; with qualifiedentityTypeName;
+ testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim")
+ .isEntityType(EdmTechProvider.nameETBase)
+ .isKind(UriInfoKind.entityId)
+ .isIdText("ESTwoPrim");
+
+ // simple entity set; with qualifiedentityTypeName; with format
+ testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$format=atom")
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EdmTechProvider.nameETBase)
+ .isIdText("ESTwoPrim")
+ .isFormatText("atom");
+
+ // simple entity set; with qualifiedentityTypeName; with select
+ testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$select=*")
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EdmTechProvider.nameETBase)
+ .isIdText("ESTwoPrim")
+ .isSelectItemStar(0);
+
+ // simple entity set; with qualifiedentityTypeName; with expand
+ testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$expand=*")
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EdmTechProvider.nameETBase)
+ .isIdText("ESTwoPrim")
+ .isExpandText("*")
+ .goExpand().first().isSegmentStar(0);
+
+ // simple entity set; with qualifiedentityTypeName; with 2xformat(before and after), expand, filter
+ testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?"
+ + "$format=xml&$expand=*&abc=123&$id=ESBase&xyz=987&$filter=PropertyInt16 eq 123&$format=atom&$select=*")
+ .isFormatText("atom")
+ .isCustomParameter(0, "abc", "123")
+ .isIdText("ESBase")
+ .isCustomParameter(1, "xyz", "987")
+ .isSelectItemStar(0);
+ }
+
+ @Test
+ public void testEntitySet() {
+
+ // plain entity set
+ testRes.run("ESAllPrim")
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim);
+
+ // with one key; simple key notation
+ testRes.run("ESAllPrim(1)")
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with one key; name value key notation
+ testRes.run("ESAllPrim(PropertyInt16=1)")
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with two keys
+ testRes.run("ESTwoKeyTwoPrim(PropertyInt16=1, PropertyString='ABC')")
+ .isEntitySet("ESTwoKeyTwoPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+ // with all keys
+ testRes.run("ESAllKey(" + allKeys + ")")
+ .isEntitySet("ESAllKey")
+ .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");
+ }
+
+ @Test
+ public void testEntitySet_NavigationPropperty() {
+
+ // plain entity set ...
+
+ // with navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // with navigation property -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .at(2)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property -> navigation property -> navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .at(2)
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ // with navigation property(key)
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with navigation property(key) -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/PropertyString").at(0)
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(2)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property(key) -> navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
+ .isEntitySet("ESKeyNav")
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(2)
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+ // with navigation property(key) -> navigation property(key)
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(2)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with navigation property(key) -> navigation property -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(2)
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(3)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property(key) -> navigation property(key) -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
+ .at(0)
+ .isEntitySet("ESKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav)
+ .at(1)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(2)
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(3)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ }
+
+ @Test
+ public void testEntitySet_Property() {
+
+ // plain entity set ...
+
+ // with property
+ testRes.run("ESAllPrim(1)/PropertyString")
+ .at(0)
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with complex property
+ testRes.run("ESCompAllPrim(1)/PropertyComplex")
+ .at(0)
+ .isEntitySet("ESCompAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false);
+
+ // with two properties
+ testRes.run("ESCompAllPrim(1)/PropertyComplex/PropertyString")
+ .at(0)
+ .isEntitySet("ESCompAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false)
+ .at(2)
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+ }
+
+ @Test
+ public void testEntitySet_TypeFilter() {
+
+ // filter
+ testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase")
+ .at(0)
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+ .isTypeFilterOnEntry(null)
+ .isCollection(true);
+
+ // filter before key predicate
+ testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)")
+ .at(0)
+ .isEntitySet("ESTwoPrim")
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+ .isTypeFilterOnEntry(null)
+ .at(0)
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+
+ // filter before key predicate; property of sub type
+ testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
+ .at(0)
+ .isEntitySet("ESTwoPrim")
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+ .isTypeFilterOnEntry(null)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isType(EdmTechProvider.nameString)
+ .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false);
+
+ // filter after key predicate
+ testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase")
+ .at(0)
+ .isEntitySet("ESTwoPrim")
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(null)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isCollection(false);
+
+ // filter after key predicate; property of sub type
+ testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
+ .at(0)
+ .isEntitySet("ESTwoPrim")
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(null)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1)
+ .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false)
+ .isType(EdmTechProvider.nameString);
+
+ }
+
+ @Test
+ public void testFilterComplexMixedPriority() throws UriParserException {
+ testFilter.runESabc("a or c and e ").isCompr("< <a> or < <c> and <e> >>");
+ testFilter.runESabc("a or c and e eq f").isCompr("< <a> or < <c> and <<e> eq <f>>>>");
+ testFilter.runESabc("a or c eq d and e ").isCompr("< <a> or <<<c> eq <d>> and <e> >>");
+ testFilter.runESabc("a or c eq d and e eq f").isCompr("< <a> or <<<c> eq <d>> and <<e> eq <f>>>>");
+ testFilter.runESabc("a eq b or c and e ").isCompr("<<<a> eq <b>> or < <c> and <e> >>");
+ testFilter.runESabc("a eq b or c and e eq f").isCompr("<<<a> eq <b>> or < <c> and <<e> eq <f>>>>");
+ testFilter.runESabc("a eq b or c eq d and e ").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <e> >>");
+ testFilter.runESabc("a eq b or c eq d and e eq f").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <<e> eq <f>>>>");
+ }
+
+ @Test
+ public void testFilterSimpleSameBinaryBinaryBinaryPriority() throws UriParserException {
+
+ testFilter.runESabc("1 add 2 add 3 add 4").isCompr("<<< <1> add <2>> add <3>> add <4>>");
+ testFilter.runESabc("1 add 2 add 3 div 4").isCompr("<< <1> add <2>> add <<3> div <4>>>");
+ testFilter.runESabc("1 add 2 div 3 add 4").isCompr("<< <1> add <<2> div <3>>> add <4>>");
+ testFilter.runESabc("1 add 2 div 3 div 4").isCompr("< <1> add <<<2> div <3>> div <4>>>");
+ testFilter.runESabc("1 div 2 add 3 add 4").isCompr("<<< <1> div <2>> add <3>> add <4>>");
+ testFilter.runESabc("1 div 2 add 3 div 4").isCompr("<< <1> div <2>> add <<3> div <4>>>");
+ testFilter.runESabc("1 div 2 div 3 add 4").isCompr("<<< <1> div <2>> div <3>> add <4>>");
+ testFilter.runESabc("1 div 2 div 3 div 4").isCompr("<<< <1> div <2>> div <3>> div <4>>");
+
+ }
+
+ @Test
+ public void testFunctionImport_VarParameters() {
+
+ // no input
+ testRes.run("FINRTInt16()")
+ .isFunctionImport("FINRTInt16")
+ .isFunction("UFNRTInt16")
+ .isType(EdmTechProvider.nameString);
+
+ // one input
+ testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // two input
+ testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+ .isFunctionImport("FICRTStringTwoParam")
+ .isFunction("UFCRTStringTwoParam")
+ .isType(EdmTechProvider.nameString);
+ }
+
+ @Test
+ public void testFunctionImport_VarRetruning() {
+ // returning primitive
+ testRes.run("FINRTInt16()")
+ .isFunctionImport("FINRTInt16")
+ .isFunction("UFNRTInt16")
+ .isType(EdmTechProvider.nameString, false);
+
+ // returning collection of primitive
+ testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
+ .isFunctionImport("FICRTCollStringTwoParam")
+ .isFunction("UFCRTCollStringTwoParam")
+ .isType(EdmTechProvider.nameString, true);
+
+ // returning single complex
+ testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
+ .isFunctionImport("FICRTCTAllPrimTwoParam")
+ .isFunction("UFCRTCTAllPrimTwoParam")
+ .isType(EdmTechProvider.nameCTAllPrim, false);
+
+ // returning collection of complex
+ testRes.run("FICRTCollCTTwoPrim()")
+ .isFunctionImport("FICRTCollCTTwoPrim")
+ .isFunction("UFCRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ // returning single entity
+ testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false);
+
+ // returning collection of entity (aka entitySet)
+ testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)")
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
+ }
+
+ @Test
+ public void testFunctionImportChain() {
+
+ // test chain; returning single complex
+ testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
+ .at(0)
+ .isFunctionImport("FICRTCTAllPrimTwoParam")
+ .isFunction("UFCRTCTAllPrimTwoParam")
+ .isType(EdmTechProvider.nameCTAllPrim, false)
+ .isParameter(0, "ParameterString", "'ABC'")
+ .isParameter(1, "ParameterInt16", "1")
+ .at(1)
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ // test chains; returning single entity
+ testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
+ .at(0)
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isParameter(0, "ParameterInt16", "1")
+ .at(1)
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ // test chains; returning collection of entity (aka entitySet)
+ testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
+ .at(0)
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isParameter(0, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'ABC'");
+
+ // test chains; returning collection of entity (aka entitySet)
+ testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
+ .at(0)
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isParameter(0, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'ABC'")
+ .at(1)
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ }
+
+ @Test
+ public void testMetaData() {
+
+ // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
+ // On the producer side this feature is currently not supported, so the context fragment
+ // part is only available as text.
+
+ testUri.run("$metadata")
+ .isKind(UriInfoKind.metadata);
+
+ testUri.run("$metadata?$format=atom")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom");
+
+ // with context (client usage)
+
+ testUri.run("$metadata#$ref")
+ .isKind(UriInfoKind.metadata)
+ .isFragmentText("$ref");
+
+ testUri.run("$metadata?$format=atom#$ref")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("$ref");
+
+ testUri.run("$metadata?$format=atom#Collection($ref)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("Collection($ref)");
+
+ testUri.run("$metadata?$format=atom#Collection(Edm.EntityType)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("Collection(Edm.EntityType)");
+
+ testUri.run("$metadata?$format=atom#Collection(Edm.ComplexType)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("Collection(Edm.ComplexType)");
+
+ testUri.run("$metadata?$format=atom#SINav")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav");
+
+ testUri.run("$metadata?$format=atom#SINav/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/NavPropertyETKeyNavOne");
+
+ testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavMany(1)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/NavPropertyETKeyNavMany(1)");
+
+ testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavOne/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/NavPropertyETKeyNavOne/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#com.sap.odata.test1.ETAllKey")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("com.sap.odata.test1.ETAllKey");
+
+ testUri.run("$metadata?$format=atom#ESTwoPrim/$deletedEntity")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESTwoPrim/$deletedEntity");
+
+ testUri.run("$metadata?$format=atom#ESTwoPrim/$link")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESTwoPrim/$link");
+
+ testUri.run("$metadata?$format=atom#ESTwoPrim/$deletedLink")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESTwoPrim/$deletedLink");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavMany(1)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
+
+ testUri.run(
+ "$metadata?$format=atom#ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav(PropertyInt16,PropertyString)")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav(PropertyInt16,PropertyString)");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/$entity")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/$entity");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/$delta")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/$delta");
+
+ testUri.run("$metadata?$format=atom#ESKeyNav/(PropertyInt16,PropertyString)/$delta")
+ .isKind(UriInfoKind.metadata)
+ .isFormatText("atom")
+ .isFragmentText("ESKeyNav/(PropertyInt16,PropertyString)/$delta");
+
+ }
+
+ @Test
+ public void testRef() {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
+ }
+
+ @Test
+ public void testSingleton() {
+ // plain singleton
+ testRes.run("SINav")
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+ }
+
+ @Test
+ public void testNavigationProperty() {
+
+ // plain entity set ...
+
+ // with navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
+
+ // with navigation property -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property -> navigation property -> navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+ // with navigation property(key)
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'");
+
+ // with navigation property(key) -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'")
+ .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property(key) -> navigation property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'")
+ .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+ // with navigation property(key) -> navigation property(key)
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+ + "/NavPropertyETKeyNavMany(1)")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'")
+ .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ // with navigation property(key) -> navigation property -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+ + "/NavPropertyETKeyNavOne/PropertyString")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'")
+ .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ // with navigation property(key) -> navigation property(key) -> property
+ testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
+ + "/NavPropertyETKeyNavMany(1)/PropertyString")
+ .at(0).isEntitySet("ESKeyNav")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'")
+ .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+ }
+
+ @Test
+ public void testSingleton_Property() {
+
+ // plain singleton ...
+
+ // with property
+ testRes.run("SINav/PropertyInt16")
+ .at(0)
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ // with complex property
+ testRes.run("SINav/PropertyComplex")
+ .at(0)
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false);
+
+ // with two properties
+ testRes.run("SINav/PropertyComplex/PropertyInt16")
+ .at(0)
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .at(1)
+ .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false)
+ .at(2)
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ }
+
+ @Test
+ public void testValue() {
+ testUri.run("ESAllPrim(1)/PropertyString/$value");
+ }
+
+ @Test
+ public void testMemberStartingWithCast() {
+ // on EntityType entry
+ // TODO inform OTTO
+ testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?"
+ + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+ .goFilter().root().isMember().goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isType(EdmTechTestProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechTestProvider.nameETBaseTwoKeyNav)
+ .at(1).isType(EdmTechTestProvider.nameDate);
+
+ // on EntityType collection
+ testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+ .goFilter().root().isMember().goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isType(EdmTechTestProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav)
+ .at(1).isType(EdmTechTestProvider.nameDate);
+
+ testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
+ + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
+ .goFilter().root().isMember().goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isType(EdmTechTestProvider.nameCTTwoPrim, false)
+ .isTypeFilterOnEntry(EdmTechTestProvider.nameCTBase)
+ .at(1).isType(EdmTechTestProvider.nameString);
+
+// on Complex collection
+ testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
+ + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
+ .goFilter().root().isMember().goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isType(EdmTechTestProvider.nameCTTwoPrim, true)
+ .isTypeFilterOnCollection(EdmTechTestProvider.nameCTBase)
+ .at(1).isType(EdmTechTestProvider.nameString);
+
+ }
+
+ @Test
+ public void testComplexTypeCastFollowingAsCollection() {
+ // TODO inform OTTO
+ testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/com.sap.odata.test1.CTBase");
+
+ }
+
+ @Test
+ public void testLambda() {
+ testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/all( l : true )")
+ .goFilter().is("<CollPropertyComplex/<ALL;<true>>>");
+
+ testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( l : true )")
+ .goFilter().is("<CollPropertyComplex/<ANY;<true>>>");
+ testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( )")
+ .goFilter().is("<CollPropertyComplex/<ANY;>>");
+
+ testUri.run("ESTwoKeyNav?$filter=all( l : true )")
+ .goFilter().is("<<ALL;<true>>>");
+ testUri.run("ESTwoKeyNav?$filter=any( l : true )")
+ .goFilter().is("<<ANY;<true>>>");
+ testUri.run("ESTwoKeyNav?$filter=any( )")
+ .goFilter().is("<<ANY;>>");
+ }
+
+ @Test
+ public void testCustomQueryOption() {
+ testUri.run("ESTwoKeyNav?custom")
+ .isCustomParameter(0, "custom", null);
+ testUri.run("ESTwoKeyNav?custom=ABC")
+ .isCustomParameter(0, "custom", "ABC");
+ }
+
+ @Test
+ public void testGeo() throws UriParserException {
+ // TODO sync
+ testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
+ .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
+ .isMethod(SupportedMethodCalls.GEODISTANCE, 2);
+ testFilter.runOnETAllPrim("geo.length(PropertySByte)")
+ .is("<geo.length(<PropertySByte>)>")
+ .isMethod(SupportedMethodCalls.GEOLENGTH, 1);
+ testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
+ .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
+ .isMethod(SupportedMethodCalls.GEOINTERSECTS, 2);
+ }
+
+ @Test
+ public void testSelect() {
+ testUri.run("ESTwoKeyNav?$select=*")
+ .isSelectItemStar(0);
+
+ testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.*")
+ .isSelectItemAllOp(0, new FullQualifiedName("com.sap.odata.test1", "*"));
+
+ testUri.run("ESTwoKeyNav?$select=PropertyString")
+ .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
+
+ testUri.run("ESTwoKeyNav?$select=PropertyComplex")
+ .goSelectItemPath(0).isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false);
+
+ testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyInt16")
+ .goSelectItemPath(0)
+ .first()
+ .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
+
+ testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyComplex")
+ .goSelectItemPath(0)
+ .first()
+ .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
+ .n()
+ .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false);
+
+ testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav")
+ .goSelectItemPath(0)
+ .first()
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav")
+ .goSelectItemPath(0)
+ .first()
+ .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
+ .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
+
+ testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav")
+ .goSelectItemPath(0)
+ .first()
+ .isComplexProperty("PropertyComplexNav", EdmTechTestProvider.nameCTBasePrimCompNav, false)
+ .n()
+ .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
+ ;
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
new file mode 100644
index 0000000..11a3438
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java
@@ -0,0 +1,325 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.AliasQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.InlineCountOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.LevelsOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.AliasImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.junit.Test;
+
+//TOOD add getKind check to all
+public class QueryOptionTest {
+
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testAliasQueryOption() {
+ AliasQueryOptionImpl option = new AliasQueryOptionImpl();
+
+ ExpressionImpl expression = new LiteralImpl();
+
+ option.setAliasValue(expression);
+ assertEquals(expression, option.getValue());
+ }
+
+ @Test
+ public void testExandItemImpl() {
+ ExpandItemImpl option = new ExpandItemImpl();
+
+ // input options
+ ExpandOptionImpl expand = new ExpandOptionImpl();
+ FilterOptionImpl filter = new FilterOptionImpl();
+ InlineCountOptionImpl inlinecount = new InlineCountOptionImpl();
+ OrderByOptionImpl orderby = new OrderByOptionImpl();
+ SearchOptionImpl search = new SearchOptionImpl();
+ SelectOptionImpl select = new SelectOptionImpl();
+ SkipOptionImpl skip = new SkipOptionImpl();
+ TopOptionImpl top = new TopOptionImpl();
+ LevelsOptionImpl levels = new LevelsOptionImpl();
+
+ option.setSystemQueryOption(expand);
+ option.setSystemQueryOption(filter);
+ option.setSystemQueryOption(inlinecount);
+ option.setSystemQueryOption(orderby);
+ option.setSystemQueryOption(search);
+ option.setSystemQueryOption(select);
+ option.setSystemQueryOption(skip);
+ option.setSystemQueryOption(top);
+ option.setSystemQueryOption(levels);
+
+ assertEquals(expand, option.getExpandOption());
+ assertEquals(filter, option.getFilterOption());
+ assertEquals(inlinecount, option.getInlineCountOption());
+ assertEquals(orderby, option.getOrderByOption());
+ assertEquals(search, option.getSearchOption());
+ assertEquals(select, option.getSelectOption());
+ assertEquals(skip, option.getSkipOption());
+ assertEquals(top, option.getTopOption());
+ assertEquals(levels, option.getLevelsOption());
+
+ // just for completeness
+ option = new ExpandItemImpl();
+ option.setSystemQueryOption(new IdOptionImpl());
+
+ option = new ExpandItemImpl();
+ List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
+ list.add(expand);
+ list.add(filter);
+ option.setSystemQueryOptions(list);
+ assertEquals(expand, option.getExpandOption());
+ assertEquals(filter, option.getFilterOption());
+
+ option = new ExpandItemImpl();
+ assertEquals(false, option.isRef());
+ option.setIsRef(true);
+ assertEquals(true, option.isRef());
+
+ option = new ExpandItemImpl();
+ assertEquals(false, option.isStar());
+ option.setIsStar(true);
+ assertEquals(true, option.isStar());
+
+ option = new ExpandItemImpl();
+ UriInfoResource resource = new UriInfoImpl().asUriInfoResource();
+ option.setResourceInfo(resource);
+ assertEquals(resource, option.getResourceInfo());
+
+ }
+
+ @Test
+ public void testExpandOptionImpl() {
+ ExpandOptionImpl option = new ExpandOptionImpl();
+ assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
+
+ ExpandItemImpl item1 = new ExpandItemImpl();
+ ExpandItemImpl item2 = new ExpandItemImpl();
+ option.addExpandItem(item1);
+ option.addExpandItem(item2);
+ assertEquals(item1, option.getExpandItems().get(0));
+ assertEquals(item2, option.getExpandItems().get(1));
+ }
+
+ @Test
+ public void testFilterOptionImpl() {
+ FilterOptionImpl option = new FilterOptionImpl();
+ assertEquals(SupportedQueryOptions.FILTER, option.getKind());
+
+ AliasImpl expression = new AliasImpl();
+
+ option.setExpression(expression);
+ assertEquals(expression, option.getExpression());
+ }
+
+ @Test
+ public void testFormatOptionImpl() {
+ FormatOptionImpl option = new FormatOptionImpl();
+ assertEquals(SupportedQueryOptions.FORMAT, option.getKind());
+
+ option.setFormat("A");
+
+ assertEquals("A", option.getFormat());
+ }
+
+ @Test
+ public void testIdOptionImpl() {
+ IdOptionImpl option = new IdOptionImpl();
+ assertEquals(SupportedQueryOptions.ID, option.getKind());
+
+ option.setValue("A");
+
+ assertEquals("A", option.getValue());
+ }
+
+ @Test
+ public void testInlineCountImpl() {
+ InlineCountOptionImpl option = new InlineCountOptionImpl();
+ assertEquals(SupportedQueryOptions.INLINECOUNT, option.getKind());
+
+ assertEquals(false, option.getValue());
+ option.setValue(true);
+ assertEquals(true, option.getValue());
+ }
+
+ @Test
+ public void testLevelsExpandOptionImpl() {
+ LevelsOptionImpl option = new LevelsOptionImpl();
+ assertEquals(SupportedQueryOptions.LEVELS, option.getKind());
+
+ assertEquals(0, option.getLevel());
+ option.setLevel(1);
+ assertEquals(1, option.getLevel());
+
+ option = new LevelsOptionImpl();
+ option.setMax();
+ assertEquals(true, option.isMax());
+ }
+
+ @Test
+ public void testOrderByItemImpl() {
+ OrderByItemImpl option = new OrderByItemImpl();
+
+ AliasImpl expression = new AliasImpl();
+ option.setExpression(expression);
+ assertEquals(expression, option.getExpression());
+
+ assertEquals(false, option.isDescending());
+ option.setDescending(true);
+ assertEquals(true, option.isDescending());
+ }
+
+ @Test
+ public void testOrderByOptionImpl() {
+ OrderByOptionImpl option = new OrderByOptionImpl();
+
+ OrderByItemImpl order0 = new OrderByItemImpl();
+ OrderByItemImpl order1 = new OrderByItemImpl();
+ option.addOrder(order0);
+ option.addOrder(order1);
+
+ assertEquals(order0, option.getOrders().get(0));
+ assertEquals(order1, option.getOrders().get(1));
+ }
+
+ @Test
+ public void testQueryOptionImpl() {
+ QueryOptionImpl option = new AliasQueryOptionImpl();
+
+ option.setName("A");
+ option.setText("B");
+ assertEquals("A", option.getName());
+ assertEquals("B", option.getText());
+ }
+
+ @Test
+ public void testSearchOptionImpl() {
+ SearchOptionImpl option = new SearchOptionImpl();
+ assertEquals(SupportedQueryOptions.SEARCH, option.getKind());
+ // TODO $search not supported yet
+ }
+
+ @Test
+ public void testSelectItemImpl() {
+ SelectItemImpl option = new SelectItemImpl();
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+
+ // no typed collection else case ( e.g. if not path is added)
+ option = new SelectItemImpl();
+
+ option = new SelectItemImpl();
+ assertEquals(false, option.isStar());
+ option.setStar(true);
+ assertEquals(true, option.isStar());
+
+ option = new SelectItemImpl();
+ assertEquals(false, option.isAllOperationsInSchema());
+ FullQualifiedName fqName = new FullQualifiedName("Namespace", "Name");
+ option.addAllOperationsInSchema(fqName);
+ assertEquals(true, option.isAllOperationsInSchema());
+ assertEquals(fqName, option.getAllOperationsInSchemaNameSpace());
+
+ }
+
+ @Test
+ public void testSelectOptionImpl() {
+ SelectOptionImpl option = new SelectOptionImpl();
+ assertEquals(SupportedQueryOptions.SELECT, option.getKind());
+
+ SelectItemImpl item0 = new SelectItemImpl();
+ SelectItemImpl item1 = new SelectItemImpl();
+
+ ArrayList<SelectItemImpl> list = new ArrayList<SelectItemImpl>();
+ list.add(item0);
+ list.add(item1);
+ option.setSelectItems(list);
+
+ assertEquals(item0, option.getSelectItems().get(0));
+ assertEquals(item1, option.getSelectItems().get(1));
+
+ }
+
+ @Test
+ public void testSkipOptionImpl() {
+ SkipOptionImpl option = new SkipOptionImpl();
+ assertEquals(SupportedQueryOptions.SKIP, option.getKind());
+
+ option.setValue("A");
+ assertEquals("A", option.getValue());
+ }
+
+ @Test
+ public void testSkipTokenOptionImpl() {
+ SkipTokenOptionImpl option = new SkipTokenOptionImpl();
+ assertEquals(SupportedQueryOptions.SKIPTOKEN, option.getKind());
+
+ option.setValue("A");
+ assertEquals("A", option.getValue());
+ }
+
+ @Test
+ public void testSystemQueryOptionImpl() {
+ SystemQueryOptionImpl option = new SystemQueryOptionImpl();
+
+ option.setKind(SupportedQueryOptions.EXPAND);
+ assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
+
+ assertEquals("$expand", option.getName());
+ }
+
+ @Test
+ public void testTopOptionImpl() {
+ TopOptionImpl option = new TopOptionImpl();
+ assertEquals(SupportedQueryOptions.TOP, option.getKind());
+
+ option.setValue("A");
+ assertEquals("A", option.getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
new file mode 100644
index 0000000..31db44c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Arrays;
+
+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.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedUnaryOperators;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.testutil.FilterTreeToText;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.AliasImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ConstantImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LambdaRefImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.UnaryImpl;
+import org.junit.Test;
+
+public class ExpressionTest {
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testSupportedOperators() {
+ assertEquals(SupportedUnaryOperators.MINUS, SupportedUnaryOperators.get("-") );
+ assertEquals(null, SupportedUnaryOperators.get("XXX") );
+
+ assertEquals(SupportedBinaryOperators.MOD, SupportedBinaryOperators.get("mod") );
+ assertEquals(null, SupportedBinaryOperators.get("XXX") );
+
+ assertEquals(SupportedMethodCalls.CONCAT, SupportedMethodCalls.get("concat") );
+ assertEquals(null, SupportedMethodCalls.get("XXX") );
+
+ assertEquals(SupportedConstants.TRUE, SupportedConstants.get("true") );
+ assertEquals(null, SupportedConstants.get("XXX") );
+ }
+
+ @Test
+ public void testAliasExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ AliasImpl expression = new AliasImpl();
+
+ expression.setParameter("Test");
+
+ assertEquals("Test", expression.getParameterName());
+
+ String output = expression.accept(new FilterTreeToText());
+ assertEquals("<Test>", output);
+
+ }
+
+ @Test
+ public void testBinaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ BinaryImpl expression = new BinaryImpl();
+
+ ExpressionImpl expressionLeft = new LiteralImpl().setText("A");
+ ExpressionImpl expressionRight = new LiteralImpl().setText("B");
+
+ expression.setLeftOperand(expressionLeft);
+ expression.setRightOperand(expressionRight);
+ expression.setOperator(SupportedBinaryOperators.SUB);
+
+ assertEquals(expressionLeft, expression.getLeftOperand());
+ assertEquals(expressionRight, expression.getRightOperand());
+ assertEquals(SupportedBinaryOperators.SUB, expression.getOperator());
+
+ String output = expression.accept(new FilterTreeToText());
+ assertEquals("<<A> sub <B>>", output);
+ }
+
+ @Test
+ public void testConstantExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ ConstantImpl expression = new ConstantImpl();
+ EdmType type = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ assertNotNull(type);
+ expression.setType(type);
+ assertEquals(type, expression.getType());
+
+ expression.setKind(SupportedConstants.FALSE);
+ assertEquals(SupportedConstants.FALSE, expression.getKind());
+ assertEquals(true, expression.isFalse());
+ assertEquals(false, expression.isTrue());
+ assertEquals(false, expression.isNull());
+ assertEquals("<false>", expression.accept(new FilterTreeToText()));
+
+ expression.setKind(SupportedConstants.TRUE);
+ assertEquals(SupportedConstants.TRUE, expression.getKind());
+ assertEquals(false, expression.isFalse());
+ assertEquals(true, expression.isTrue());
+ assertEquals(false, expression.isNull());
+ assertEquals("<true>", expression.accept(new FilterTreeToText()));
+
+ expression.setKind(SupportedConstants.NULL);
+ assertEquals(SupportedConstants.NULL, expression.getKind());
+ assertEquals(false, expression.isFalse());
+ assertEquals(false, expression.isTrue());
+ assertEquals(true, expression.isNull());
+ assertEquals("<null>", expression.accept(new FilterTreeToText()));
+ }
+
+ @Test
+ public void testEnumerationExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ EnumerationImpl expression = new EnumerationImpl();
+ EdmEnumType type = (EdmEnumType) edm.getEnumType(EdmTechProvider.nameENString);
+ assertNotNull(type);
+ expression.setType(type);
+
+ assertEquals(type, expression.getType());
+
+ expression.addValue("A");
+ expression.addValue("B");
+ assertEquals("A", expression.getValues().get(0));
+ assertEquals("B", expression.getValues().get(1));
+ assertEquals("<com.sap.odata.test1.ENString<A,B>>", expression.accept(new FilterTreeToText()));
+ }
+
+ @Test
+ public void testLambdaRefExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ LambdaRefImpl expression = new LambdaRefImpl();
+ expression.setVariableText("A");
+ assertEquals("A", expression.getVariableName());
+
+ assertEquals("<A>", expression.accept(new FilterTreeToText()));
+
+ }
+
+ @Test
+ public void testLiteralExpresion() throws ExceptionVisitExpression, ODataApplicationException {
+ LiteralImpl expression = new LiteralImpl();
+ expression.setText("A");
+ assertEquals("A", expression.getText());
+
+ assertEquals("<A>", expression.accept(new FilterTreeToText()));
+ }
+
+ @Test
+ public void testMemberExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ MemberImpl expression = new MemberImpl();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+
+ // UriResourceImplTyped
+ UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+ UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceActionImpl().setAction(action)).asUriInfoResource();
+ expression.setPath(uriInfo);
+ assertEquals(action.getReturnType().getType(), expression.getType());
+
+ // check accept and path
+ assertEquals(uriInfo, expression.getPath());
+ assertEquals("<UARTPrimParam>", expression.accept(new FilterTreeToText()));
+
+ // UriResourceImplTyped check collection = false case
+ assertEquals(false, expression.isCollection());
+
+ // UriResourceImplTyped check collection = true case
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null);
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceActionImpl().setAction(action))
+ .asUriInfoResource());
+ assertEquals(true, expression.isCollection());
+
+ // UriResourceImplTyped with filter
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
+ .asUriInfoResource());
+ assertEquals(entityType, expression.getType());
+
+ // UriResourceImplKeyPred
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceFunctionImpl().setFunction(function))
+ .asUriInfoResource());
+ assertEquals(function.getReturnType().getType(), expression.getType());
+
+ // UriResourceImplKeyPred typeFilter on entry
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+ Arrays.asList(("ParameterInt16")));
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
+ .asUriInfoResource());
+ assertEquals(entityBaseType, expression.getType());
+
+ // UriResourceImplKeyPred typeFilter on entry
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+ Arrays.asList(("ParameterInt16")));
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
+ new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
+ .asUriInfoResource());
+ assertEquals(entityBaseType, expression.getType());
+
+ // no typed
+ resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+ entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+ Arrays.asList(("ParameterInt16")));
+ expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all));
+ assertEquals(null, expression.getType());
+
+ // no typed collection else case
+ assertEquals(false, expression.isCollection());
+ }
+
+ @Test
+ public void testMethodCallExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ MethodCallImpl expression = new MethodCallImpl();
+ expression.setMethod(SupportedMethodCalls.CONCAT);
+
+ ExpressionImpl p0 = new LiteralImpl().setText("A");
+ ExpressionImpl p1 = new LiteralImpl().setText("B");
+ expression.addParameter(p0);
+ expression.addParameter(p1);
+
+ assertEquals(SupportedMethodCalls.CONCAT, expression.getMethod());
+ assertEquals("<concat(<A>,<B>)>", expression.accept(new FilterTreeToText()));
+
+ assertEquals(p0, expression.getParameters().get(0));
+ assertEquals(p1, expression.getParameters().get(1));
+ }
+
+ @Test
+ public void testTypeLiteralExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ TypeLiteralImpl expression = new TypeLiteralImpl();
+ EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ expression.setType(entityBaseType);
+
+ assertEquals(entityBaseType, expression.getType());
+ assertEquals("<com.sap.odata.test1.ETBaseTwoKeyNav>", expression.accept(new FilterTreeToText()));
+ }
+
+ @Test
+ public void testUnaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
+ UnaryImpl expression = new UnaryImpl();
+ expression.setOperator(SupportedUnaryOperators.MINUS);
+
+ ExpressionImpl operand = new LiteralImpl().setText("A");
+ expression.setOperand(operand);
+
+ assertEquals(SupportedUnaryOperators.MINUS, expression.getOperator());
+ assertEquals(operand, expression.getOperand());
+
+ assertEquals("<- <A>>", expression.accept(new FilterTreeToText()));
+ }
+
+
+}
[15/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionImpl.java
new file mode 100644
index 0000000..46aa8f4
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionImpl.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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.QueryOption;
+
+public class QueryOptionImpl implements QueryOption {
+ private String name;
+ private String text;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public QueryOptionImpl setName(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ public QueryOptionImpl setText(final String value) {
+ text = value;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
new file mode 100644
index 0000000..5ed729e
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.search.SearchExpression;
+
+/* TODO implement */
+public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOption {
+
+ public SearchOptionImpl() {
+ setKind(SupportedQueryOptions.SEARCH);
+ }
+
+ @Override
+ public SearchExpression getSearchExpression() {
+ // TODO $search not supported yet
+ return null;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
new file mode 100644
index 0000000..24f6562
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+
+public class SelectItemImpl implements SelectItem {
+
+ private UriInfoResource path;
+
+ private boolean isStar;
+ private FullQualifiedName addOperationsInSchemaNameSpace;
+
+ @Override
+ public UriInfoResource getResourceInfo() {
+
+ return path;
+ }
+
+ public SelectItemImpl setResourceInfo(UriInfoResource path) {
+ this.path = path;
+ return this;
+ }
+
+ @Override
+ public boolean isStar() {
+ return isStar;
+ }
+
+ public SelectItemImpl setStar(final boolean isStar) {
+ this.isStar = isStar;
+ return this;
+ }
+
+ @Override
+ public boolean isAllOperationsInSchema() {
+ if (addOperationsInSchemaNameSpace == null) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public FullQualifiedName getAllOperationsInSchemaNameSpace() {
+ return addOperationsInSchemaNameSpace;
+ }
+
+ public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
+ this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectOptionImpl.java
new file mode 100644
index 0000000..07ec2e2
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectOptionImpl.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.server.core.uri.queryoption;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOption {
+
+ private List<SelectItemImpl> selectItems;
+
+ public SelectOptionImpl() {
+ setKind(SupportedQueryOptions.SELECT);
+ }
+
+ public SelectOptionImpl setSelectItems(final List<SelectItemImpl> selectItems) {
+ this.selectItems = selectItems;
+ return this;
+ }
+
+ @Override
+ public List<SelectItem> getSelectItems() {
+ List<SelectItem> retList = new ArrayList<SelectItem>();
+ for (SelectItemImpl item : selectItems) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipOptionImpl.java
new file mode 100644
index 0000000..f9edca1
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipOptionImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class SkipOptionImpl extends SystemQueryOptionImpl implements SkipOption {
+ private String value;
+
+ public SkipOptionImpl() {
+ setKind(SupportedQueryOptions.SKIP);
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ public SkipOptionImpl setValue(final String value) {
+ this.value = value;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipTokenOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipTokenOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipTokenOptionImpl.java
new file mode 100644
index 0000000..759cfae
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SkipTokenOptionImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class SkipTokenOptionImpl extends SystemQueryOptionImpl implements SkipTokenOption {
+ private String skipTokenValue;
+
+ public SkipTokenOptionImpl() {
+ setKind(SupportedQueryOptions.SKIPTOKEN);
+ }
+
+ @Override
+ public String getValue() {
+ return skipTokenValue;
+ }
+
+ public SkipTokenOptionImpl setValue(final String skipTokenValue) {
+ this.skipTokenValue = skipTokenValue;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SystemQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SystemQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SystemQueryOptionImpl.java
new file mode 100644
index 0000000..9c58776
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SystemQueryOptionImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SystemQueryOption;
+
+public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption {
+
+ private SupportedQueryOptions kind;
+
+ @Override
+ public SupportedQueryOptions getKind() {
+ return kind;
+ }
+
+ void setKind(final SupportedQueryOptions kind) {
+ this.kind = kind;
+ }
+
+ @Override
+ public String getName() {
+ return kind.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
new file mode 100644
index 0000000..f7f0cfc
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+
+/* TODO implement */
+public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
+ private String value;
+
+ public TopOptionImpl() {
+ setKind(SupportedQueryOptions.TOP);
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ public TopOptionImpl setValue(final String value) {
+ this.value = value;
+ return this;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
new file mode 100644
index 0000000..1ce145f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.AliasExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+
+public class AliasImpl extends ExpressionImpl implements AliasExpression {
+
+ private String parameterName;
+
+ @Override
+ public String getParameterName() {
+ return parameterName;
+ }
+
+ public void setParameter(final String ParameterName) {
+ this.parameterName = ParameterName;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitAlias(parameterName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
new file mode 100644
index 0000000..fb1c5a2
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+
+public class BinaryImpl extends ExpressionImpl implements BinaryExpression {
+
+ private SupportedBinaryOperators operator;
+ private ExpressionImpl left;
+ private ExpressionImpl right;
+
+ @Override
+ public SupportedBinaryOperators getOperator() {
+ return operator;
+ }
+
+ public BinaryExpression setOperator(final SupportedBinaryOperators operator) {
+ this.operator = operator;
+ return this;
+ }
+
+ @Override
+ public Expression getLeftOperand() {
+ return left;
+ }
+
+ public void setLeftOperand(final ExpressionImpl operand) {
+ left = operand;
+ }
+
+ @Override
+ public Expression getRightOperand() {
+ return right;
+ }
+
+ public void setRightOperand(final ExpressionImpl operand) {
+ right = operand;
+
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ T left = this.left.accept(visitor);
+ T right = this.right.accept(visitor);
+ return visitor.visitBinaryOperator(operator, left, right);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
new file mode 100644
index 0000000..8d4567c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Constant;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+
+public class ConstantImpl extends ExpressionImpl implements Constant {
+
+ EdmType type;
+ SupportedConstants kind;
+
+ @Override
+ public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitConstant(kind);
+ }
+
+ @Override
+ public boolean isNull() {
+ return kind == SupportedConstants.NULL;
+ }
+
+ @Override
+ public boolean isTrue() {
+ return kind == SupportedConstants.TRUE;
+ }
+
+ @Override
+ public boolean isFalse() {
+ return kind == SupportedConstants.FALSE;
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public ConstantImpl setType(EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public SupportedConstants getKind() {
+ return kind;
+ }
+
+ public ConstantImpl setKind(SupportedConstants kind) {
+ this.kind = kind;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
new file mode 100644
index 0000000..f47d164
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Enumeration;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+
+public class EnumerationImpl extends ExpressionImpl implements Enumeration {
+
+ private EdmEnumType type;
+ private List<String> values = new ArrayList<String>();
+
+ @Override
+ public List<String> getValues() {
+ return values;
+ }
+
+ public EnumerationImpl addValue(final String enumValue) {
+ values.add(enumValue);
+ return this;
+ }
+
+ @Override
+ public EdmEnumType getType() {
+ return type;
+ }
+
+ public EnumerationImpl setType(final EdmEnumType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitEnum(type, values);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionImpl.java
new file mode 100644
index 0000000..399709d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionImpl.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public abstract class ExpressionImpl implements Expression {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
new file mode 100644
index 0000000..ec2cd0a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.LambdaRef;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+
+public class LambdaRefImpl extends ExpressionImpl implements LambdaRef, VisitableExression {
+
+ private String variableText;
+
+ @Override
+ public String getVariableName() {
+ return variableText;
+ }
+
+ public LambdaRefImpl setVariableText(final String text) {
+ variableText = text;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitLambdaReference(variableText);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
new file mode 100644
index 0000000..7de63f2
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Literal;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+
+public class LiteralImpl extends ExpressionImpl implements Literal, VisitableExression {
+
+ private String text;
+
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ public LiteralImpl setText(final String text) {
+ this.text = text;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitLiteral(text);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
new file mode 100644
index 0000000..e8e7b4a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
+
+public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
+
+ private UriInfoResource path;
+
+ @Override
+ public UriInfoResource getPath() {
+ return path;
+ }
+
+ public Member setPath(final UriInfoResource pathSegments) {
+ path = pathSegments;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitMember(path);
+ }
+
+ @Override
+ public EdmType getType() {
+ UriInfoImpl uriInfo = (UriInfoImpl) path;
+ UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
+
+ if (lastResourcePart instanceof UriResourceWithKeysImpl) {
+ UriResourceWithKeysImpl lastKeyPred = (UriResourceWithKeysImpl) lastResourcePart;
+ if (lastKeyPred.getTypeFilterOnEntry() != null) {
+ return lastKeyPred.getTypeFilterOnEntry();
+ } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
+ return lastKeyPred.getTypeFilterOnCollection();
+ }
+ return lastKeyPred.getType();
+ } else if (lastResourcePart instanceof UriResourceTypedImpl) {
+ UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
+ EdmType type = lastTyped.getTypeFilter();
+ if (type != null) {
+ return type;
+ }
+ return lastTyped.getType();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isCollection() {
+ UriInfoImpl uriInfo = (UriInfoImpl) path;
+ UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
+ if (lastResourcePart instanceof UriResourceTypedImpl) {
+ UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
+ return lastTyped.isCollection();
+ }
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
new file mode 100644
index 0000000..4bd1555
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCall;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+
+public class MethodCallImpl extends ExpressionImpl implements MethodCall, VisitableExression {
+
+ private SupportedMethodCalls method;
+ private List<ExpressionImpl> parameters = new ArrayList<ExpressionImpl>();
+
+ @Override
+ public SupportedMethodCalls getMethod() {
+ return method;
+ }
+
+ public MethodCallImpl setMethod(final SupportedMethodCalls methodCalls) {
+ method = methodCalls;
+ return this;
+ }
+
+ @Override
+ public List<Expression> getParameters() {
+ List<Expression> list = new ArrayList<Expression>();
+ for (ExpressionImpl item : parameters) {
+ list.add(item);
+ }
+ return list;
+ }
+
+ public MethodCallImpl addParameter(final ExpressionImpl readCommonExpression) {
+ parameters.add(readCommonExpression);
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ List<T> userParameters = new ArrayList<T>();
+ for (ExpressionImpl parameter : parameters) {
+ userParameters.add(parameter.accept(visitor));
+ }
+ return visitor.visitMethodCall(method, userParameters);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
new file mode 100644
index 0000000..14fae5d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.TypeLiteral;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+
+public class TypeLiteralImpl extends ExpressionImpl implements TypeLiteral, VisitableExression {
+
+ private EdmType type;
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public TypeLiteralImpl setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ return visitor.visitTypeLiteral(type);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
new file mode 100644
index 0000000..e2b2f5f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedUnaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOperator;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression;
+
+public class UnaryImpl extends ExpressionImpl implements UnaryOperator, VisitableExression {
+
+ private SupportedUnaryOperators operator;
+ private ExpressionImpl expression;
+
+ @Override
+ public SupportedUnaryOperators getOperator() {
+ return operator;
+ }
+
+ public void setOperator(final SupportedUnaryOperators operator) {
+ this.operator = operator;
+ }
+
+ @Override
+ public Expression getOperand() {
+ return expression;
+ }
+
+ public void setOperand(final ExpressionImpl expression) {
+ this.expression = expression;
+ }
+
+ @Override
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ T operand = expression.accept(visitor);
+ return visitor.visitUnaryOperator(operator, operand);
+ }
+
+}
[24/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
deleted file mode 100644
index ce52f76..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedBinaryOperators.java
+++ /dev/null
@@ -1,56 +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.queryoption.expression;
-
-public enum SupportedBinaryOperators {
-
- //enum
- HAS("has"),
- // multiplicative
- MUL("mul"), DIV("div"), MOD("mod"),
- // additive
- ADD("add"), SUB("sub"),
- // comparism
- GT("gt"), GE("ge"), LT("lt"), LE("le"),
- // equality
- EQ("eq"), NE("ne"),
- // and/or
- AND("and"), OR("or");
-
- private String syntax;
-
- private SupportedBinaryOperators(final String syntax) {
- this.syntax = syntax;
- }
-
- public static SupportedBinaryOperators get(final String operator) {
- for (SupportedBinaryOperators op : SupportedBinaryOperators.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedConstants.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedConstants.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedConstants.java
deleted file mode 100644
index 4813729..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedConstants.java
+++ /dev/null
@@ -1,47 +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.queryoption.expression;
-
-public enum SupportedConstants {
-
- TRUE("true"),
- FALSE("false"),
- NULL("null");
-
- private String syntax;
-
- private SupportedConstants(final String syntax) {
- this.syntax = syntax;
- }
-
- public static SupportedConstants get(final String operator) {
- for (SupportedConstants op : SupportedConstants.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
deleted file mode 100644
index b3e7804..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedMethodCalls.java
+++ /dev/null
@@ -1,56 +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.queryoption.expression;
-
-public enum SupportedMethodCalls {
- CONTAINS("contains"), STARTSWITH("startswith"), ENDSWITH("endswith"), LENGTH("length"),
- INDEXOF("indexof"), SUBSTRING("substring"), TOLOWER("tolower"), TOUPPER("toupper"), TRIM("trim"),
- CONCAT("concat"),
-
- YEAR("year"), MONTH("month"), DAY("day"), HOUR("hour"), MINUTE("minute"), SECOND("second"),
- FRACTIONALSECONDS("fractionalseconds"), TOTALSECONDS("totalseconds"), DATE("date"), TIME("time"),
- TOTALOFFSETMINUTES("totaloffsetminutes"), MINDATETIME("mindatetime"), MAXDATETIME("maxdatetime"), NOW("now"),
-
- ROUND("round"), FLOOR("floor"),
-
- CEILING("ceiling"), GEODISTANCE("geo.distance"), GEOLENGTH("geo.length"), GEOINTERSECTS("geo.intersects"),
- CAST("cast"),
- ISOF("isof");
-
- private String syntax;
-
- private SupportedMethodCalls(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SupportedMethodCalls get(final String method) {
- for (SupportedMethodCalls op : SupportedMethodCalls.values()) {
- if (op.toString().equals(method )) {
- return op;
- }
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
deleted file mode 100644
index cd4a932..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/SupportedUnaryOperators.java
+++ /dev/null
@@ -1,44 +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.queryoption.expression;
-
-public enum SupportedUnaryOperators {
- MINUS("-"), NOT("not");
-
- private String syntax;
-
- private SupportedUnaryOperators(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SupportedUnaryOperators get(final String operator) {
- for (SupportedUnaryOperators op : SupportedUnaryOperators.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
deleted file mode 100644
index 4aa6bcf..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/TypeLiteral.java
+++ /dev/null
@@ -1,27 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-
-public interface TypeLiteral extends Expression {
-
- public EdmType getType();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
deleted file mode 100644
index 62d935c..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/UnaryOperator.java
+++ /dev/null
@@ -1,27 +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.queryoption.expression;
-
-public interface UnaryOperator extends Expression {
-
- public Expression getOperand();
-
- public SupportedUnaryOperators getOperator();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
deleted file mode 100644
index ab31dd7..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/VisitableExression.java
+++ /dev/null
@@ -1,47 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-
-public interface VisitableExression {
-
- /**
- * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
- * each expression used as node in an expression tree. The implementations should
- * behave as follows:
- * <li>Call accept on all sub nodes and store the returned Objects which are of the generic type T
- * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored return objects
- * to that instance
- * <li>Return the object which should be passed to the processing algorithm of the parent expression node
- * <br>
- * <br>
- * @param visitor
- * Object (implementing {@link ExpressionVisitor}) whose methods are called during traversing a
- * expression node of the expression tree.
- * @return
- * Object of type T which should be passed to the processing algorithm of the parent expression node
- * @throws ExceptionVisitExpression
- * Exception occurred the OData library while traversing the tree
- * @throws ODataApplicationException
- * Exception thrown by the application who implemented the visitor
- */
- <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
deleted file mode 100644
index c6b123b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchBinary.java
+++ /dev/null
@@ -1,29 +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.queryoption.search;
-
-public interface SearchBinary extends SearchExpression {
-
- SupportedSearchBinaryOperators getOperator();
-
- SearchExpression getLeftOperand();
-
- SearchExpression getRightOperand();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchExpression.java
deleted file mode 100644
index 7c68b5b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchExpression.java
+++ /dev/null
@@ -1,23 +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.queryoption.search;
-
-public interface SearchExpression {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
deleted file mode 100644
index 7979917..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchTerm.java
+++ /dev/null
@@ -1,25 +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.queryoption.search;
-
-public interface SearchTerm extends SearchExpression {
-
- String getSearchTerm();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
deleted file mode 100644
index 422641a..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SearchUnary.java
+++ /dev/null
@@ -1,25 +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.queryoption.search;
-
-public interface SearchUnary {
-
- SearchExpression getOperand();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
deleted file mode 100644
index 76702b5..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
+++ /dev/null
@@ -1,46 +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.queryoption.search;
-
-public enum SupportedSearchBinaryOperators {
- // and/or
- AND("and"), OR("or");
-
- private String syntax;
-
- private SupportedSearchBinaryOperators(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SupportedSearchBinaryOperators get(final String operator) {
- for (SupportedSearchBinaryOperators op : SupportedSearchBinaryOperators.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
deleted file mode 100644
index d62941c..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
+++ /dev/null
@@ -1,43 +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.queryoption.search;
-
-public enum SupportedSearchUnaryOperators {
- NOT("not");
-
- private String syntax;
-
- private SupportedSearchUnaryOperators(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SupportedSearchUnaryOperators get(final String operator) {
- for (SupportedSearchUnaryOperators op : SupportedSearchUnaryOperators.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfo.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfo.java
new file mode 100644
index 0000000..ddd86b8
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfo.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriInfo extends
+ UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
+ UriInfoEntityId, UriInfoMetadata, UriInfoResource {
+
+ public UriInfoService asUriInfoService();
+
+ public UriInfoAll asUriInfoAll();
+
+ public UriInfoBatch asUriInfoBatch();
+
+ public UriInfoCrossjoin asUriInfoCrossjoin();
+
+ public UriInfoEntityId asUriInfoEntityId();
+
+ public UriInfoMetadata asUriInfoMetadata();
+
+ public UriInfoResource asUriInfoResource();
+
+ public UriInfoKind getKind();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoAll.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoAll.java
new file mode 100644
index 0000000..9c5bd5c
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoAll.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriInfoAll {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoBatch.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoBatch.java
new file mode 100644
index 0000000..703ef36
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoBatch.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriInfoBatch {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoCrossjoin.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoCrossjoin.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoCrossjoin.java
new file mode 100644
index 0000000..f055847
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoCrossjoin.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.server.api.uri;
+
+import java.util.List;
+
+public interface UriInfoCrossjoin {
+
+ List<String> getEntitySetNames();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoEntityId.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoEntityId.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoEntityId.java
new file mode 100644
index 0000000..93345ae
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoEntityId.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+
+/**
+ * Indicates a URL access to an single Entity
+ */
+public interface UriInfoEntityId {
+
+ public List<CustomQueryOption> getCustomQueryOptions();
+
+ public EdmEntityType getEntityTypeCast();
+
+ public ExpandOption getExpandOption();
+
+ public FormatOption getFormatOption();
+
+ public IdOption getIdOption();
+
+ public SelectOption getSelectOption();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoKind.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoKind.java
new file mode 100644
index 0000000..d3f2baf
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoKind.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public enum UriInfoKind {
+ all, batch, crossjoin, entityId, metadata, resource, service;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoMetadata.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoMetadata.java
new file mode 100644
index 0000000..4d35971
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoMetadata.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+
+public interface UriInfoMetadata {
+
+ public FormatOption getFormatOption();
+
+ public String getFragment() ;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
new file mode 100644
index 0000000..8d3a69a
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+
+public interface UriInfoResource {
+
+ List<CustomQueryOption> getCustomQueryOptions();
+
+ ExpandOption getExpandOption();
+
+ FilterOption getFilterOption();
+
+ FormatOption getFormatOption();
+
+ IdOption getIdOption();
+
+ InlineCountOption getInlineCountOption();
+
+ OrderByOption getOrderByOption();
+
+ SearchOption getSearchOption();
+
+ SelectOption getSelectOption();
+
+ SkipOption getSkipOption();
+
+ SkipTokenOption getSkipTokenOption();
+
+ TopOption getTopOption();
+
+ List<UriResource> getUriResourceParts();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoService.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoService.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoService.java
new file mode 100644
index 0000000..7cbc333
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoService.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriInfoService {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
new file mode 100644
index 0000000..6815e85
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface UriParameter {
+
+ public String getAlias();
+
+ public String getText();
+
+ public Expression getExression();
+
+ public String getName();
+
+ public String getRefencedProperty();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResource.java
new file mode 100644
index 0000000..167a1f8
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResource.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.server.api.uri;
+
+public interface UriResource {
+
+ UriResourceKind getKind();
+
+ @Override
+ String toString();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceAction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceAction.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceAction.java
new file mode 100644
index 0000000..bd73fcb
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceAction.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+
+public interface UriResourceAction extends UriResourcePartTyped {
+
+ EdmAction getAction();
+
+ /**
+ * Convenience method which returns the {@link EdmActionImport} which was used in
+ * the resource path to define the {@link EdmAction}.
+ * @return
+ */
+ EdmActionImport getActionImport();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceComplexProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceComplexProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceComplexProperty.java
new file mode 100644
index 0000000..43840f3
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceComplexProperty.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+
+public interface UriResourceComplexProperty extends UriResourceProperty {
+
+ EdmComplexType getComplexType();
+
+ EdmComplexType getComplexTypeFilter();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceCount.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceCount.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceCount.java
new file mode 100644
index 0000000..4a661ae
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceCount.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriResourceCount extends UriResource {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceEntitySet.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceEntitySet.java
new file mode 100644
index 0000000..1cae7f5
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceEntitySet.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.server.api.uri;
+
+import java.util.List;
+
+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.EdmType;
+
+public interface UriResourceEntitySet extends UriResourcePartTyped {
+
+ EdmEntitySet getEntitySet();
+
+ EdmEntityType getEntityType();
+
+ List<UriParameter> getKeyPredicates();
+
+ EdmType getTypeFilterOnCollection();
+
+ EdmType getTypeFilterOnEntry();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceFunction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceFunction.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceFunction.java
new file mode 100644
index 0000000..62bda01
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceFunction.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import java.util.List;
+
+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.EdmType;
+
+public interface UriResourceFunction extends UriResourcePartTyped {
+
+ EdmFunction getFunction();
+
+ /**
+ * Convenience method which returns the {@link EdmFunctionImport} which was used in
+ * the resource path to define the {@link EdmFunction}.
+ * @return
+ */
+ EdmFunctionImport getFunctionImport();
+
+ List<UriParameter> getKeyPredicates();
+
+ List<UriParameter> getParameters();
+
+ EdmType getTypeFilterOnCollection();
+
+ EdmType getTypeFilterOnEntry();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceIt.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceIt.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceIt.java
new file mode 100644
index 0000000..5fe9055
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceIt.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+/**
+ * Class indicating the $it reference. $it may be used within filter to
+ * refer to the last EDM object reference in the resource path. Since $it is
+ * optional in some cases ( e.g. first member expressions) the {@link #isExplicitIt()}
+ * method can be used to check if $it was explicitly noted in the URI
+ */
+public interface UriResourceIt extends UriResourcePartTyped {
+
+ EdmType getTypeFilterOnCollection();
+
+ EdmType getTypeFilterOnEntry();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceKind.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceKind.java
new file mode 100644
index 0000000..95ba402
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceKind.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ *
+ * 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.server.api.uri;
+
+public enum UriResourceKind {
+ action, complexProperty, count, entitySet, function, it, lambdaAll, lambdaAny,
+ lambdaVariable, navigationProperty, ref, root, primitiveProperty, singleton, startingTypeFilter, value,
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAll.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAll.java
new file mode 100644
index 0000000..b28bbb7
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAll.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface UriResourceLambdaAll extends UriResourcePartTyped {
+
+ public String getLamdaVariable();
+
+ public Expression getExpression();
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAny.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAny.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAny.java
new file mode 100644
index 0000000..b7e2bda
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaAny.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface UriResourceLambdaAny extends UriResourcePartTyped {
+
+ public String getLamdaVariable();
+
+ public Expression getExpression();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaRef.java
new file mode 100644
index 0000000..6bc523d
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceLambdaRef.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+
+public interface UriResourceLambdaRef extends UriResourcePartTyped {
+
+ public String getVariableText();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceNavigation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceNavigation.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceNavigation.java
new file mode 100644
index 0000000..509e0ed
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceNavigation.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public interface UriResourceNavigation extends UriResourcePartTyped {
+
+ List<UriParameter> getKeyPredicates();
+
+ EdmNavigationProperty getProperty();
+
+ EdmType getTypeFilterOnCollection();
+
+ EdmType getTypeFilterOnEntry();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePartTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePartTyped.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePartTyped.java
new file mode 100644
index 0000000..0f169b1
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePartTyped.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ *
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public interface UriResourcePartTyped extends UriResource {
+
+ EdmType getType();
+
+ boolean isCollection();
+
+ String toString(boolean includeFilters);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePrimitiveProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePrimitiveProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePrimitiveProperty.java
new file mode 100644
index 0000000..896959b
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourcePrimitiveProperty.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriResourcePrimitiveProperty extends UriResourceProperty {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceProperty.java
new file mode 100644
index 0000000..f743f49
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceProperty.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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+
+public interface UriResourceProperty extends UriResourcePartTyped {
+
+ EdmProperty getProperty();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRef.java
new file mode 100644
index 0000000..e8ccb65
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRef.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriResourceRef extends UriResource {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRoot.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRoot.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRoot.java
new file mode 100644
index 0000000..ffe2211
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceRoot.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.server.api.uri;
+
+/**
+ * Class indicating the $root reference. $root may be used within filter to
+ * refer to the current OData service
+ */
+public interface UriResourceRoot extends UriResource {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceSingleton.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceSingleton.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceSingleton.java
new file mode 100644
index 0000000..82794a7
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceSingleton.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+
+public interface UriResourceSingleton extends UriResourcePartTyped {
+
+ EdmSingleton getSingleton();
+
+ EdmEntityType getEntityType();
+
+ EdmEntityType getEntityTypeFilter();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
new file mode 100644
index 0000000..a488c3c
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public interface UriResourceStartingTypeFilter extends UriResourcePartTyped {
+
+ EdmType getTypeFilterOnCollection();
+
+ EdmType getTypeFilterOnEntry();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceValue.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceValue.java
new file mode 100644
index 0000000..befcac5
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceValue.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri;
+
+public interface UriResourceValue extends UriResource {
+
+}
[09/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
deleted file mode 100644
index 8bf5352..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
+++ /dev/null
@@ -1,1360 +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.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.aAM().aFC().aCS().log(1).run("ODI?$filter=PropertyEnumString has com.sap.odata.test1.ENString'String1'");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 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($id = ODI))) <EOF>)");
-
- test.run("$entity?$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
- + "entityOptions(id($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(commonExpr(primitiveLiteral(1))) )))))) <EOF>)");
-
- test.run("ODI('ABC')")
- .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(string('ABC')))) )))))) <EOF>)");
-
- test.run("ODI(K1=1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(1)))) )))))) <EOF>)");
-
- test.run("ODI(K1='ABC')")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC'))))) )))))) <EOF>)");
-
- test.run("ODI(K1='ABC',K2=123)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )))))) <EOF>)");
-
- test.run("ODI(K1=1)(P1=1)")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
- + "pathSegment(odataIdentifier(ODI) "
- + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
- + "commonExpr(primitiveLiteral(1)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(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) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) ,"
- + " nameValuePair(odataIdentifier(P2) = commonExpr(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) = "
- + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
- + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
- + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) , "
- + "nameValuePair(odataIdentifier(P2) = commonExpr(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) = "
- + "commonExpr(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 = expandItem(*)))))) <EOF>)");
-
- test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = "
- + "expandItem(*) , "
- + "expandItem(*) , "
- + "expandItem(*)))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = "
- + "expandItem(* / ref($ref))))))) <EOF>)");
-
- test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment("
- + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
- + "expand($expand = 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 = "
- + "expandItem(* ( $levels = 12 ))))))) <EOF>)");
- test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
- + "queryOption(systemQueryOption(expand($expand = 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 = "
- + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(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 = "
- + "expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI)) / "
- + "expandPathSegment(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 = "
- + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI)) / "
- + "expandPathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(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 = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
- + "expandRefOption(skip($skip = 1)) )))))))) <EOF>)");
-
- test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(expand($expand = "
- + "expandItem(expandPath("
- + "expandPathSegment(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 = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
- + "expandCountOption(filter($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 = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
- + "expandCountOption($search = \"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 = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
- + "expandRefOption(skip($skip = 1)) ; expandRefOption(expandCountOption(filter($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 = expandItem(expandPath("
- + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(( expandOption("
- + "expandRefOption(skip($skip = 1))) ; expandOption(expandRefOption(expandCountOption(filter($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(selectSegment(*))))))) <EOF>)");
-
- test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
-
- test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(namespace(odataIdentifier(NS) .) *))))))) <EOF>)");
-
- test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
- + "systemQueryOption(select("
- + "$select = selectItem(selectSegment(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("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(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("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(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(selectSegment(odataIdentifier(ODI))) , "
- + "selectItem(selectSegment(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(selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
- + "selectItem(selectSegment(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("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(odataIdentifier(ODIm))) , "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(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("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
- + "selectItem("
- + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
- + "selectSegment(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(enumLit(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(enumLit(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(enumLit(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("
- + "geoDistanceMethodCallExpr("
- + "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( 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))))) , 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( 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))))) , 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=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(singletonEntity)) <EOF>)");
-
- test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(NS . ODI)) <EOF>)");
-
- test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF(odataRelativeUri("
- + "$metadata # contextFragment(Edm . Boolean)) <EOF>)");
-
- test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(ODI / $deletedEntity)) <EOF>)");
-
- test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(ODI / $link)) <EOF>)");
-
- test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
- + "odataRelativeUri($metadata # contextFragment(ODI / $deletedLink)) <EOF>)");
-
- test.run("$metadata#ODI(1)/ODI")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) / odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI")
- .isText(
- "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
- + "nameValueOptList(( valueOnly(commonExpr(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(commonExpr(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(commonExpr("
- + "primitiveLiteral(1))) )))) <EOF>)");
-
- test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- + "/ odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(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(commonExpr(primitiveLiteral(1))) )) "
- + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
-
- test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- + "propertyList(( propertyListItem(*) )))) <EOF>)");
-
- test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
- + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
- test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
- + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(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(commonExpr(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(commonExpr(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(commonExpr(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(commonExpr("
- + "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>)");
- }
-
-
-}
[26/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
new file mode 100644
index 0000000..6fbef03
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderTest.java
@@ -0,0 +1,374 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.client.api.deserializer.Entity;
+import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.Reader;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+import org.apache.olingo.odata4.client.core.deserializer.JsonReader;
+import org.junit.Test;
+
+public class JsonReaderTest {
+
+ @Test
+ public void testEntitySet() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(
+ JsonReaderTest.class.getResourceAsStream("/fullEntitySet.json"));
+
+ List<Entity> entities = entitySet.getEntities();
+ validateEntitySet(entitySet);
+ assertNotNull(entities);
+ Entity entity = entities.get(0);
+ assertNotNull(entity);
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ }
+
+ @Test
+ public void testEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+
+ List<Entity> entities = entitySet.getEntities();
+ validateEntitySet(entitySet);
+ assertNotNull(entities);
+ assertEquals(2, entities.size());
+ //
+ Entity firstEntity = entities.get(0);
+ assertNotNull(firstEntity);
+ validateEntityAlfki(firstEntity);
+
+ StructuralProperty structuralProperty = firstEntity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+
+ //
+ Entity secondEntity = entities.get(1);
+ assertNotNull(secondEntity);
+ validateEntityMuski(secondEntity);
+
+ StructuralProperty addressMuster = secondEntity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ }
+
+ @Test
+ public void streamingTestForEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+ validateEntitySet(entitySet, false);
+
+ for (Entity entity : entitySet) {
+ if ("Customers('ALFKI')".equals(entity.getODataId())) {
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
+ validateEntityMuski(entity);
+
+ StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ } else {
+ fail("Got unknown entity with id '" + entity.getODataId() + "'.");
+ }
+ }
+
+ validateEntitySet(entitySet, true);
+ }
+
+ @Test
+ public void iteratorTestForEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+ assertEquals(2, entitySet.getEntities().size());
+ validateEntitySet(entitySet, true);
+
+ for (Entity entity : entitySet) {
+ if ("Customers('ALFKI')".equals(entity.getODataId())) {
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
+ validateEntityMuski(entity);
+
+ StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ } else {
+ fail("Got unknown entity with id '" + entity.getODataId() + "'.");
+ }
+ }
+ }
+
+ @Test
+ public void testEntity() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Entity entity = consumer.readEntity(JsonReaderTest.class.getResourceAsStream("/fullEntity.json"));
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ }
+
+ @Test
+ public void testComplexProperty() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Property property = consumer.readProperty(getJson("/complexProperty.json"));
+ assertEquals("Address", property.getName());
+
+ assertTrue(property instanceof StructuralProperty);
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateAddressBerlin(complexValue);
+ }
+
+ @Test
+ public void testEntityWithCollectionOfComplexProperty() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Entity entity = consumer.readEntity(getJson("/fullEntityWithCollectionOfComplexValues.json"));
+ StructuralProperty address = entity.getProperty("Address", StructuralProperty.class);
+ assertTrue(address.containsCollection());
+ assertEquals("Address", address.getName());
+
+ List<Value> values = address.getValues();
+ assertEquals(2, values.size());
+
+ Value value = values.get(0);
+ assertTrue(value.isComplex());
+ validateAddressBerlin((ComplexValue) value);
+ //
+ ComplexValue addressTwo = (ComplexValue) values.get(1);
+ validateAddressMuster(addressTwo);
+ }
+
+ @Test
+ public void testSetOfPrimitive() throws Exception {
+ Reader consumer = new JsonReader();
+
+ InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfPrimitiveProperties.json");
+ Property property = consumer.readProperty(content);
+ assertEquals("EmailAddresses", property.getName());
+
+ assertTrue(property instanceof StructuralProperty);
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+
+ assertTrue(structuralProperty.containsCollection());
+ Collection<Value> values = structuralProperty.getValues();
+ Iterator<Value> valueIt = values.iterator();
+ assertEquals("Julie@Swansworth.com", valueIt.next().getContent());
+ assertEquals("Julie.Swansworth@work.com", valueIt.next().getContent());
+ }
+
+ @Test
+ public void testSetOfComplex() throws Exception {
+ Reader consumer = new JsonReader();
+
+ InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfComplexProperties.json");
+ Property property = consumer.readProperty(content);
+ Assert.assertEquals("PhoneNumbers", property.getName());
+ Assert.assertTrue(property instanceof StructuralProperty);
+
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+ assertTrue(structuralProperty.containsCollection());
+ List<Value> values = structuralProperty.getValues();
+ assertEquals(2, values.size());
+
+ ComplexValue phoneNumberOne = (ComplexValue) values.get(0);
+ assertEquals("425-555-1212", phoneNumberOne.getValue("Number").getContent());
+ assertEquals("Home", phoneNumberOne.getValue("Type").getContent());
+ assertEquals(null, phoneNumberOne.getValue("Carrier"));
+ assertEquals(null, phoneNumberOne.getAnnotationProperties().get("odata.type"));
+
+ ComplexValue phoneNumberTwo = (ComplexValue) values.get(1);
+ assertEquals("425-555-0178", phoneNumberTwo.getValue("Number").getContent());
+ assertEquals("Cell", phoneNumberTwo.getValue("Type").getContent());
+ assertEquals("Sprint", phoneNumberTwo.getValue("Carrier").getContent());
+ assertEquals("#Model.CellPhoneNumber",
+ phoneNumberTwo.getAnnotationProperties().get("odata.type").getValue());
+
+ // ComplexValue complex = consumer.parseComplexValue(content);
+ //
+ // Value value = complex.getValue("PhoneNumbers");
+ // assertNotNull(value);
+ // assertTrue(value.isComplex());
+ // ComplexValue complexValue = (ComplexValue) value;
+ }
+
+ private void validateEntityAlfki(final Entity entity) {
+ assertNotNull(entity);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
+ assertEquals("Customers('ALFKI')", entity.getODataId());
+ assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
+ assertEquals("Customers('ALFKI')", entity.getODataEditLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('ALFKI')/Orders",
+ entity.getNavigationProperties().get("Orders").getNavigationLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('ALFKI')/Orders/$ref",
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
+
+ assertNotNull(entity.getPropertyContent("ID"));
+ assertEquals("ALFKI", entity.getPropertyContent("ID"));
+ assertEquals("Alfreds Futterkiste", entity.getPropertyContent("CompanyName"));
+ assertEquals("Maria Anders", entity.getPropertyContent("ContactName"));
+ assertEquals("Sales Representative", entity.getPropertyContent("ContactTitle"));
+ assertEquals("030-0074321", entity.getPropertyContent("Phone"));
+ assertEquals("030-0076545", entity.getPropertyContent("Fax"));
+ }
+
+ private void validateEntityMuski(final Entity entity) {
+ assertNotNull(entity);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
+ assertEquals("Customers('MUSKI')", entity.getODataId());
+ assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
+ assertEquals("Customers('MUSKI')", entity.getODataEditLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('MUSKI')/Orders", entity.getNavigationProperties().get("Orders").getNavigationLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('MUSKI')/Orders/$ref",
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
+
+ assertNotNull(entity.getPropertyContent("ID"));
+ assertEquals("MUSKI", entity.getPropertyContent("ID"));
+ assertEquals("Mustermanns Futterkiste", entity.getPropertyContent("CompanyName"));
+ assertEquals("Mustermann Max", entity.getPropertyContent("ContactName"));
+ assertEquals("Some Guy", entity.getPropertyContent("ContactTitle"));
+ assertEquals("030-002222", entity.getPropertyContent("Phone"));
+ assertEquals("030-004444", entity.getPropertyContent("Fax"));
+ }
+
+ private void validateAddressMuster(final ComplexValue addressTwo) {
+ assertEquals("Musterstrasse 42", addressTwo.getValue("Street").getContent());
+ assertEquals("Musterstadt", addressTwo.getValue("City").getContent());
+ assertEquals("SomeRegion", addressTwo.getValue("Region").getContent());
+ assertEquals("D-42042", addressTwo.getValue("PostalCode").getContent());
+ }
+
+ private void validateAddressBerlin(final ComplexValue complex) {
+ assertNotNull(complex);
+
+ assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
+ assertEquals("Berlin", complex.getValue("City").getContent());
+ assertNull(complex.getValue("Region").getContent());
+ assertEquals("D-12209", complex.getValue("PostalCode").getContent());
+ }
+
+ private void validateComplexValueNavigationLinks(final ComplexValue complex) {
+ assertNotNull(complex.getNavigationProperties());
+ assertTrue(complex.getNavigationProperties().containsKey("Country"));
+ assertEquals("Customers('ALFKI')/Address/Country",
+ complex.getNavigationProperties().get("Country").getNavigationLink());
+
+ assertNotNull(complex.getNavigationProperties());
+ assertTrue(complex.getNavigationProperties().containsKey("Country"));
+ assertEquals("Customers('ALFKI')/Address/Country/$ref",
+ complex.getNavigationProperties().get("Country").getAssociationLink());
+ }
+
+ private void validateEntitySet(final EntitySet entitySet) {
+ validateEntitySet(entitySet, true);
+ }
+
+ private void validateEntitySet(final EntitySet entitySet, final boolean validateLinks) {
+ assertNotNull(entitySet);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entitySet.getODataContext());
+ assertEquals(Long.valueOf(1), entitySet.getODataCount());
+ if (validateLinks) {
+ assertEquals("http://host/service/EntitySet?$skiptoken=342r89", entitySet.getODataNextLink());
+ assertNull(entitySet.getODataDeltaLink());
+ }
+ }
+
+ private InputStream getJson(final String filename) {
+ return JsonReaderTest.class.getResourceAsStream(filename);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
new file mode 100644
index 0000000..8097e9f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/testutil/StringHelper.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.client.core.testutil;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+/**
+ * @author SAP AG
+ */
+public class StringHelper {
+
+ public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
+ final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
+ final StringBuilder stringBuilder = new StringBuilder();
+ String line = null;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ stringBuilder.append(line);
+ if (preserveLineBreaks) {
+ stringBuilder.append("\n");
+ }
+ }
+
+ bufferedReader.close();
+
+ final String result = stringBuilder.toString();
+
+ return result;
+ }
+
+ public static String inputStreamToString(final InputStream in) throws IOException {
+ return inputStreamToString(in, false);
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
+ *
+ * @param content to encapsulate content
+ * @return content as stream
+ */
+ public static InputStream encapsulate(final String content) {
+ try {
+ return encapsulate(content, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // we know that UTF-8 is supported
+ throw new RuntimeException("UTF-8 MUST be supported.", e);
+ }
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with given charset.
+ *
+ * @param content to encapsulate content
+ * @param charset to be used charset
+ * @return content as stream
+ * @throws UnsupportedEncodingException if charset is not supported
+ */
+ public static InputStream encapsulate(final String content, final String charset)
+ throws UnsupportedEncodingException {
+ return new ByteArrayInputStream(content.getBytes(charset));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static InputStream generateDataStream(final int len) {
+ return encapsulate(generateData(len));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static String generateData(final int len) {
+ StringBuilder b = new StringBuilder(len);
+ for (int j = 0; j < len; j++) {
+ char c = (char) (Math.random() * 26 + 65);
+ b.append(c);
+ }
+ return b.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
deleted file mode 100644
index bde0de5..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
+++ /dev/null
@@ -1,41 +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.consumer.core;
-
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.consumer.api.ODataConsumer;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ODataConsumerTest {
-
- private ODataConsumer consumer;
-
- @Before
- public void before() {
- consumer = ODataConsumer.create();
- }
-
- @Test
- public void edmtest() {
- EdmProvider provider = null;
- consumer.createEdm(provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
deleted file mode 100644
index e88c76a..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
+++ /dev/null
@@ -1,72 +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.consumer.core.deserializer;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-import org.apache.olingo.odata4.consumer.core.testutil.StringHelper;
-import org.junit.Test;
-
-public class JsonReaderPerformance {
-
- @Test
- public void testComplexPropertyPerformance() throws Exception {
- JsonReader consumer = new JsonReader();
- int runs = 1000; // * 100;
-
- InputStream in = JsonReaderPerformance.class.getResourceAsStream("/complexProperty.json");
- String content = StringHelper.inputStreamToString(in);
-
-// System.out.println("Started...");
- ComplexValue complex = null;
-// long startTime = System.currentTimeMillis();
- for (int i = 0; i < runs; i++) {
- Property property = consumer.readProperty(StringHelper.encapsulate(content));
- complex = (ComplexValue) ((StructuralProperty) property).getValue();
- }
-// long endTime = System.currentTimeMillis();
-
-// long duration = endTime - startTime;
-// System.out.println("Duration: " + duration + " ms");
-// System.out.println("Duration per run: " + (duration / (float) runs) + " ms");
-
- testComplexProperty(complex);
- }
-
- private void testComplexProperty(final Value value) {
- assertNotNull(value);
- assertTrue(value.isComplex());
-
- ComplexValue complex = (ComplexValue) value;
-
- assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
- assertEquals("Berlin", complex.getValue("City").getContent());
- assertNull(complex.getValue("Region").getContent());
- assertEquals("D-12209", complex.getValue("PostalCode").getContent());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
deleted file mode 100644
index 978282e..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
+++ /dev/null
@@ -1,373 +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.consumer.core.deserializer;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
-import org.apache.olingo.odata4.consumer.api.deserializer.EntitySet;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.Reader;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-import org.junit.Test;
-
-public class JsonReaderTest {
-
- @Test
- public void testEntitySet() throws Exception {
- Reader consumer = new JsonReader();
-
- EntitySet entitySet = consumer.readEntitySet(
- JsonReaderTest.class.getResourceAsStream("/fullEntitySet.json"));
-
- List<Entity> entities = entitySet.getEntities();
- validateEntitySet(entitySet);
- assertNotNull(entities);
- Entity entity = entities.get(0);
- assertNotNull(entity);
- validateEntityAlfki(entity);
-
- StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", structuralProperty.getName());
-
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateComplexValueNavigationLinks(complexValue);
- }
-
- @Test
- public void testEntitySetWithTwoEntities() throws Exception {
- Reader consumer = new JsonReader();
-
- EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
-
- List<Entity> entities = entitySet.getEntities();
- validateEntitySet(entitySet);
- assertNotNull(entities);
- assertEquals(2, entities.size());
- //
- Entity firstEntity = entities.get(0);
- assertNotNull(firstEntity);
- validateEntityAlfki(firstEntity);
-
- StructuralProperty structuralProperty = firstEntity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", structuralProperty.getName());
-
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateComplexValueNavigationLinks(complexValue);
-
- //
- Entity secondEntity = entities.get(1);
- assertNotNull(secondEntity);
- validateEntityMuski(secondEntity);
-
- StructuralProperty addressMuster = secondEntity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", addressMuster.getName());
- validateAddressMuster((ComplexValue) addressMuster.getValue());
- }
-
- @Test
- public void streamingTestForEntitySetWithTwoEntities() throws Exception {
- Reader consumer = new JsonReader();
-
- EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
- validateEntitySet(entitySet, false);
-
- for (Entity entity : entitySet) {
- if ("Customers('ALFKI')".equals(entity.getODataId())) {
- validateEntityAlfki(entity);
-
- StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", structuralProperty.getName());
-
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateComplexValueNavigationLinks(complexValue);
- } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
- validateEntityMuski(entity);
-
- StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", addressMuster.getName());
- validateAddressMuster((ComplexValue) addressMuster.getValue());
- } else {
- fail("Got unknown entity with id '" + entity.getODataId() + "'.");
- }
- }
-
- validateEntitySet(entitySet, true);
- }
-
- @Test
- public void iteratorTestForEntitySetWithTwoEntities() throws Exception {
- Reader consumer = new JsonReader();
-
- EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
- assertEquals(2, entitySet.getEntities().size());
- validateEntitySet(entitySet, true);
-
- for (Entity entity : entitySet) {
- if ("Customers('ALFKI')".equals(entity.getODataId())) {
- validateEntityAlfki(entity);
-
- StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", structuralProperty.getName());
-
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateComplexValueNavigationLinks(complexValue);
- } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
- validateEntityMuski(entity);
-
- StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", addressMuster.getName());
- validateAddressMuster((ComplexValue) addressMuster.getValue());
- } else {
- fail("Got unknown entity with id '" + entity.getODataId() + "'.");
- }
- }
- }
-
- @Test
- public void testEntity() throws Exception {
- Reader consumer = new JsonReader();
-
- Entity entity = consumer.readEntity(JsonReaderTest.class.getResourceAsStream("/fullEntity.json"));
- validateEntityAlfki(entity);
-
- StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
- assertEquals("Address", structuralProperty.getName());
-
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateComplexValueNavigationLinks(complexValue);
- }
-
- @Test
- public void testComplexProperty() throws Exception {
- Reader consumer = new JsonReader();
-
- Property property = consumer.readProperty(getJson("/complexProperty.json"));
- assertEquals("Address", property.getName());
-
- assertTrue(property instanceof StructuralProperty);
- StructuralProperty structuralProperty = (StructuralProperty) property;
- Value value = structuralProperty.getValue();
- assertTrue(value.isComplex());
- ComplexValue complexValue = (ComplexValue) value;
- validateAddressBerlin(complexValue);
- validateAddressBerlin(complexValue);
- }
-
- @Test
- public void testEntityWithCollectionOfComplexProperty() throws Exception {
- Reader consumer = new JsonReader();
-
- Entity entity = consumer.readEntity(getJson("/fullEntityWithCollectionOfComplexValues.json"));
- StructuralProperty address = entity.getProperty("Address", StructuralProperty.class);
- assertTrue(address.containsCollection());
- assertEquals("Address", address.getName());
-
- List<Value> values = address.getValues();
- assertEquals(2, values.size());
-
- Value value = values.get(0);
- assertTrue(value.isComplex());
- validateAddressBerlin((ComplexValue) value);
- //
- ComplexValue addressTwo = (ComplexValue) values.get(1);
- validateAddressMuster(addressTwo);
- }
-
- @Test
- public void testSetOfPrimitive() throws Exception {
- Reader consumer = new JsonReader();
-
- InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfPrimitiveProperties.json");
- Property property = consumer.readProperty(content);
- assertEquals("EmailAddresses", property.getName());
-
- assertTrue(property instanceof StructuralProperty);
- StructuralProperty structuralProperty = (StructuralProperty) property;
-
- assertTrue(structuralProperty.containsCollection());
- Collection<Value> values = structuralProperty.getValues();
- Iterator<Value> valueIt = values.iterator();
- assertEquals("Julie@Swansworth.com", valueIt.next().getContent());
- assertEquals("Julie.Swansworth@work.com", valueIt.next().getContent());
- }
-
- @Test
- public void testSetOfComplex() throws Exception {
- Reader consumer = new JsonReader();
-
- InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfComplexProperties.json");
- Property property = consumer.readProperty(content);
- Assert.assertEquals("PhoneNumbers", property.getName());
- Assert.assertTrue(property instanceof StructuralProperty);
-
- StructuralProperty structuralProperty = (StructuralProperty) property;
- assertTrue(structuralProperty.containsCollection());
- List<Value> values = structuralProperty.getValues();
- assertEquals(2, values.size());
-
- ComplexValue phoneNumberOne = (ComplexValue) values.get(0);
- assertEquals("425-555-1212", phoneNumberOne.getValue("Number").getContent());
- assertEquals("Home", phoneNumberOne.getValue("Type").getContent());
- assertEquals(null, phoneNumberOne.getValue("Carrier"));
- assertEquals(null, phoneNumberOne.getAnnotationProperties().get("odata.type"));
-
- ComplexValue phoneNumberTwo = (ComplexValue) values.get(1);
- assertEquals("425-555-0178", phoneNumberTwo.getValue("Number").getContent());
- assertEquals("Cell", phoneNumberTwo.getValue("Type").getContent());
- assertEquals("Sprint", phoneNumberTwo.getValue("Carrier").getContent());
- assertEquals("#Model.CellPhoneNumber",
- phoneNumberTwo.getAnnotationProperties().get("odata.type").getValue());
-
- // ComplexValue complex = consumer.parseComplexValue(content);
- //
- // Value value = complex.getValue("PhoneNumbers");
- // assertNotNull(value);
- // assertTrue(value.isComplex());
- // ComplexValue complexValue = (ComplexValue) value;
- }
-
- private void validateEntityAlfki(final Entity entity) {
- assertNotNull(entity);
-
- assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
- assertEquals("Customers('ALFKI')", entity.getODataId());
- assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
- assertEquals("Customers('ALFKI')", entity.getODataEditLink());
-
- assertNotNull(entity.getNavigationProperties());
- assertTrue(entity.getNavigationProperties().containsKey("Orders"));
- assertEquals("Customers('ALFKI')/Orders",
- entity.getNavigationProperties().get("Orders").getNavigationLink());
-
- assertNotNull(entity.getNavigationProperties());
- assertTrue(entity.getNavigationProperties().containsKey("Orders"));
- assertEquals("Customers('ALFKI')/Orders/$ref",
- entity.getNavigationProperties().get("Orders").getAssociationLink());
-
- assertNotNull(entity.getPropertyContent("ID"));
- assertEquals("ALFKI", entity.getPropertyContent("ID"));
- assertEquals("Alfreds Futterkiste", entity.getPropertyContent("CompanyName"));
- assertEquals("Maria Anders", entity.getPropertyContent("ContactName"));
- assertEquals("Sales Representative", entity.getPropertyContent("ContactTitle"));
- assertEquals("030-0074321", entity.getPropertyContent("Phone"));
- assertEquals("030-0076545", entity.getPropertyContent("Fax"));
- }
-
- private void validateEntityMuski(final Entity entity) {
- assertNotNull(entity);
-
- assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
- assertEquals("Customers('MUSKI')", entity.getODataId());
- assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
- assertEquals("Customers('MUSKI')", entity.getODataEditLink());
-
- assertNotNull(entity.getNavigationProperties());
- assertTrue(entity.getNavigationProperties().containsKey("Orders"));
- assertEquals("Customers('MUSKI')/Orders", entity.getNavigationProperties().get("Orders").getNavigationLink());
-
- assertNotNull(entity.getNavigationProperties());
- assertTrue(entity.getNavigationProperties().containsKey("Orders"));
- assertEquals("Customers('MUSKI')/Orders/$ref",
- entity.getNavigationProperties().get("Orders").getAssociationLink());
-
- assertNotNull(entity.getPropertyContent("ID"));
- assertEquals("MUSKI", entity.getPropertyContent("ID"));
- assertEquals("Mustermanns Futterkiste", entity.getPropertyContent("CompanyName"));
- assertEquals("Mustermann Max", entity.getPropertyContent("ContactName"));
- assertEquals("Some Guy", entity.getPropertyContent("ContactTitle"));
- assertEquals("030-002222", entity.getPropertyContent("Phone"));
- assertEquals("030-004444", entity.getPropertyContent("Fax"));
- }
-
- private void validateAddressMuster(final ComplexValue addressTwo) {
- assertEquals("Musterstrasse 42", addressTwo.getValue("Street").getContent());
- assertEquals("Musterstadt", addressTwo.getValue("City").getContent());
- assertEquals("SomeRegion", addressTwo.getValue("Region").getContent());
- assertEquals("D-42042", addressTwo.getValue("PostalCode").getContent());
- }
-
- private void validateAddressBerlin(final ComplexValue complex) {
- assertNotNull(complex);
-
- assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
- assertEquals("Berlin", complex.getValue("City").getContent());
- assertNull(complex.getValue("Region").getContent());
- assertEquals("D-12209", complex.getValue("PostalCode").getContent());
- }
-
- private void validateComplexValueNavigationLinks(final ComplexValue complex) {
- assertNotNull(complex.getNavigationProperties());
- assertTrue(complex.getNavigationProperties().containsKey("Country"));
- assertEquals("Customers('ALFKI')/Address/Country",
- complex.getNavigationProperties().get("Country").getNavigationLink());
-
- assertNotNull(complex.getNavigationProperties());
- assertTrue(complex.getNavigationProperties().containsKey("Country"));
- assertEquals("Customers('ALFKI')/Address/Country/$ref",
- complex.getNavigationProperties().get("Country").getAssociationLink());
- }
-
- private void validateEntitySet(final EntitySet entitySet) {
- validateEntitySet(entitySet, true);
- }
-
- private void validateEntitySet(final EntitySet entitySet, final boolean validateLinks) {
- assertNotNull(entitySet);
-
- assertEquals("http://host/service/$metadata#Customers/$entity", entitySet.getODataContext());
- assertEquals(Long.valueOf(1), entitySet.getODataCount());
- if (validateLinks) {
- assertEquals("http://host/service/EntitySet?$skiptoken=342r89", entitySet.getODataNextLink());
- assertNull(entitySet.getODataDeltaLink());
- }
- }
-
- private InputStream getJson(final String filename) {
- return JsonReaderTest.class.getResourceAsStream(filename);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
deleted file mode 100644
index 4344cad..0000000
--- a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
+++ /dev/null
@@ -1,110 +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.consumer.core.testutil;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-
-/**
- * @author SAP AG
- */
-public class StringHelper {
-
- public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
- final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
- final StringBuilder stringBuilder = new StringBuilder();
- String line = null;
-
- while ((line = bufferedReader.readLine()) != null) {
- stringBuilder.append(line);
- if (preserveLineBreaks) {
- stringBuilder.append("\n");
- }
- }
-
- bufferedReader.close();
-
- final String result = stringBuilder.toString();
-
- return result;
- }
-
- public static String inputStreamToString(final InputStream in) throws IOException {
- return inputStreamToString(in, false);
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
- *
- * @param content to encapsulate content
- * @return content as stream
- */
- public static InputStream encapsulate(final String content) {
- try {
- return encapsulate(content, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // we know that UTF-8 is supported
- throw new RuntimeException("UTF-8 MUST be supported.", e);
- }
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with given charset.
- *
- * @param content to encapsulate content
- * @param charset to be used charset
- * @return content as stream
- * @throws UnsupportedEncodingException if charset is not supported
- */
- public static InputStream encapsulate(final String content, final String charset)
- throws UnsupportedEncodingException {
- return new ByteArrayInputStream(content.getBytes(charset));
- }
-
- /**
- * Generate a string with given length containing random upper case characters ([A-Z]).
- *
- * @param len length of to generated string
- * @return random upper case characters ([A-Z]).
- */
- public static InputStream generateDataStream(final int len) {
- return encapsulate(generateData(len));
- }
-
- /**
- * Generate a string with given length containing random upper case characters ([A-Z]).
- *
- * @param len length of to generated string
- * @return random upper case characters ([A-Z]).
- */
- public static String generateData(final int len) {
- StringBuilder b = new StringBuilder(len);
- for (int j = 0; j < len; j++) {
- char c = (char) (Math.random() * 26 + 65);
- b.append(c);
- }
- return b.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
deleted file mode 100644
index 96e5172..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfo.java
+++ /dev/null
@@ -1,41 +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;
-
-public interface UriInfo extends
- UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
- UriInfoEntityId, UriInfoMetadata, UriInfoResource {
-
- public UriInfoService asUriInfoService();
-
- public UriInfoAll asUriInfoAll();
-
- public UriInfoBatch asUriInfoBatch();
-
- public UriInfoCrossjoin asUriInfoCrossjoin();
-
- public UriInfoEntityId asUriInfoEntityId();
-
- public UriInfoMetadata asUriInfoMetadata();
-
- public UriInfoResource asUriInfoResource();
-
- public UriInfoKind getKind();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.java
deleted file mode 100644
index b2e236a..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoAll.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.api.uri;
-
-public interface UriInfoAll {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.java
deleted file mode 100644
index 13b6673..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoBatch.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.api.uri;
-
-public interface UriInfoBatch {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoCrossjoin.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoCrossjoin.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoCrossjoin.java
deleted file mode 100644
index fa7d86b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoCrossjoin.java
+++ /dev/null
@@ -1,28 +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.List;
-
-public interface UriInfoCrossjoin {
-
- List<String> getEntitySetNames();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.java
deleted file mode 100644
index 7a8a317..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoEntityId.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.api.uri;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-
-/**
- * Indicates a URL access to an single Entity
- */
-public interface UriInfoEntityId {
-
- public List<CustomQueryOption> getCustomQueryOptions();
-
- public EdmEntityType getEntityTypeCast();
-
- public ExpandOption getExpandOption();
-
- public FormatOption getFormatOption();
-
- public IdOption getIdOption();
-
- public SelectOption getSelectOption();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.java
deleted file mode 100644
index ee82688..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoKind.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.api.uri;
-
-public enum UriInfoKind {
- all, batch, crossjoin, entityId, metadata, resource, service;
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
deleted file mode 100644
index 99157b6..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoMetadata.java
+++ /dev/null
@@ -1,30 +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.producer.api.uri.queryoption.FormatOption;
-
-public interface UriInfoMetadata {
-
- public FormatOption getFormatOption();
-
- public String getFragment() ;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
deleted file mode 100644
index 8abd90c..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoResource.java
+++ /dev/null
@@ -1,64 +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.List;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-
-public interface UriInfoResource {
-
- List<CustomQueryOption> getCustomQueryOptions();
-
- ExpandOption getExpandOption();
-
- FilterOption getFilterOption();
-
- FormatOption getFormatOption();
-
- IdOption getIdOption();
-
- InlineCountOption getInlineCountOption();
-
- OrderByOption getOrderByOption();
-
- SearchOption getSearchOption();
-
- SelectOption getSelectOption();
-
- SkipOption getSkipOption();
-
- SkipTokenOption getSkipTokenOption();
-
- TopOption getTopOption();
-
- List<UriResource> getUriResourceParts();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoService.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoService.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoService.java
deleted file mode 100644
index 7286904..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriInfoService.java
+++ /dev/null
@@ -1,23 +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;
-
-public interface UriInfoService {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
deleted file mode 100644
index 12a212b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriParameter.java
+++ /dev/null
@@ -1,35 +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.producer.api.uri.queryoption.expression.Expression;
-
-public interface UriParameter {
-
- public String getAlias();
-
- public String getText();
-
- public Expression getExression();
-
- public String getName();
-
- public String getRefencedProperty();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResource.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResource.java
deleted file mode 100644
index 8870c56..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResource.java
+++ /dev/null
@@ -1,28 +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;
-
-public interface UriResource {
-
- UriResourceKind getKind();
-
- @Override
- String toString();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
deleted file mode 100644
index f469e03..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceAction.java
+++ /dev/null
@@ -1,35 +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.EdmAction;
-import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
-
-public interface UriResourceAction extends UriResourcePartTyped {
-
- EdmAction getAction();
-
- /**
- * Convenience method which returns the {@link EdmActionImport} which was used in
- * the resource path to define the {@link EdmAction}.
- * @return
- */
- EdmActionImport getActionImport();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
deleted file mode 100644
index ffca624..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceComplexProperty.java
+++ /dev/null
@@ -1,29 +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.EdmComplexType;
-
-public interface UriResourceComplexProperty extends UriResourceProperty {
-
- EdmComplexType getComplexType();
-
- EdmComplexType getComplexTypeFilter();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
deleted file mode 100644
index f3142dc..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceCount.java
+++ /dev/null
@@ -1,23 +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;
-
-public interface UriResourceCount extends UriResource {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
deleted file mode 100644
index 1b24170..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceEntitySet.java
+++ /dev/null
@@ -1,39 +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.List;
-
-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.EdmType;
-
-public interface UriResourceEntitySet extends UriResourcePartTyped {
-
- EdmEntitySet getEntitySet();
-
- EdmEntityType getEntityType();
-
- List<UriParameter> getKeyPredicates();
-
- EdmType getTypeFilterOnCollection();
-
- EdmType getTypeFilterOnEntry();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
deleted file mode 100644
index 8e4c6de..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceFunction.java
+++ /dev/null
@@ -1,46 +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.List;
-
-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.EdmType;
-
-public interface UriResourceFunction extends UriResourcePartTyped {
-
- EdmFunction getFunction();
-
- /**
- * Convenience method which returns the {@link EdmFunctionImport} which was used in
- * the resource path to define the {@link EdmFunction}.
- * @return
- */
- EdmFunctionImport getFunctionImport();
-
- List<UriParameter> getKeyPredicates();
-
- List<UriParameter> getParameters();
-
- EdmType getTypeFilterOnCollection();
-
- EdmType getTypeFilterOnEntry();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
deleted file mode 100644
index feaeda2..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceIt.java
+++ /dev/null
@@ -1,34 +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.EdmType;
-
-/**
- * Class indicating the $it reference. $it may be used within filter to
- * refer to the last EDM object reference in the resource path. Since $it is
- * optional in some cases ( e.g. first member expressions) the {@link #isExplicitIt()}
- * method can be used to check if $it was explicitly noted in the URI
- */
-public interface UriResourceIt extends UriResourcePartTyped {
-
- EdmType getTypeFilterOnCollection();
-
- EdmType getTypeFilterOnEntry();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
deleted file mode 100644
index 7621133..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceKind.java
+++ /dev/null
@@ -1,25 +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;
-
-public enum UriResourceKind {
- action, complexProperty, count, entitySet, function, it, lambdaAll, lambdaAny,
- lambdaVariable, navigationProperty, ref, root, primitiveProperty, singleton, startingTypeFilter, value,
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAll.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAll.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAll.java
deleted file mode 100644
index 68a9b0b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAll.java
+++ /dev/null
@@ -1,30 +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.producer.api.uri.queryoption.expression.Expression;
-
-public interface UriResourceLambdaAll extends UriResourcePartTyped {
-
- public String getLamdaVariable();
-
- public Expression getExpression();
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAny.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAny.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAny.java
deleted file mode 100644
index 4912ff2..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaAny.java
+++ /dev/null
@@ -1,29 +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.producer.api.uri.queryoption.expression.Expression;
-
-public interface UriResourceLambdaAny extends UriResourcePartTyped {
-
- public String getLamdaVariable();
-
- public Expression getExpression();
-
-}
[11/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
deleted file mode 100644
index 06efbf9..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestFullResourcePath.java
+++ /dev/null
@@ -1,4979 +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.antlr;
-
-import java.util.Arrays;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-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.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriResourceValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriValidator;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.junit.Test;
-
-public class TestFullResourcePath {
- Edm edm = null;
- UriValidator testUri = null;
- UriResourceValidator testRes = null;
- FilterValidator testFilter = null;
-
- public TestFullResourcePath() {
- edm = new EdmProviderImpl(new EdmTechTestProvider());
- testUri = new UriValidator().setEdm(edm);
- testRes = new UriResourceValidator().setEdm(edm);
- testFilter = new FilterValidator().setEdm(edm);
- }
-
- @Test
- public void test() {}
-
- @Test
- public void testFunctionBound_varOverloading() {
- // on ESTwoKeyNav
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // with string parameter
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // with string parameter
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void runBfuncBnCpropCastRtEs() {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
- .isType(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
-
- }
-
- @Test
- public void runBfuncBnCpropCollRtEs() {
- testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim");
-
- testUri
- .run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim")
- .isType(EdmTechProvider.nameETAllPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runBfuncBnCpropRtEs() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNav");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
-
- }
-
- @Test
- public void runBfuncBnEntityRtEs() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnEntityCastRtEs() {
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
-
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'(''2'')'")
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnEsCastRtEs() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
- .isType(EdmTechProvider.nameETBaseTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav"
- + "/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
- }
-
- @Test
- public void runBfuncBnEsRtCprop() {
- testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isFunction("BFCESAllPrimRTCTAllPrim")
- .isType(EdmTechProvider.nameCTAllPrim);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim, false)
- .isTypeFilterOnEntry(EdmTechProvider.nameCTBase);
- }
-
- @Test
- public void runBfuncBnEsRtCpropColl() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim, true);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpNp() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .n()
- .isUriPathInfoKind(UriResourceKind.ref);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false)
- .n()
- .isValue();
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp)
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTAllPrim);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
- }
-
- @Test
- public void runBfuncBnEsRtEntyPpNpCast() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
- + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
-
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
- + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpCp() {
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTNavFiveProp);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComplex")
- .isType(EdmTechProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false)
- .n()
- .isValue();
-
- }
-
- @Test
- public void runBfuncBnEsRtEntyPpCpCast() {
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isComplex("PropertyComplexTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isTypeFilter(EdmTechProvider.nameCTTwoBase);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isComplex("PropertyComplexTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isTypeFilter(EdmTechProvider.nameCTTwoBase);
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpSp() {
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false)
- .n()
- .isValue();
-
- }
-
- @Test
- public void runBfuncBnEsRtEs() {
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'2'")
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'3'")
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .n()
- .isCount();
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runBfuncBnEsRtEsBa() {
-
- testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex"
- + "/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim")
- .n()
- .isAction("BAESAllPrimRTETAllPrim");
-
- }
-
- @Test
- public void runBfuncBnEsRtPrim() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString");
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString")
- .isType(EdmTechProvider.nameString)
- .n()
- .isValue();
- }
-
- @Test
- public void runbfuncBnEsRtPrimColl() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(EdmTechProvider.nameString, true);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(EdmTechProvider.nameString, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runBfuncBnPpropCollRtEs() {
- testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runBfuncBnPpropRtEs() {
-
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
-
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
- }
-
- @Test
- public void runBfuncBnSingleRtEs() {
-
- testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isFunction("BFCSINavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnSingleCastRtEs() {
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
- }
-
- @Test
- public void runActionBound_on_EntityEntry() {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
- }
-
- @Test
- public void runActionBound_on_EntityCollection() {
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isAction("BAESTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runFunctionBound_on_var_Types() {
-
- // on primitive
- testUri.run("ESAllPrim(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETAllPrim)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(EdmTechProvider.nameString);
-
- // on collection of primitive
- testUri.run("ESCollAllPrim(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETCollAllPrim)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(EdmTechProvider.nameString);
-
- // on complex
- testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .at(2)
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // on collection of complex
- testUri.run("ESKeyNav(1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1)
- .isType(EdmTechProvider.nameCTPrimComp)
- .isCollection(true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETAllPrim);
-
- // on entity
- testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')"
- + "/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // on collection of entity
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1).isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void runActionBound_on_EntityCast() {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/com.sap.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
- .n()
- .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
- }
-
- @Test
- public void runCrossjoin() {
- testUri.run("$crossjoin(ESKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
-
- testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
- }
-
- @Test
- public void runCrossjoinError() {
- testUri.runEx("$crossjoin").isExSyntax(0);
- testUri.runEx("$crossjoin/error").isExSyntax(0);
- testUri.runEx("$crossjoin()").isExSyntax(0);
- testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid").isExSyntax(0);
- }
-
- @Test
- public void runEntityId() {
- testUri.run("$entity?$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isIdText("ESKeyNav(1)");
- testUri.run("$entity/com.sap.odata.test1.ETKeyNav?$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EdmTechProvider.nameETKeyNav)
- .isIdText("ESKeyNav(1)");
- }
-
- @Test
- public void runEntityIdError() {
- testUri.runEx("$entity").isExSyntax(0);
- testUri.runEx("$entity?$idfalse=ESKeyNav(1)").isExSyntax(0);
- testUri.runEx("$entity/com.sap.odata.test1.invalidType?$id=ESKeyNav(1)").isExSemantic(0);
- testUri.runEx("$entity/invalid?$id=ESKeyNav(1)").isExSyntax(0);
- }
-
- @Test
- public void runEsName() {
- testUri.run("ESAllPrim")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EdmTechProvider.nameETAllPrim, true);
-
- testUri.run("ESAllPrim/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EdmTechProvider.nameETAllPrim, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runEsNameError() {
-
- testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(0);
- testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(0);
- testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(0);
- testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(0);
- testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(0);
- testUri.runEx("ESAllPrim(PropertyInt16='1')").isExSemantic(0);
- testUri.runEx("ESAllPrim(PropertyInt16)").isExSemantic(0);
- testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(0);
- testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim").isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETAllKey")
- .isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim('1')/com.sap.odata.test1.ETAllKey")
- .isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim")
- .isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
- .isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETAllKey")
- .isExSemantic(0);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim()")
- .isExSemantic(0);
-
- testUri.runEx("ESAllNullable(1)/CollPropertyString/$value")
- .isExSemantic(0);
-
- testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(0);
- }
-
- @Test
- public void runEsNameCast() {
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim, true)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
-
- testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
-
- }
-
- @Test
- public void runEsNamePpSpCast() {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
- }
-
- @Test
- public void runEsNameKey() {
- testUri.run("ESCollAllPrim(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
-
- testUri.run("ESCollAllPrim(PropertyInt16=1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
-
- testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESFourKeyAlias")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "KeyAlias1", "2")
- .isKeyPredicate(2, "KeyAlias2", "'3'")
- .isKeyPredicate(3, "KeyAlias3", "'4'");
-
- testUri.run("ESCollAllPrim(null)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
- }
-
- @Test
- public void runEsNameParaKeys() {
- testUri.run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
- + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
- + "PropertyInt64=-9223372036854775808,PropertyDecimal=0.1,PropertyDate=2013-09-25,"
- + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
- + "PropertyDuration=duration'P10DT5H34M21.123456789012S',"
- + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
- + "PropertyTimeOfDay=12:34:55.123456789012)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllKey")
- .isKeyPredicate(0, "PropertyString", "'O''Neil'")
- .isKeyPredicate(1, "PropertyBoolean", "true")
- .isKeyPredicate(2, "PropertyByte", "255")
- .isKeyPredicate(3, "PropertySByte", "-128")
- .isKeyPredicate(4, "PropertyInt16", "-32768")
- .isKeyPredicate(5, "PropertyInt32", "-2147483648")
- .isKeyPredicate(6, "PropertyInt64", "-9223372036854775808")
- .isKeyPredicate(7, "PropertyDecimal", "0.1")
- .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");
- }
-
- @Test
- public void runEsNameKeyCast() {
-
- testUri.runEx("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
- .isExSemantic(0);
-
- testUri.runEx("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
- .isExSemantic(0);
-
- testUri.runEx("xESBase/com.sap.odata.test1.ETTwoPrim(1)")
- .isExSemantic(0);
-
- testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBase);
-
- testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
-
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
- }
-
- @Test
- public void runEsNameParaKeysCast() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
- }
-
- @Test
- public void run_EsNamePpCp() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComplex");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isComplex("PropertyComplex");
- }
-
- @Test
- public void runEsNamePpCpColl() {
- testUri.run("ESMixPrimCollComp(5)/CollPropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "5")
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTTwoPrim, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runEsNamePpCpCast() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex");
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isComplex("PropertyComplex");
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
-
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplexTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isTypeFilter(EdmTechProvider.nameCTBase);
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplexTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isTypeFilter(EdmTechProvider.nameCTTwoBase);
- }
-
- @Test
- public void runNsNamePpNp() {
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isComplex("PropertyComplex");
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavMany(4)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "4");
-
- testUri.run("ESKeyNav(1)/PropertyComplex/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
- + "/PropertyComplex/PropertyComplex/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'(3)'")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETMediaMany", EdmTechProvider.nameETMedia, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isValue();
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .n()
- .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false)
- .n()
- .isValue();
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .n()
- .isRef();
- }
-
- @Test
- public void runEsNamePpNpCast() {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany(3)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "3");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "3")
- .isKeyPredicate(1, "PropertyString", "'4'")
- .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "4")
- .isKeyPredicate(1, "PropertyString", "'5'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EdmTechProvider.nameETBaseTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
- + "NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
- + "NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "4")
- .isKeyPredicate(1, "PropertyString", "'5'")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
- }
-
- @Test
- public void runEsNamePpNpRc() {
- // checks for using referential constrains to fill missing keys
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runEsNamePpSp() {
- testUri.run("ESAllPrim(1)/PropertyByte")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false);
-
- testUri.run("ESAllPrim(1)/PropertyByte/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false)
- .n()
- .isValue();
-
- testUri.run("ESMixPrimCollComp(1)/PropertyComplex/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
- }
-
- @Test
- public void runEsNamePpSpColl() {
- testUri.run("ESCollAllPrim(1)/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
- .n()
- .isCount();
-
- }
-
- @Test
- public void runEsNameRef() {
- testUri.run("ESAllPrim/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isRef();
-
- testUri.run("ESAllPrim(-32768)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .n()
- .isRef();
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isRef();
- }
-
- @Test
- public void runFunctionImpBf() {
-
- testUri.run("FICRTString()/com.sap.odata.test1.BFCStringRTESTwoKeyNav()");
- }
-
- @Test
- public void runFunctionImpCastBf() {
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
- }
-
- @Test
- public void runFunctionImpEntity() {
-
- testUri.run("FICRTETKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .isType(EdmTechProvider.nameETKeyNav);
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
-
- testUri.run("FICRTETMedia()/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETMedia")
- .isFunction("UFCRTETMedia")
- .n()
- .isValue();
-
- testUri.run("FICRTETKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .n()
- .isRef();
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .n()
- .isRef();
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
- }
-
- @Test
- public void runFunctionImpEs() {
- /**/
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EdmTechProvider.nameETMixPrimCollComp);
-
- testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FINRTESMixPrimCollCompTwoParam")
- .isFunction("UFNRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EdmTechProvider.nameETMixPrimCollComp);
-
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EdmTechProvider.nameETMixPrimCollComp)
- .n()
- .isCount();
- }
-
- @Test
- public void runFunctionImpError() {
- testUri.runEx("FICRTCollCTTwoPrimParam()").isExSemantic(0);
- testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)").isExSemantic(0);
- }
-
- @Test
- public void runFunctionImpEsAlias() {
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)?@parameterAlias=1");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count?@parameterAlias=1");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@invalidAlias)?@validAlias=1");
- }
-
- @Test
- public void runFunctionImpEsCast() {
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isCount();
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- }
-
- @Test
- public void runSingletonEntityValue() {
- testUri.run("SIMedia/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SIMedia")
- .n().isValue();
- }
-
- @Test
- public void runSingletonPpNpCast() {
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
-
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- }
-
- @Test
- public void runSingletonPpCpCast() {
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex");
-
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isComplex("PropertyComplex");
-
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComplexTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isTypeFilter(EdmTechProvider.nameCTBase);
-
- }
-
- @Test
- public void runSingletonPpSpCast() {
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
- .isType(EdmTechProvider.nameString, true);
-
- }
-
- @Test
- public void runSingletonEntityPpNp() {
- testUri.run("SINav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
-
- testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runSingletonEntityPpCp() {
- testUri.run("SINav/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("PropertyComplex");
-
- testUri.run("SINav/PropertyComplex/PropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("PropertyComplex")
- .n()
- .isComplex("PropertyComplex");
-
- }
-
- @Test
- public void runSingletonEntityPpCpColl() {
- testUri.run("SINav/CollPropertyComplex")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true);
-
- testUri.run("SINav/CollPropertyComplex/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("CollPropertyComplex")
- .isType(EdmTechProvider.nameCTPrimComp, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runSingletonEntityPpSp() {
- testUri.run("SINav/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
- }
-
- @Test
- public void runSingletonEntityPpSpColl() {
- testUri.run("SINav/CollPropertyString")
-
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
- testUri.run("SINav/CollPropertyString/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runExpand() {
-
- testUri.run("ESKeyNav(1)?$expand=*")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar(0);
-
- testUri.run("ESKeyNav(1)?$expand=*/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar(0)
- .isSegmentRef(1);
-
- testUri.run("ESKeyNav(1)?$expand=*/$ref,NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar(0).isSegmentRef(1)
- .next()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
-
- testUri.run("ESKeyNav(1)?$expand=*($levels=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar(0)
- .isLevelText("3");
-
- testUri.run("ESKeyNav(1)?$expand=*($levels=max)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar(0)
- .isLevelText("max");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef();
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .isType(EdmTechProvider.nameETKeyNav, false)
- .n().isRef();
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator().isFilterSerialized("<<PropertyInt16> eq <1>>");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($orderby=PropertyInt16)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator();// .isFilterSerialized(""); TODO check order BY
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isTopText("2");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($count=true)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isInlineCountText("true");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1;$top=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("3");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1%3b$top=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("3");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isCount();
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .isType(EdmTechProvider.nameETKeyNav, false)
- .n().isCount();
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .n().isCount()
- .goUpExpandValidator()
- .isFilterSerialized("<<PropertyInt16> gt <1>>");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($filter=PropertyInt16 eq 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isFilterSerialized("<<PropertyInt16> eq <1>>");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($orderby=PropertyInt16)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .goUpExpandValidator();// TODO check orderby
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSkipText("1");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(EdmTechProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isTopText("2");
-
- testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($count=true)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
- .isType(Ed
<TRUNCATED>
[28/28] git commit: [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
[OLINGO-161] Refactored Java package names
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/9593b53c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/9593b53c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/9593b53c
Branch: refs/heads/master
Commit: 9593b53cc80646cb7649a15602a937edbbf3a643
Parents: c49ff80
Author: Christian Amend <ch...@apache.org>
Authored: Mon Feb 17 16:44:32 2014 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Mon Feb 17 16:44:32 2014 +0100
----------------------------------------------------------------------
.../olingo/odata4/client/api/ODataConsumer.java | 50 +
.../api/deserializer/AnnotationProperty.java | 23 +
.../client/api/deserializer/ComplexValue.java | 35 +
.../api/deserializer/ConsumerException.java | 36 +
.../odata4/client/api/deserializer/Entity.java | 59 +
.../client/api/deserializer/EntitySet.java | 34 +
.../api/deserializer/NavigationProperty.java | 27 +
.../client/api/deserializer/Property.java | 23 +
.../odata4/client/api/deserializer/Reader.java | 30 +
.../api/deserializer/StructuralProperty.java | 30 +
.../odata4/client/api/deserializer/Value.java | 27 +
.../odata4/consumer/api/ODataConsumer.java | 50 -
.../api/deserializer/AnnotationProperty.java | 23 -
.../consumer/api/deserializer/ComplexValue.java | 35 -
.../api/deserializer/ConsumerException.java | 36 -
.../consumer/api/deserializer/Entity.java | 59 -
.../consumer/api/deserializer/EntitySet.java | 34 -
.../api/deserializer/NavigationProperty.java | 27 -
.../consumer/api/deserializer/Property.java | 23 -
.../consumer/api/deserializer/Reader.java | 30 -
.../api/deserializer/StructuralProperty.java | 30 -
.../odata4/consumer/api/deserializer/Value.java | 27 -
.../odata4/client/core/ODataConsumerImpl.java | 33 +
.../deserializer/AnnotationPropertyImpl.java | 52 +
.../core/deserializer/ComplexValueImpl.java | 80 +
.../client/core/deserializer/EntityImpl.java | 124 +
.../core/deserializer/EntitySetBuilder.java | 68 +
.../client/core/deserializer/EntitySetImpl.java | 113 +
.../client/core/deserializer/JsonReader.java | 89 +
.../deserializer/NavigationPropertyImpl.java | 87 +
.../core/deserializer/PrimitiveValue.java | 51 +
.../core/deserializer/PropertyCollection.java | 91 +
.../deserializer/PropertyCollectionBuilder.java | 211 +
.../deserializer/StructuralPropertyImpl.java | 81 +
.../odata4/consumer/core/ODataConsumerImpl.java | 33 -
.../deserializer/AnnotationPropertyImpl.java | 52 -
.../core/deserializer/ComplexValueImpl.java | 80 -
.../consumer/core/deserializer/EntityImpl.java | 124 -
.../core/deserializer/EntitySetBuilder.java | 68 -
.../core/deserializer/EntitySetImpl.java | 113 -
.../consumer/core/deserializer/JsonReader.java | 89 -
.../deserializer/NavigationPropertyImpl.java | 87 -
.../core/deserializer/PrimitiveValue.java | 51 -
.../core/deserializer/PropertyCollection.java | 91 -
.../deserializer/PropertyCollectionBuilder.java | 211 -
.../deserializer/StructuralPropertyImpl.java | 81 -
.../odata4/client/core/ODataConsumerTest.java | 41 +
.../deserializer/JsonReaderPerformance.java | 73 +
.../core/deserializer/JsonReaderTest.java | 374 ++
.../client/core/testutil/StringHelper.java | 110 +
.../odata4/consumer/core/ODataConsumerTest.java | 41 -
.../deserializer/JsonReaderPerformance.java | 72 -
.../core/deserializer/JsonReaderTest.java | 373 --
.../consumer/core/testutil/StringHelper.java | 110 -
.../olingo/odata4/producer/api/uri/UriInfo.java | 41 -
.../odata4/producer/api/uri/UriInfoAll.java | 24 -
.../odata4/producer/api/uri/UriInfoBatch.java | 24 -
.../producer/api/uri/UriInfoCrossjoin.java | 28 -
.../producer/api/uri/UriInfoEntityId.java | 48 -
.../odata4/producer/api/uri/UriInfoKind.java | 24 -
.../producer/api/uri/UriInfoMetadata.java | 30 -
.../producer/api/uri/UriInfoResource.java | 64 -
.../odata4/producer/api/uri/UriInfoService.java | 23 -
.../odata4/producer/api/uri/UriParameter.java | 35 -
.../odata4/producer/api/uri/UriResource.java | 28 -
.../producer/api/uri/UriResourceAction.java | 35 -
.../api/uri/UriResourceComplexProperty.java | 29 -
.../producer/api/uri/UriResourceCount.java | 23 -
.../producer/api/uri/UriResourceEntitySet.java | 39 -
.../producer/api/uri/UriResourceFunction.java | 46 -
.../odata4/producer/api/uri/UriResourceIt.java | 34 -
.../producer/api/uri/UriResourceKind.java | 25 -
.../producer/api/uri/UriResourceLambdaAll.java | 30 -
.../producer/api/uri/UriResourceLambdaAny.java | 29 -
.../producer/api/uri/UriResourceLambdaRef.java | 26 -
.../producer/api/uri/UriResourceNavigation.java | 36 -
.../producer/api/uri/UriResourcePartTyped.java | 32 -
.../api/uri/UriResourcePrimitiveProperty.java | 23 -
.../producer/api/uri/UriResourceProperty.java | 27 -
.../odata4/producer/api/uri/UriResourceRef.java | 23 -
.../producer/api/uri/UriResourceRoot.java | 27 -
.../producer/api/uri/UriResourceSingleton.java | 32 -
.../api/uri/UriResourceStartingTypeFilter.java | 29 -
.../producer/api/uri/UriResourceValue.java | 23 -
.../producer/api/uri/optiontree/OptionNode.java | 76 -
.../api/uri/optiontree/OptionProperty.java | 27 -
.../api/uri/queryoption/AliasQueryOption.java | 27 -
.../api/uri/queryoption/CustomQueryOption.java | 23 -
.../uri/queryoption/ExceptionVisitExpand.java | 25 -
.../api/uri/queryoption/ExpandItem.java | 49 -
.../api/uri/queryoption/ExpandOption.java | 27 -
.../api/uri/queryoption/FilterOption.java | 26 -
.../api/uri/queryoption/FormatOption.java | 25 -
.../producer/api/uri/queryoption/IdOption.java | 25 -
.../api/uri/queryoption/InlineCountOption.java | 25 -
.../api/uri/queryoption/LevelsExpandOption.java | 27 -
.../api/uri/queryoption/OrderByItem.java | 34 -
.../api/uri/queryoption/OrderByOption.java | 27 -
.../api/uri/queryoption/QueryOption.java | 27 -
.../api/uri/queryoption/SearchOption.java | 27 -
.../api/uri/queryoption/SelectItem.java | 34 -
.../api/uri/queryoption/SelectOption.java | 27 -
.../api/uri/queryoption/SkipOption.java | 25 -
.../api/uri/queryoption/SkipTokenOption.java | 26 -
.../uri/queryoption/SupportedQueryOptions.java | 45 -
.../api/uri/queryoption/SystemQueryOption.java | 25 -
.../producer/api/uri/queryoption/TopOption.java | 25 -
.../queryoption/expression/AliasExpression.java | 25 -
.../expression/BinaryExpression.java | 29 -
.../uri/queryoption/expression/Constant.java | 35 -
.../uri/queryoption/expression/Enumeration.java | 30 -
.../expression/ExceptionVisitExpression.java | 25 -
.../uri/queryoption/expression/Expression.java | 23 -
.../expression/ExpressionVisitor.java | 56 -
.../uri/queryoption/expression/LambdaRef.java | 25 -
.../api/uri/queryoption/expression/Literal.java | 25 -
.../api/uri/queryoption/expression/Member.java | 32 -
.../uri/queryoption/expression/MethodCall.java | 29 -
.../expression/SupportedBinaryOperators.java | 56 -
.../expression/SupportedConstants.java | 47 -
.../expression/SupportedMethodCalls.java | 56 -
.../expression/SupportedUnaryOperators.java | 44 -
.../uri/queryoption/expression/TypeLiteral.java | 27 -
.../queryoption/expression/UnaryOperator.java | 27 -
.../expression/VisitableExression.java | 47 -
.../uri/queryoption/search/SearchBinary.java | 29 -
.../queryoption/search/SearchExpression.java | 23 -
.../api/uri/queryoption/search/SearchTerm.java | 25 -
.../api/uri/queryoption/search/SearchUnary.java | 25 -
.../search/SupportedSearchBinaryOperators.java | 46 -
.../search/SupportedSearchUnaryOperators.java | 43 -
.../olingo/odata4/server/api/uri/UriInfo.java | 41 +
.../odata4/server/api/uri/UriInfoAll.java | 24 +
.../odata4/server/api/uri/UriInfoBatch.java | 24 +
.../odata4/server/api/uri/UriInfoCrossjoin.java | 28 +
.../odata4/server/api/uri/UriInfoEntityId.java | 48 +
.../odata4/server/api/uri/UriInfoKind.java | 24 +
.../odata4/server/api/uri/UriInfoMetadata.java | 30 +
.../odata4/server/api/uri/UriInfoResource.java | 64 +
.../odata4/server/api/uri/UriInfoService.java | 23 +
.../odata4/server/api/uri/UriParameter.java | 35 +
.../odata4/server/api/uri/UriResource.java | 28 +
.../server/api/uri/UriResourceAction.java | 35 +
.../api/uri/UriResourceComplexProperty.java | 29 +
.../odata4/server/api/uri/UriResourceCount.java | 23 +
.../server/api/uri/UriResourceEntitySet.java | 39 +
.../server/api/uri/UriResourceFunction.java | 46 +
.../odata4/server/api/uri/UriResourceIt.java | 34 +
.../odata4/server/api/uri/UriResourceKind.java | 25 +
.../server/api/uri/UriResourceLambdaAll.java | 30 +
.../server/api/uri/UriResourceLambdaAny.java | 29 +
.../server/api/uri/UriResourceLambdaRef.java | 26 +
.../server/api/uri/UriResourceNavigation.java | 36 +
.../server/api/uri/UriResourcePartTyped.java | 32 +
.../api/uri/UriResourcePrimitiveProperty.java | 23 +
.../server/api/uri/UriResourceProperty.java | 27 +
.../odata4/server/api/uri/UriResourceRef.java | 23 +
.../odata4/server/api/uri/UriResourceRoot.java | 27 +
.../server/api/uri/UriResourceSingleton.java | 32 +
.../api/uri/UriResourceStartingTypeFilter.java | 29 +
.../odata4/server/api/uri/UriResourceValue.java | 23 +
.../server/api/uri/optiontree/OptionNode.java | 76 +
.../api/uri/optiontree/OptionProperty.java | 27 +
.../api/uri/queryoption/AliasQueryOption.java | 27 +
.../api/uri/queryoption/CustomQueryOption.java | 23 +
.../uri/queryoption/ExceptionVisitExpand.java | 25 +
.../server/api/uri/queryoption/ExpandItem.java | 49 +
.../api/uri/queryoption/ExpandOption.java | 27 +
.../api/uri/queryoption/FilterOption.java | 26 +
.../api/uri/queryoption/FormatOption.java | 25 +
.../server/api/uri/queryoption/IdOption.java | 25 +
.../api/uri/queryoption/InlineCountOption.java | 25 +
.../api/uri/queryoption/LevelsExpandOption.java | 27 +
.../server/api/uri/queryoption/OrderByItem.java | 34 +
.../api/uri/queryoption/OrderByOption.java | 27 +
.../server/api/uri/queryoption/QueryOption.java | 27 +
.../api/uri/queryoption/SearchOption.java | 27 +
.../server/api/uri/queryoption/SelectItem.java | 34 +
.../api/uri/queryoption/SelectOption.java | 27 +
.../server/api/uri/queryoption/SkipOption.java | 25 +
.../api/uri/queryoption/SkipTokenOption.java | 26 +
.../uri/queryoption/SupportedQueryOptions.java | 45 +
.../api/uri/queryoption/SystemQueryOption.java | 25 +
.../server/api/uri/queryoption/TopOption.java | 25 +
.../queryoption/expression/AliasExpression.java | 25 +
.../expression/BinaryExpression.java | 29 +
.../uri/queryoption/expression/Constant.java | 35 +
.../uri/queryoption/expression/Enumeration.java | 30 +
.../expression/ExceptionVisitExpression.java | 25 +
.../uri/queryoption/expression/Expression.java | 23 +
.../expression/ExpressionVisitor.java | 56 +
.../uri/queryoption/expression/LambdaRef.java | 25 +
.../api/uri/queryoption/expression/Literal.java | 25 +
.../api/uri/queryoption/expression/Member.java | 32 +
.../uri/queryoption/expression/MethodCall.java | 29 +
.../expression/SupportedBinaryOperators.java | 56 +
.../expression/SupportedConstants.java | 47 +
.../expression/SupportedMethodCalls.java | 56 +
.../expression/SupportedUnaryOperators.java | 44 +
.../uri/queryoption/expression/TypeLiteral.java | 27 +
.../queryoption/expression/UnaryOperator.java | 27 +
.../expression/VisitableExression.java | 47 +
.../uri/queryoption/search/SearchBinary.java | 29 +
.../queryoption/search/SearchExpression.java | 23 +
.../api/uri/queryoption/search/SearchTerm.java | 25 +
.../api/uri/queryoption/search/SearchUnary.java | 25 +
.../search/SupportedSearchBinaryOperators.java | 46 +
.../search/SupportedSearchUnaryOperators.java | 43 +
odata4-lib/odata4-server-core/pom.xml | 2 +-
.../odata4/producer/core/uri/antlr/UriLexer.g4 | 405 --
.../odata4/producer/core/uri/antlr/UriParser.g4 | 518 --
.../odata4/server/core/uri/antlr/UriLexer.g4 | 405 ++
.../odata4/server/core/uri/antlr/UriParser.g4 | 518 ++
.../olingo/odata4/producer/core/uri/Parser.java | 134 -
.../odata4/producer/core/uri/UriInfoImpl.java | 288 -
.../producer/core/uri/UriParameterImpl.java | 83 -
.../producer/core/uri/UriParseTreeVisitor.java | 2181 --------
.../producer/core/uri/UriParserException.java | 36 -
.../core/uri/UriParserSemanticException.java | 37 -
.../core/uri/UriParserSyntaxException.java | 36 -
.../core/uri/UriResourceActionImpl.java | 77 -
.../uri/UriResourceComplexPropertyImpl.java | 70 -
.../producer/core/uri/UriResourceCountImpl.java | 35 -
.../core/uri/UriResourceEntitySetImpl.java | 67 -
.../core/uri/UriResourceFunctionImpl.java | 111 -
.../producer/core/uri/UriResourceImpl.java | 39 -
.../producer/core/uri/UriResourceItImpl.java | 65 -
.../core/uri/UriResourceLambdaAllImpl.java | 73 -
.../core/uri/UriResourceLambdaAnyImpl.java | 72 -
.../core/uri/UriResourceLambdaVarImpl.java | 70 -
.../uri/UriResourceNavigationPropertyImpl.java | 63 -
.../uri/UriResourcePrimitivePropertyImpl.java | 59 -
.../producer/core/uri/UriResourceRefImpl.java | 36 -
.../producer/core/uri/UriResourceRootImpl.java | 62 -
.../core/uri/UriResourceSingletonImpl.java | 71 -
.../uri/UriResourceStartingTypeFilterImpl.java | 68 -
.../producer/core/uri/UriResourceTypedImpl.java | 60 -
.../producer/core/uri/UriResourceValueImpl.java | 36 -
.../core/uri/UriResourceWithKeysImpl.java | 98 -
.../uri/queryoption/AliasQueryOptionImpl.java | 38 -
.../uri/queryoption/CustomQueryOptionImpl.java | 25 -
.../core/uri/queryoption/ExpandItemImpl.java | 163 -
.../core/uri/queryoption/ExpandOptionImpl.java | 49 -
.../core/uri/queryoption/FilterOptionImpl.java | 43 -
.../core/uri/queryoption/FormatOptionImpl.java | 41 -
.../core/uri/queryoption/IdOptionImpl.java | 40 -
.../uri/queryoption/InlineCountOptionImpl.java | 42 -
.../core/uri/queryoption/LevelsOptionImpl.java | 54 -
.../core/uri/queryoption/OrderByItemImpl.java | 50 -
.../core/uri/queryoption/OrderByOptionImpl.java | 50 -
.../core/uri/queryoption/QueryOptionImpl.java | 47 -
.../core/uri/queryoption/SearchOptionImpl.java | 41 -
.../core/uri/queryoption/SelectItemImpl.java | 72 -
.../core/uri/queryoption/SelectOptionImpl.java | 50 -
.../core/uri/queryoption/SkipOptionImpl.java | 42 -
.../uri/queryoption/SkipTokenOptionImpl.java | 42 -
.../uri/queryoption/SystemQueryOptionImpl.java | 42 -
.../core/uri/queryoption/TopOptionImpl.java | 45 -
.../uri/queryoption/expression/AliasImpl.java | 44 -
.../uri/queryoption/expression/BinaryImpl.java | 70 -
.../queryoption/expression/ConstantImpl.java | 73 -
.../queryoption/expression/EnumerationImpl.java | 60 -
.../queryoption/expression/ExpressionImpl.java | 25 -
.../queryoption/expression/LambdaRefImpl.java | 46 -
.../uri/queryoption/expression/LiteralImpl.java | 46 -
.../uri/queryoption/expression/MemberImpl.java | 88 -
.../queryoption/expression/MethodCallImpl.java | 70 -
.../queryoption/expression/TypeLiteralImpl.java | 47 -
.../uri/queryoption/expression/UnaryImpl.java | 58 -
.../olingo/odata4/server/core/uri/Parser.java | 134 +
.../odata4/server/core/uri/UriInfoImpl.java | 288 +
.../server/core/uri/UriParameterImpl.java | 83 +
.../server/core/uri/UriParseTreeVisitor.java | 2181 ++++++++
.../server/core/uri/UriParserException.java | 36 +
.../core/uri/UriParserSemanticException.java | 37 +
.../core/uri/UriParserSyntaxException.java | 36 +
.../server/core/uri/UriResourceActionImpl.java | 77 +
.../uri/UriResourceComplexPropertyImpl.java | 70 +
.../server/core/uri/UriResourceCountImpl.java | 35 +
.../core/uri/UriResourceEntitySetImpl.java | 67 +
.../core/uri/UriResourceFunctionImpl.java | 111 +
.../odata4/server/core/uri/UriResourceImpl.java | 39 +
.../server/core/uri/UriResourceItImpl.java | 65 +
.../core/uri/UriResourceLambdaAllImpl.java | 73 +
.../core/uri/UriResourceLambdaAnyImpl.java | 72 +
.../core/uri/UriResourceLambdaVarImpl.java | 70 +
.../uri/UriResourceNavigationPropertyImpl.java | 63 +
.../uri/UriResourcePrimitivePropertyImpl.java | 59 +
.../server/core/uri/UriResourceRefImpl.java | 36 +
.../server/core/uri/UriResourceRootImpl.java | 62 +
.../core/uri/UriResourceSingletonImpl.java | 71 +
.../uri/UriResourceStartingTypeFilterImpl.java | 68 +
.../server/core/uri/UriResourceTypedImpl.java | 60 +
.../server/core/uri/UriResourceValueImpl.java | 36 +
.../core/uri/UriResourceWithKeysImpl.java | 98 +
.../uri/queryoption/AliasQueryOptionImpl.java | 38 +
.../uri/queryoption/CustomQueryOptionImpl.java | 25 +
.../core/uri/queryoption/ExpandItemImpl.java | 163 +
.../core/uri/queryoption/ExpandOptionImpl.java | 49 +
.../core/uri/queryoption/FilterOptionImpl.java | 43 +
.../core/uri/queryoption/FormatOptionImpl.java | 41 +
.../core/uri/queryoption/IdOptionImpl.java | 40 +
.../uri/queryoption/InlineCountOptionImpl.java | 42 +
.../core/uri/queryoption/LevelsOptionImpl.java | 54 +
.../core/uri/queryoption/OrderByItemImpl.java | 50 +
.../core/uri/queryoption/OrderByOptionImpl.java | 50 +
.../core/uri/queryoption/QueryOptionImpl.java | 47 +
.../core/uri/queryoption/SearchOptionImpl.java | 41 +
.../core/uri/queryoption/SelectItemImpl.java | 72 +
.../core/uri/queryoption/SelectOptionImpl.java | 50 +
.../core/uri/queryoption/SkipOptionImpl.java | 42 +
.../uri/queryoption/SkipTokenOptionImpl.java | 42 +
.../uri/queryoption/SystemQueryOptionImpl.java | 42 +
.../core/uri/queryoption/TopOptionImpl.java | 45 +
.../uri/queryoption/expression/AliasImpl.java | 44 +
.../uri/queryoption/expression/BinaryImpl.java | 70 +
.../queryoption/expression/ConstantImpl.java | 73 +
.../queryoption/expression/EnumerationImpl.java | 60 +
.../queryoption/expression/ExpressionImpl.java | 25 +
.../queryoption/expression/LambdaRefImpl.java | 46 +
.../uri/queryoption/expression/LiteralImpl.java | 46 +
.../uri/queryoption/expression/MemberImpl.java | 88 +
.../queryoption/expression/MethodCallImpl.java | 70 +
.../queryoption/expression/TypeLiteralImpl.java | 47 +
.../uri/queryoption/expression/UnaryImpl.java | 58 +
.../producer/core/testutil/EdmTechProvider.java | 1975 -------
.../core/testutil/EdmTechTestProvider.java | 95 -
.../producer/core/testutil/ExpandValidator.java | 208 -
.../core/testutil/FilterTreeToText.java | 161 -
.../producer/core/testutil/FilterValidator.java | 491 --
.../producer/core/testutil/ParseTreeToText.java | 82 -
.../producer/core/testutil/ParserTest.java | 53 -
.../producer/core/testutil/ParserValidator.java | 249 -
.../producer/core/testutil/TestErrorLogger.java | 174 -
.../producer/core/testutil/TokenValidator.java | 194 -
.../core/testutil/UriLexerWithTrace.java | 85 -
.../core/testutil/UriResourceValidator.java | 562 --
.../producer/core/testutil/UriValidator.java | 247 -
.../producer/core/testutil/Validator.java | 23 -
.../producer/core/uri/UriInfoImplTest.java | 201 -
.../producer/core/uri/UriParameterImplTest.java | 508 --
.../core/uri/antlr/TestFullResourcePath.java | 4979 ------------------
.../producer/core/uri/antlr/TestLexer.java | 414 --
.../producer/core/uri/antlr/TestParser.java | 1360 -----
.../core/uri/antlr/TestUriParserImpl.java | 1141 ----
.../core/uri/queryoption/QueryOptionTest.java | 307 --
.../queryoption/expression/ExpressionTest.java | 282 -
.../server/core/testutil/EdmTechProvider.java | 1975 +++++++
.../core/testutil/EdmTechTestProvider.java | 95 +
.../server/core/testutil/ExpandValidator.java | 208 +
.../server/core/testutil/FilterTreeToText.java | 161 +
.../server/core/testutil/FilterValidator.java | 491 ++
.../server/core/testutil/ParseTreeToText.java | 82 +
.../odata4/server/core/testutil/ParserTest.java | 53 +
.../server/core/testutil/ParserValidator.java | 249 +
.../server/core/testutil/TestErrorLogger.java | 174 +
.../server/core/testutil/TokenValidator.java | 194 +
.../server/core/testutil/UriLexerWithTrace.java | 85 +
.../core/testutil/UriResourceValidator.java | 562 ++
.../server/core/testutil/UriValidator.java | 247 +
.../odata4/server/core/testutil/Validator.java | 23 +
.../odata4/server/core/uri/UriInfoImplTest.java | 204 +
.../server/core/uri/UriParameterImplTest.java | 527 ++
.../core/uri/antlr/TestFullResourcePath.java | 4979 ++++++++++++++++++
.../odata4/server/core/uri/antlr/TestLexer.java | 415 ++
.../server/core/uri/antlr/TestParser.java | 1360 +++++
.../core/uri/antlr/TestUriParserImpl.java | 1141 ++++
.../core/uri/queryoption/QueryOptionTest.java | 325 ++
.../queryoption/expression/ExpressionTest.java | 293 ++
369 files changed, 24919 insertions(+), 24865 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.java
new file mode 100644
index 0000000..07e6aa1
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/ODataConsumer.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.client.api;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+
+//TODO: Exceptionhandling
+public abstract class ODataConsumer {
+
+ private static final String IMPLEMENTATION = "org.apache.olingo.odata4.client.core.ODataConsumerImpl";
+
+ public static ODataConsumer create() {
+ ODataConsumer instance;
+
+ try {
+ final Class<?> clazz = Class.forName(ODataConsumer.IMPLEMENTATION);
+
+ /*
+ * We explicitly do not use the singleton pattern to keep the server state free
+ * and avoid class loading issues also during hot deployment.
+ */
+ final Object object = clazz.newInstance();
+ instance = (ODataConsumer) object;
+
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ return instance;
+ }
+
+ public abstract Edm createEdm(EdmProvider provider);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
new file mode 100644
index 0000000..b9e2492
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/AnnotationProperty.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+public interface AnnotationProperty extends Property {
+ String getValue();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ComplexValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ComplexValue.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ComplexValue.java
new file mode 100644
index 0000000..1f054a6
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ComplexValue.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ComplexValue extends Value {
+
+ Value getValue(String name);
+
+ List<Property> getProperties();
+
+ Map<String, NavigationProperty> getNavigationProperties();
+
+ Map<String, AnnotationProperty> getAnnotationProperties();
+
+ Map<String, StructuralProperty> getStructuralProperties();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
new file mode 100644
index 0000000..98c53ed
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/ConsumerException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+public class ConsumerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public ConsumerException() {
+ super();
+ }
+
+ public ConsumerException(final String message) {
+ super(message);
+ }
+
+ public ConsumerException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Entity.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Entity.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Entity.java
new file mode 100644
index 0000000..932ac06
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Entity.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+import java.util.List;
+import java.util.Map;
+
+public interface Entity {
+
+ String getODataContext();
+
+ String getODataMetaDataEtag();
+
+ String getODataType();
+
+ Long getODataCount();
+
+ String getODataNextLink();
+
+ String getODataDeltaLink();
+
+ String getODataId();
+
+ String getODataETag();
+
+ String getODataEditLink();
+
+ String getODataReadLink();
+
+ List<Property> getProperties();
+
+ Map<String, NavigationProperty> getNavigationProperties();
+
+ Map<String, AnnotationProperty> getAnnotationProperties();
+
+ Map<String, StructuralProperty> getStructuralProperties();
+
+ Property getProperty(String name);
+
+ <T extends Property> T getProperty(String name, Class<T> clazz);
+
+ Object getPropertyContent(String name);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/EntitySet.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/EntitySet.java
new file mode 100644
index 0000000..352e395
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/EntitySet.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+import java.util.List;
+
+public interface EntitySet extends Iterable<Entity> {
+
+ String getODataContext();
+
+ Long getODataCount();
+
+ String getODataNextLink();
+
+ String getODataDeltaLink();
+
+ List<Entity> getEntities();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/NavigationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/NavigationProperty.java
new file mode 100644
index 0000000..0f7fec7
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/NavigationProperty.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.client.api.deserializer;
+
+public interface NavigationProperty extends Property {
+
+ public abstract String getAssociationLink();
+
+ public abstract String getNavigationLink();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
new file mode 100644
index 0000000..8a7eec1
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Property.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+public interface Property {
+ String getName();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
new file mode 100644
index 0000000..41d2e4d
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Reader.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+import java.io.InputStream;
+
+public interface Reader {
+
+ public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
+
+ public abstract Entity readEntity(InputStream in) throws ConsumerException;
+
+ public abstract Property readProperty(InputStream in) throws ConsumerException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/StructuralProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/StructuralProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/StructuralProperty.java
new file mode 100644
index 0000000..9ad86d0
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/StructuralProperty.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.client.api.deserializer;
+
+import java.util.List;
+
+public interface StructuralProperty extends Property {
+
+ boolean containsCollection();
+
+ Value getValue();
+
+ List<Value> getValues();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.java
new file mode 100644
index 0000000..f4d3f03
--- /dev/null
+++ b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/client/api/deserializer/Value.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.client.api.deserializer;
+
+public interface Value {
+ boolean isComplex();
+
+ Object getContent();
+
+ <T> T getContentAs(T type);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
deleted file mode 100644
index abf6d30..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
+++ /dev/null
@@ -1,50 +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.consumer.api;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-
-//TODO: Exceptionhandling
-public abstract class ODataConsumer {
-
- private static final String IMPLEMENTATION = "org.apache.olingo.odata4.consumer.core.ODataConsumerImpl";
-
- public static ODataConsumer create() {
- ODataConsumer instance;
-
- try {
- final Class<?> clazz = Class.forName(ODataConsumer.IMPLEMENTATION);
-
- /*
- * We explicitly do not use the singleton pattern to keep the server state free
- * and avoid class loading issues also during hot deployment.
- */
- final Object object = clazz.newInstance();
- instance = (ODataConsumer) object;
-
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- return instance;
- }
-
- public abstract Edm createEdm(EdmProvider provider);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
deleted file mode 100644
index 439066f..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
+++ /dev/null
@@ -1,23 +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.consumer.api.deserializer;
-
-public interface AnnotationProperty extends Property {
- String getValue();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
deleted file mode 100644
index ab4455f..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
+++ /dev/null
@@ -1,35 +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.consumer.api.deserializer;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ComplexValue extends Value {
-
- Value getValue(String name);
-
- List<Property> getProperties();
-
- Map<String, NavigationProperty> getNavigationProperties();
-
- Map<String, AnnotationProperty> getAnnotationProperties();
-
- Map<String, StructuralProperty> getStructuralProperties();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
deleted file mode 100644
index def4636..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
+++ /dev/null
@@ -1,36 +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.consumer.api.deserializer;
-
-public class ConsumerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public ConsumerException() {
- super();
- }
-
- public ConsumerException(final String message) {
- super(message);
- }
-
- public ConsumerException(final String message, final Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
deleted file mode 100644
index 2d4c9b3..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
+++ /dev/null
@@ -1,59 +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.consumer.api.deserializer;
-
-import java.util.List;
-import java.util.Map;
-
-public interface Entity {
-
- String getODataContext();
-
- String getODataMetaDataEtag();
-
- String getODataType();
-
- Long getODataCount();
-
- String getODataNextLink();
-
- String getODataDeltaLink();
-
- String getODataId();
-
- String getODataETag();
-
- String getODataEditLink();
-
- String getODataReadLink();
-
- List<Property> getProperties();
-
- Map<String, NavigationProperty> getNavigationProperties();
-
- Map<String, AnnotationProperty> getAnnotationProperties();
-
- Map<String, StructuralProperty> getStructuralProperties();
-
- Property getProperty(String name);
-
- <T extends Property> T getProperty(String name, Class<T> clazz);
-
- Object getPropertyContent(String name);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
deleted file mode 100644
index 1efda67..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
+++ /dev/null
@@ -1,34 +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.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface EntitySet extends Iterable<Entity> {
-
- String getODataContext();
-
- Long getODataCount();
-
- String getODataNextLink();
-
- String getODataDeltaLink();
-
- List<Entity> getEntities();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
deleted file mode 100644
index 67067ea..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
+++ /dev/null
@@ -1,27 +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.consumer.api.deserializer;
-
-public interface NavigationProperty extends Property {
-
- public abstract String getAssociationLink();
-
- public abstract String getNavigationLink();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
deleted file mode 100644
index 7092f72..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
+++ /dev/null
@@ -1,23 +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.consumer.api.deserializer;
-
-public interface Property {
- String getName();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
deleted file mode 100644
index cf7b012..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
+++ /dev/null
@@ -1,30 +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.consumer.api.deserializer;
-
-import java.io.InputStream;
-
-public interface Reader {
-
- public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
-
- public abstract Entity readEntity(InputStream in) throws ConsumerException;
-
- public abstract Property readProperty(InputStream in) throws ConsumerException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
deleted file mode 100644
index 3cdc254..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
+++ /dev/null
@@ -1,30 +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.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface StructuralProperty extends Property {
-
- boolean containsCollection();
-
- Value getValue();
-
- List<Value> getValues();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java b/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
deleted file mode 100644
index 7966c50..0000000
--- a/odata4-lib/odata4-client-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
+++ /dev/null
@@ -1,27 +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.consumer.api.deserializer;
-
-public interface Value {
- boolean isComplex();
-
- Object getContent();
-
- <T> T getContentAs(T type);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.java
new file mode 100644
index 0000000..460bb22
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/ODataConsumerImpl.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.client.core;
+
+import org.apache.olingo.odata4.client.api.ODataConsumer;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.commons.core.ODataCommonsCoreImpl;
+
+public class ODataConsumerImpl extends ODataConsumer {
+
+ @Override
+ public Edm createEdm(final EdmProvider provider) {
+ return new ODataCommonsCoreImpl().createEdm(provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
new file mode 100644
index 0000000..25428ec
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/AnnotationPropertyImpl.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
+
+public class AnnotationPropertyImpl implements AnnotationProperty {
+
+ private final String name;
+ private final String value;
+
+ public AnnotationPropertyImpl(final String name, final String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
new file mode 100644
index 0000000..12eb1f8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/ComplexValueImpl.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+
+public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
+
+ public ComplexValueImpl() {}
+
+ public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+ super(annotationProperties, navigationProperties, structuralProperties);
+ }
+
+ @Override
+ public Value getValue(final String name) {
+ StructuralProperty property = structuralProperties.get(name);
+ if (property == null) {
+ return null;
+ }
+ return property.getValue();
+ }
+
+ @Override
+ public Map<String, AnnotationProperty> getAnnotationProperties() {
+ return Collections.unmodifiableMap(annotationProperties);
+ }
+
+ @Override
+ public Map<String, NavigationProperty> getNavigationProperties() {
+ return Collections.unmodifiableMap(navigationProperties);
+ }
+
+ @Override
+ public boolean isComplex() {
+ return true;
+ }
+
+ @Override
+ public Map<String, StructuralProperty> getContent() {
+ return Collections.unmodifiableMap(structuralProperties);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getContentAs(final T type) {
+ return (T) getContent();
+ }
+
+ @Override
+ public String toString() {
+ return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
+ + ", properties=" + structuralProperties + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
new file mode 100644
index 0000000..f5f06ba
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntityImpl.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.util.Map;
+
+import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Entity;
+import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+
+public class EntityImpl extends PropertyCollection implements Entity {
+
+ public EntityImpl() {}
+
+ public EntityImpl(final Map<String, AnnotationProperty> annotationProperties,
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+ super(annotationProperties, navigationProperties, structuralProperties);
+ }
+
+ @Override
+ public String getODataMetaDataEtag() {
+ return getAnnotationValue("odata.metadataEtag");
+ }
+
+ @Override
+ public String getODataType() {
+ return getAnnotationValue("odata.type");
+ }
+
+ @Override
+ public Long getODataCount() {
+ return Long.valueOf(getAnnotationValue("odata.count"));
+ }
+
+ @Override
+ public String getODataNextLink() {
+ return getAnnotationValue("odata.nextLink");
+ }
+
+ @Override
+ public String getODataDeltaLink() {
+ return getAnnotationValue("odata.deltaLink");
+ }
+
+ @Override
+ public String getODataReadLink() {
+ return getAnnotationValue("odata.readLink");
+ }
+
+ @Override
+ public String getODataContext() {
+ return getAnnotationValue("odata.context");
+ }
+
+ @Override
+ public String getODataId() {
+ return getAnnotationValue("odata.id");
+ }
+
+ @Override
+ public String getODataETag() {
+ return getAnnotationValue("odata.etag");
+ }
+
+ @Override
+ public String getODataEditLink() {
+ return getAnnotationValue("odata.editLink");
+ }
+
+ @Override
+ public Object getPropertyContent(final String name) {
+ StructuralProperty property = structuralProperties.get(name);
+ if (property != null) {
+ return property.getValue().getContent();
+ }
+ return null;
+ }
+
+ @Override
+ public Property getProperty(final String name) {
+ Property p = structuralProperties.get(name);
+ if (p == null) {
+ p = annotationProperties.get(name);
+ }
+ if (p == null) {
+ p = navigationProperties.get(name);
+ }
+ return p;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends Property> T getProperty(final String name, final Class<T> clazz) {
+ Property p = getProperty(name);
+ return (T) p;
+ }
+
+ private String getAnnotationValue(final String key) {
+ AnnotationProperty prop = annotationProperties.get(key);
+ if (prop == null) {
+ return null;
+ }
+ return prop.getValue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
new file mode 100644
index 0000000..3f45176
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetBuilder.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+
+import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+public class EntitySetBuilder {
+
+ private final JsonParser parser;
+
+ public EntitySetBuilder(final JsonParser jp) {
+ parser = jp;
+ }
+
+ public EntitySet buildEntitySet() throws JsonParseException, IOException {
+ return parseEntitySet(parser);
+ }
+
+ private EntitySet parseEntitySet(final JsonParser jp) throws JsonParseException, IOException {
+ EntitySetImpl entitySet = new EntitySetImpl();
+ boolean arrayStarted = false;
+
+ while (jp.nextToken() != null) {
+ JsonToken token = jp.getCurrentToken();
+ switch (token) {
+ case START_ARRAY:
+ PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
+ entitySet.setPropertyCollectionBuilder(builder);
+ arrayStarted = true;
+ break;
+ case START_OBJECT:
+ if (arrayStarted) {
+ return entitySet;
+ }
+ break;
+ case VALUE_NUMBER_INT:
+ case VALUE_STRING:
+ entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+ default:
+ break;
+ }
+ }
+
+ return entitySet;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
new file mode 100644
index 0000000..0a0ab6a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/EntitySetImpl.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.odata4.client.api.deserializer.Entity;
+import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
+
+import com.fasterxml.jackson.core.JsonParseException;
+
+public class EntitySetImpl implements EntitySet, Iterator<Entity> {
+
+ private String odataContext;
+ private Long odataCount;
+ private String odataNextLink;
+ private String odataDeltaLink;
+ private List<Entity> entities = null;
+
+ private PropertyCollectionBuilder propertyCollectionsBuilder;
+
+ @Override
+ public String getODataContext() {
+ return odataContext;
+ }
+
+ @Override
+ public Long getODataCount() {
+ return odataCount;
+ }
+
+ @Override
+ public String getODataNextLink() {
+ return odataNextLink;
+ }
+
+ @Override
+ public String getODataDeltaLink() {
+ return odataDeltaLink;
+ }
+
+ public void addAnnotation(final String name, final String value) {
+ if ("odata.context".equalsIgnoreCase(name)) {
+ odataContext = value;
+ } else if ("odata.deltaLink".equalsIgnoreCase(name)) {
+ odataDeltaLink = value;
+ } else if ("odata.count".equalsIgnoreCase(name)) {
+ odataCount = Long.parseLong(value);
+ } else if ("odata.nextLink".equalsIgnoreCase(name)) {
+ odataNextLink = value;
+ }
+ }
+
+ @Override
+ public List<Entity> getEntities() {
+ if (entities == null) {
+ entities = new ArrayList<Entity>();
+
+ while (propertyCollectionsBuilder.parseNext()) {
+ entities.add(propertyCollectionsBuilder.buildEntity());
+ }
+ }
+
+ return entities;
+ }
+
+ public void setPropertyCollectionBuilder(final PropertyCollectionBuilder builder) {
+ propertyCollectionsBuilder = builder;
+ }
+
+ @Override
+ public boolean hasNext() {
+ try {
+ return propertyCollectionsBuilder.hasNext();
+ } catch (JsonParseException e) {} catch (IOException e) {}
+ return false;
+ }
+
+ @Override
+ public Entity next() {
+ if (propertyCollectionsBuilder.parseNext()) {
+ return propertyCollectionsBuilder.buildEntity();
+ }
+ return null;
+ }
+
+ @Override
+ public void remove() {}
+
+ @Override
+ public Iterator<Entity> iterator() {
+ return this;
+ }
+}
[02/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
new file mode 100644
index 0000000..36095d5
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java
@@ -0,0 +1,1360 @@
+/*******************************************************************************
+ * 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.server.core.uri.antlr;
+
+import org.apache.olingo.odata4.server.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.aAM().aFC().aCS().log(1).run("ODI?$filter=PropertyEnumString has com.sap.odata.test1.ENString'String1'");
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 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($id = ODI))) <EOF>)");
+
+ test.run("$entity?$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+ + "entityOptions(id($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(commonExpr(primitiveLiteral(1))) )))))) <EOF>)");
+
+ test.run("ODI('ABC')")
+ .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(string('ABC')))) )))))) <EOF>)");
+
+ test.run("ODI(K1=1)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "commonExpr(primitiveLiteral(1)))) )))))) <EOF>)");
+
+ test.run("ODI(K1='ABC')")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "commonExpr(primitiveLiteral(string('ABC'))))) )))))) <EOF>)");
+
+ test.run("ODI(K1='ABC',K2=123)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
+ + "commonExpr(primitiveLiteral(123)))) )))))) <EOF>)");
+
+ test.run("ODI(K1=1)(P1=1)")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+ + "pathSegment(odataIdentifier(ODI) "
+ + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+ + "commonExpr(primitiveLiteral(1)))) )) nameValueOptList(( "
+ + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(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) = "
+ + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
+ + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
+ + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) ,"
+ + " nameValuePair(odataIdentifier(P2) = commonExpr(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) = "
+ + "commonExpr(primitiveLiteral(string('ABC')))) , nameValuePair(odataIdentifier(K2) = "
+ + "commonExpr(primitiveLiteral(123)))) )) nameValueOptList(( "
+ + "nameValueList(nameValuePair(odataIdentifier(P1) = commonExpr(primitiveLiteral(string('ABC')))) , "
+ + "nameValuePair(odataIdentifier(P2) = commonExpr(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) = "
+ + "commonExpr(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 = expandItem(*)))))) <EOF>)");
+
+ test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = "
+ + "expandItem(*) , "
+ + "expandItem(*) , "
+ + "expandItem(*)))))) <EOF>)");
+
+ test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = "
+ + "expandItem(* / ref($ref))))))) <EOF>)");
+
+ test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment("
+ + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+ + "expand($expand = 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 = "
+ + "expandItem(* ( $levels = 12 ))))))) <EOF>)");
+ test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+ + "queryOption(systemQueryOption(expand($expand = 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 = "
+ + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(expand($expand = "
+ + "expandItem(expandPath("
+ + "expandPathSegment(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 = "
+ + "expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI)) / "
+ + "expandPathSegment(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 = "
+ + "expandItem(expandPath(expandPathSegment(odataIdentifier(ODI)) / "
+ + "expandPathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "expandPathSegment(odataIdentifier(ODI))))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(expand($expand = "
+ + "expandItem(expandPath("
+ + "expandPathSegment(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 = expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
+ + "expandRefOption(skip($skip = 1)) )))))))) <EOF>)");
+
+ test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(expand($expand = "
+ + "expandItem(expandPath("
+ + "expandPathSegment(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 = expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
+ + "expandCountOption(filter($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 = expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ count($count) ( "
+ + "expandCountOption($search = \"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 = expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(/ ref($ref) ( "
+ + "expandRefOption(skip($skip = 1)) ; expandRefOption(expandCountOption(filter($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 = expandItem(expandPath("
+ + "expandPathSegment(odataIdentifier(ODI))) expandPathExtension(( expandOption("
+ + "expandRefOption(skip($skip = 1))) ; expandOption(expandRefOption(expandCountOption(filter($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(selectSegment(*))))))) <EOF>)");
+
+ test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(selectSegment(odataIdentifier(ODI)))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(selectSegment(namespace(odataIdentifier(NS) .) *))))))) <EOF>)");
+
+ test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+ + "systemQueryOption(select("
+ + "$select = selectItem(selectSegment(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("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(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("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(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(selectSegment(odataIdentifier(ODI))) , "
+ + "selectItem(selectSegment(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(selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
+ + "selectItem(selectSegment(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("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(odataIdentifier(ODIm))) , "
+ + "selectItem("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(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("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) , "
+ + "selectItem("
+ + "selectSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+ + "selectSegment(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(enumLit(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(enumLit(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(enumLit(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("
+ + "geoDistanceMethodCallExpr("
+ + "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( 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))))) , 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( 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))))) , 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=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(singletonEntity)) <EOF>)");
+
+ test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(NS . ODI)) <EOF>)");
+
+ test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF(odataRelativeUri("
+ + "$metadata # contextFragment(Edm . Boolean)) <EOF>)");
+
+ test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(ODI / $deletedEntity)) <EOF>)");
+
+ test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(ODI / $link)) <EOF>)");
+
+ test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
+ + "odataRelativeUri($metadata # contextFragment(ODI / $deletedLink)) <EOF>)");
+
+ test.run("$metadata#ODI(1)/ODI")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) / odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI")
+ .isText(
+ "odataRelativeUriEOF(odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) "
+ + "nameValueOptList(( valueOnly(commonExpr(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(commonExpr(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(commonExpr("
+ + "primitiveLiteral(1))) )))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
+ + "/ odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(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(commonExpr(primitiveLiteral(1))) )) "
+ + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
+
+ test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
+ + "propertyList(( propertyListItem(*) )))) <EOF>)");
+
+ test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
+ + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(primitiveLiteral(1))) )) "
+ + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
+ test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri($metadata "
+ + "# contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(commonExpr(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(commonExpr(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(commonExpr(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(commonExpr(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(commonExpr("
+ + "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>)");
+ }
+
+
+}
[21/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
new file mode 100644
index 0000000..82d2d60
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4
@@ -0,0 +1,518 @@
+/*******************************************************************************
+ * 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 vEO=entityOptions # altEntity
+ | ENTITY SLASH vNS=namespace vODI=odataIdentifier QM vEO=entityOptionsCast # altEntityCast
+ | METADATA ( QM vF=format )? ( FRAGMENT vCF=contextFragment )? # altMetadata
+ | vRP=resourcePath ( QM vQO=queryOptions )? # altResourcePath
+ ;
+
+//;------------------------------------------------------------------------------
+//; 1. Resource Path
+//;------------------------------------------------------------------------------
+
+resourcePath : vAll=ALL
+ | vCJ=crossjoin
+ | vlPS=pathSegments
+ ;
+crossjoin : CROSSJOIN OPEN WSP? vlODI+=odataIdentifier WSP? ( COMMA WSP? vlODI+=odataIdentifier WSP?)* CLOSE;
+
+pathSegments : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* vCS=constSegment?;
+
+pathSegment : vNS=namespace? vODI=odataIdentifier vlNVO+=nameValueOptList*;
+
+nameValueOptList : OPEN (vVO=valueOnly | vNVL=nameValueList)? CLOSE;
+valueOnly : vV=commonExpr ;
+nameValueList : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair WSP*)* ;
+nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
+
+constSegment : SLASH (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
+
+count : COUNT;
+ref : REF;
+value : VALUE;
+//;------------------------------------------------------------------------------
+//; 2. Query Options
+//;------------------------------------------------------------------------------
+
+queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;
+
+queryOption : systemQueryOption
+ | AT_Q aliasAndValue
+ | customQueryOption
+ ;
+
+entityOptions : (vlEOb+=entityOption AMP )* vlEOm=id ( AMP vlEOa+=entityOption )*;
+entityOption : format
+ | customQueryOption
+ ;
+
+entityOptionsCast : (vlEOb+=entityOptionCast AMP )* vlEOm=id ( AMP vlEOa+=entityOptionCast )*;
+entityOptionCast : expand
+ | format
+ | select
+ | filter
+ | customQueryOption
+ ;
+
+systemQueryOption : expand
+ | filter
+ | format
+ | id
+ | inlinecount
+ | orderBy
+ | search
+ | select
+ | skip
+ | skiptoken
+ | top
+ ;
+
+id : ID EQ REST;
+skiptoken : SKIPTOKEN EQ REST;
+expand : EXPAND EQ vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
+
+expandItem : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX) CLOSE )?
+ | vEP=expandPath vEPE=expandPathExtension?;
+
+
+expandPath : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
+//expandPath : expandPathSegment ( SLASH expandPathSegment )*;
+//expandPathSegment : vNS=namespace? vODI=odataIdentifier;
+
+expandPathExtension : OPEN vlEO+=expandOption ( SEMI vlEO+=expandOption )* CLOSE
+ | SLASH vR=ref ( OPEN vlEOR+=expandRefOption ( SEMI vlEOR+=expandRefOption )* CLOSE )?
+ | SLASH vC=count ( OPEN vlEOC+=expandCountOption ( SEMI vlEOC+=expandCountOption )* CLOSE )?
+ ;
+expandCountOption : filter
+ | search
+ ;
+expandRefOption : expandCountOption
+ | orderBy
+ | skip
+ | top
+ | inlinecount
+ ;
+expandOption : expandRefOption
+ | select
+ | expand
+ | levels;
+
+levels : LEVELS EQ ( INT | MAX );
+
+filter : FILTER EQ commonExpr;
+
+orderBy : ORDERBY EQ WSP* vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
+orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
+
+//this is completly done in lexer grammer to avoid ambiguities with odataIdentifier and STRING
+skip : SKIP 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 vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
+selectItem : vlSS+=selectSegment ( SLASH vlSS+=selectSegment ) *;
+selectSegment : vNS=namespace? ( vODI=odataIdentifier | vS=STAR );
+
+aliasAndValue : vODI=ODATAIDENTIFIER EQ vV=parameterValue;
+parameterValue : //TODO json not supported arrayOrObject
+ commonExpr
+ ;
+
+
+
+customQueryOption : customName ( EQ customValue)?
+ ;
+customName : CUSTOMNAME;
+customValue : REST;
+
+
+
+//;------------------------------------------------------------------------------
+//; 3. Context URL Fragments
+//;------------------------------------------------------------------------------
+//TODO add ps+=pathSegment (SLASH ps+=pathSegment)*
+contextFragment : REST;
+
+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
+ | vE1=commonExpr (WSP HAS WSP) vE2=commonExpr #altHas
+ | methodCallExpr #altMethod
+ | ( unary WSP ) commonExpr #altUnary
+ | anyExpr #altAny
+ | allExpr #altAll
+ | memberExpr #altMember
+ | vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr #altMult
+ | vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr #altAdd
+ | vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP
+ | WSP vO=LE WSP ) vE2=commonExpr #altComparism
+ | vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr #altEquality
+ | vE1=commonExpr (WSP AND WSP) vE2=commonExpr #altAnd
+ | vE1=commonExpr (WSP OR WSP) vE2=commonExpr #altOr
+ | rootExpr #altRoot //; $...
+ | AT odataIdentifier #altAlias // @...
+ | primitiveLiteral #altLiteral // ...
+ ;
+
+unary : (MINUS| NOT) ;
+
+rootExpr : ROOT vPs=pathSegments;
+
+memberExpr : vIt=IT ( SLASH (vANY=anyExpr | vALL=allExpr))?
+ | vIts=ITSLASH? vPs=pathSegments ( SLASH (vANY=anyExpr | vALL=allExpr))?;
+
+anyExpr : ANY_LAMDA OPEN WSP? ( vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? )? CLOSE;
+allExpr : ALL_LAMDA OPEN WSP? vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? CLOSE;
+
+methodCallExpr : indexOfMethodCallExpr
+ | toLowerMethodCallExpr
+ | toUpperMethodCallExpr
+ | trimMethodCallExpr
+ | substringMethodCallExpr
+ | concatMethodCallExpr
+ | lengthMethodCallExpr
+ | yearMethodCallExpr
+ | monthMethodCallExpr
+ | dayMethodCallExpr
+ | hourMethodCallExpr
+ | minuteMethodCallExpr
+ | secondMethodCallExpr
+ | fractionalsecondsMethodCallExpr
+ | totalsecondsMethodCallExpr
+ | dateMethodCallExpr
+ | timeMethodCallExpr
+ | roundMethodCallExpr
+ | floorMethodCallExpr
+ | ceilingMethodCallExpr
+ | geoDistanceMethodCallExpr
+ | geoLengthMethodCallExpr
+ | totalOffsetMinutesMethodCallExpr
+ | minDateTimeMethodCallExpr
+ | maxDateTimeMethodCallExpr
+ | nowMethodCallExpr
+ //from boolean
+ | isofExpr
+ | castExpr
+ | endsWithMethodCallExpr
+ | startsWithMethodCallExpr
+ | containsMethodCallExpr
+ | geoIntersectsMethodCallExpr
+ ;
+
+
+containsMethodCallExpr : CONTAINS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+startsWithMethodCallExpr : STARTSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+endsWithMethodCallExpr : ENDSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+lengthMethodCallExpr : LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
+indexOfMethodCallExpr : INDEXOF_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+substringMethodCallExpr : SUBSTRING_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? ( COMMA WSP? vE3=commonExpr WSP? )? CLOSE;
+toLowerMethodCallExpr : TOLOWER_WORD WSP? vE1=commonExpr WSP? CLOSE;
+toUpperMethodCallExpr : TOUPPER_WORD WSP? vE1=commonExpr WSP? CLOSE;
+trimMethodCallExpr : TRIM_WORD WSP? vE1=commonExpr WSP? CLOSE;
+concatMethodCallExpr : CONCAT_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+
+yearMethodCallExpr : YEAR_WORD WSP? vE1=commonExpr WSP? CLOSE;
+monthMethodCallExpr : MONTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
+dayMethodCallExpr : DAY_WORD WSP? vE1=commonExpr WSP? CLOSE;
+hourMethodCallExpr : HOUR_WORD WSP? vE1=commonExpr WSP? CLOSE;
+minuteMethodCallExpr : MINUTE_WORD WSP? vE1=commonExpr WSP? CLOSE;
+secondMethodCallExpr : SECOND_WORD WSP? vE1=commonExpr WSP? CLOSE;
+fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
+totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
+dateMethodCallExpr : DATE_WORD WSP? vE1=commonExpr WSP? CLOSE;
+timeMethodCallExpr : TIME_WORD WSP? vE1=commonExpr WSP? CLOSE;
+totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? vE1=commonExpr WSP? CLOSE;
+
+minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
+maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
+nowMethodCallExpr : NOW_WORD WSP? CLOSE;
+
+roundMethodCallExpr : ROUND_WORD WSP? vE1=commonExpr WSP? CLOSE;
+floorMethodCallExpr : FLOOR_WORD WSP? vE1=commonExpr WSP? CLOSE;
+ceilingMethodCallExpr : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
+
+geoDistanceMethodCallExpr : GEO_DISTANCE_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
+geoIntersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
+
+isofExpr : ISOF_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
+castExpr : CAST_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier 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
+ WSP? COLON WSP?
+ 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
+ | enumLit
+ | geographyCollection
+ | geographyLineString
+ | geographyMultilineString
+ | geographyMultipoint
+ | geographyMultipolygon
+ | geographyPoint
+ | geographyPolygon
+ | geometryCollection
+ | geometryLineString
+ | geometryMultilineString
+ | geometryMultipoint
+ | geometryMultipolygon
+ | geometryPoint
+ | geometryPolygon
+ ;
+
+
+nullrule : NULLVALUE;// (SQUOTE qualifiedtypename SQUOTE)?;
+booleanNonCase : BOOLEAN | TRUE | FALSE;
+string : STRING;
+
+enumLit : vNS=namespace vODI=odataIdentifier vValues=STRING;
+//enum : namespace odataIdentifier STRING;
+enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
+//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/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
deleted file mode 100644
index 367f027..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/Parser.java
+++ /dev/null
@@ -1,134 +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.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.BailErrorStrategy;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.atn.PredictionMode;
-import org.antlr.v4.runtime.misc.ParseCancellationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-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 Parser {
- public UriInfo parseUri(final String input, final UriParseTreeVisitor uriParseTreeVisitor)
- throws UriParserException {
-
- try {
- OdataRelativeUriEOFContext parseTree = parseInput(input, true);
-
- // reset visitor
- uriParseTreeVisitor.init();
- parseTree.accept(uriParseTreeVisitor);
- UriInfoImpl uriInput = uriParseTreeVisitor.getUriInfo();
-
- return uriInput;
-
- } catch (ParseCancellationException e) {
- Throwable cause = e.getCause();
- if (cause instanceof UriParserException) {
- throw (UriParserException) cause;
- }
- }
- throw new UriParserSyntaxException("unknown syntax error");
- }
-
- private OdataRelativeUriEOFContext parseInput(final String input, boolean onResource)
- throws UriParserSyntaxException {
- 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));
-
- // Set error strategy
- addStage1ErrorStategy(parser);
-
- // Set error collector
- addStage1ErrorListener(parser);
-
- // user the faster LL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-
- // parse
- ret = parser.odataRelativeUriEOF();
-
- } catch (ParseCancellationException hardException) {
- // stage = 2
- try {
-
- // create parser
- lexer = new UriLexer(new ANTLRInputStream(input));
- parser = new UriParserParser(new CommonTokenStream(lexer));
-
- // Set error strategy
- addStage2ErrorStategy(parser);
-
- // Set error collector
- addStage2ErrorListener(parser);
-
- // Use the slower SLL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-
- // parse
- ret = parser.odataRelativeUriEOF();
-
- } catch (Exception weakException) {
- throw new UriParserSyntaxException("Error in syntax", weakException);
-
- // exceptionOnStage = 2;
- }
- } catch (Exception hardException) {
- throw new UriParserSyntaxException("Error in syntax", hardException);
- }
-
- return ret;
- }
-
- protected void addStage1ErrorStategy(UriParserParser parser) {
- // Throw exception at first syntax error
- parser.setErrorHandler(new BailErrorStrategy());
-
- }
-
- protected void addStage2ErrorStategy(UriParserParser parser) {
- // Throw exception at first syntax error
- parser.setErrorHandler(new BailErrorStrategy());
- }
-
- protected void addStage1ErrorListener(UriParserParser parser) {
- // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
- parser.removeErrorListeners();
- }
-
- protected void addStage2ErrorListener(UriParserParser parser) {
- // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
- parser.removeErrorListeners();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
deleted file mode 100644
index e4797c4..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
+++ /dev/null
@@ -1,288 +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.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoAll;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoBatch;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoCrossjoin;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoEntityId;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoMetadata;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoService;
-import org.apache.olingo.odata4.producer.api.uri.UriResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SearchOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipTokenOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SystemQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.TopOptionImpl;
-
-public class UriInfoImpl implements UriInfo {
-
- private UriInfoKind kind;
-
- private List<String> entitySetNames = new ArrayList<String>(); // for $entity
- private EdmEntityType entityTypeCast; // for $entity
-
- // Query options
- private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
- private ExpandOptionImpl expandOption;
- private FilterOptionImpl filterOption;
- private FormatOptionImpl formatOption;
- private IdOption idOption;
- private InlineCountOptionImpl inlineCountOption;
- private OrderByOptionImpl orderByOption;
- private SearchOptionImpl searchOption;
- private SelectOptionImpl selectOption;
- private SkipOptionImpl skipOption;
- private SkipTokenOptionImpl skipTokenOption;
- private TopOptionImpl topOption;
-
- private String fragment;
-
- private UriResource lastResourcePart;
- private List<UriResource> pathParts = new ArrayList<UriResource>();
-
- @Override
- public UriInfoAll asUriInfoAll() {
- return this;
- }
-
- @Override
- public UriInfoBatch asUriInfoBatch() {
- return this;
- }
-
- @Override
- public UriInfoCrossjoin asUriInfoCrossjoin() {
- return this;
- }
-
- @Override
- public UriInfoEntityId asUriInfoEntityId() {
- return this;
- }
-
- @Override
- public UriInfoMetadata asUriInfoMetadata() {
- return this;
- }
-
- @Override
- public UriInfoResource asUriInfoResource() {
- return this;
- }
-
- @Override
- public List<String> getEntitySetNames() {
- return Collections.unmodifiableList(entitySetNames);
- }
-
- public void addEntitySetName(final String entitySet) {
- entitySetNames.add(entitySet);
- }
-
- @Override
- public List<UriResource> getUriResourceParts() {
- List<UriResource> returnList = new ArrayList<UriResource>();
- for (UriResource item : pathParts) {
- returnList.add(item);
- }
- return Collections.unmodifiableList(returnList);
- }
-
- public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
- pathParts.add(uriPathInfo);
- lastResourcePart = uriPathInfo;
- return this;
- }
-
- @Override
- public List<CustomQueryOption> getCustomQueryOptions() {
- List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
- for (CustomQueryOptionImpl item : customQueryOptions) {
- retList.add(item);
- }
- return retList;
- }
-
- @Override
- public EdmEntityType getEntityTypeCast() {
- return entityTypeCast;
- }
-
- public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
- entityTypeCast = type;
- return this;
- }
-
- @Override
- public ExpandOption getExpandOption() {
- return expandOption;
- }
-
- @Override
- public FilterOption getFilterOption() {
- return filterOption;
- }
-
- @Override
- public FormatOption getFormatOption() {
- return formatOption;
- }
-
- @Override
- public IdOption getIdOption() {
- return idOption;
- }
-
- @Override
- public InlineCountOption getInlineCountOption() {
- return inlineCountOption;
- }
-
- @Override
- public UriInfoKind getKind() {
- return kind;
- }
-
- public UriInfoImpl setKind(final UriInfoKind kind) {
- this.kind = kind;
- return this;
- }
-
- public UriResource getLastResourcePart() {
- return lastResourcePart;
- }
-
- @Override
- public OrderByOption getOrderByOption() {
- return orderByOption;
- }
-
- @Override
- public SearchOption getSearchOption() {
-
- return searchOption;
- }
-
- @Override
- public SelectOption getSelectOption() {
- return selectOption;
- }
-
- @Override
- public SkipOption getSkipOption() {
- return skipOption;
- }
-
- @Override
- public SkipTokenOption getSkipTokenOption() {
- return skipTokenOption;
- }
-
- @Override
- public TopOption getTopOption() {
- return topOption;
- }
-
-
- public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
-
- for (QueryOptionImpl item : list) {
- if (item instanceof SystemQueryOptionImpl) {
- setSystemQueryOption((SystemQueryOptionImpl)item);
- } else if (item instanceof CustomQueryOptionImpl) {
- customQueryOptions.add((CustomQueryOptionImpl) item);
- }
- }
- return this;
- }
-
- public UriInfoImpl setSystemQueryOption(SystemQueryOptionImpl systemOption) {
-
- if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
- expandOption = (ExpandOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
- filterOption = (FilterOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.FORMAT) {
- formatOption = (FormatOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.ID) {
- idOption = (IdOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
- inlineCountOption = (InlineCountOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
- orderByOption = (OrderByOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.SEARCH) {
- searchOption = (SearchOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.SELECT) {
- selectOption = (SelectOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.SKIP) {
- skipOption = (SkipOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.SKIPTOKEN) {
- skipTokenOption = (SkipTokenOptionImpl) systemOption;
- } else if (systemOption.getKind() == SupportedQueryOptions.TOP) {
- topOption = (TopOptionImpl) systemOption;
- }
- return this;
- }
-
- @Override
- public UriInfoService asUriInfoService() {
- return this;
- }
-
-
- public String getFragment() {
- return fragment;
- }
-
- public UriInfoImpl setFragment(String fragment) {
- this.fragment = fragment;
- return this;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
deleted file mode 100644
index 67034f4..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImpl.java
+++ /dev/null
@@ -1,83 +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.producer.api.uri.UriParameter;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriParameterImpl implements UriParameter {
- private String name;
- private String text;
- private String alias;
- private Expression expression;
- private String referencedProperty;
-
- @Override
- public String getName() {
- return name;
- }
-
- public UriParameterImpl setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public String getAlias() {
- return alias;
- }
-
- public UriParameterImpl setAlias(final String alias) {
- this.alias = alias;
- return this;
- }
-
- @Override
- public String getText() {
- return text;
- }
-
- public UriParameterImpl setText(final String text) {
- this.text = text;
- return this;
- }
-
- @Override
- public Expression getExression() {
- return expression;
- }
-
- public UriParameterImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public String getRefencedProperty() {
- return this.referencedProperty;
- }
-
- public UriParameterImpl setRefencedProperty(String referencedProperty) {
- this.referencedProperty = referencedProperty;
- return this;
- }
-
-}
[19/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
deleted file mode 100644
index 687bb42..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
+++ /dev/null
@@ -1,37 +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;
-
-//TODO Check name of this exception when implementing proper error handling
-public class UriParserSemanticException extends UriParserException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public UriParserSemanticException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public UriParserSemanticException(final String message) {
- super(message, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
deleted file mode 100644
index 5d5f59b..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
+++ /dev/null
@@ -1,36 +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 UriParserSyntaxException extends UriParserException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public UriParserSyntaxException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public UriParserSyntaxException(final String message) {
- super(message, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
deleted file mode 100644
index e3ffdca..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
+++ /dev/null
@@ -1,77 +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.EdmAction;
-import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceAction;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
-
- protected EdmAction action;
- protected EdmActionImport actionImport;
-
- public UriResourceActionImpl() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmAction getAction() {
- return action;
- }
-
- public UriResourceActionImpl setAction(final EdmAction action) {
- this.action = action;
- return this;
- }
-
- @Override
- public EdmActionImport getActionImport() {
- return actionImport;
- }
-
- public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
- this.actionImport = actionImport;
- setAction(actionImport.getAction());
- return this;
- }
-
- @Override
- public boolean isCollection() {
- return action.getReturnType().isCollection();
- }
-
- @Override
- public EdmType getType() {
- return action.getReturnType().getType();
- }
-
- @Override
- public String toString() {
- if (actionImport != null) {
- return actionImport.getName();
- } else if (action != null) {
- return action.getName();
- }
- return "";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
deleted file mode 100644
index 9ef90be..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
+++ /dev/null
@@ -1,70 +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.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceComplexProperty;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
-
- protected EdmProperty property;
-
- public UriResourceComplexPropertyImpl() {
- super(UriResourceKind.complexProperty);
- }
-
- @Override
- public EdmProperty getProperty() {
- return property;
- }
-
- public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
- this.property = property;
- return this;
- }
-
- @Override
- public EdmComplexType getComplexType() {
- return (EdmComplexType) getType();
- }
-
- @Override
- public EdmComplexType getComplexTypeFilter() {
- return (EdmComplexType) typeFilter;
- }
-
- @Override
- public EdmType getType() {
- return property.getType();
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public String toString() {
- return property.getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
deleted file mode 100644
index 9cd0d91..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
+++ /dev/null
@@ -1,35 +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.producer.api.uri.UriResourceCount;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
-
- public UriResourceCountImpl() {
- super(UriResourceKind.count);
- }
-
- @Override
- public String toString() {
- return "$count";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
deleted file mode 100644
index a37f858..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
+++ /dev/null
@@ -1,67 +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.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceEntitySet;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
- protected EdmEntitySet edmEntitySet = null;
-
- public UriResourceEntitySetImpl() {
- super(UriResourceKind.entitySet);
- }
-
- @Override
- public EdmEntitySet getEntitySet() {
- return edmEntitySet;
- }
-
- public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
- edmEntitySet = edmES;
- return this;
- }
-
- @Override
- public EdmEntityType getEntityType() {
- return edmEntitySet.getEntityType();
- }
-
- @Override
- public EdmType getType() {
- return edmEntitySet.getEntityType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates == null) {
- return true;
- }
- return false;
- }
-
- @Override
- public String toString() {
- return edmEntitySet.getName();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
deleted file mode 100644
index 358f18f..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
+++ /dev/null
@@ -1,111 +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.ArrayList;
-import java.util.List;
-
-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.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriParameter;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceFunction;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-/**
- * Covers Function imports and BoundFunction in URI
- */
-public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
-
- protected List<UriParameterImpl> parameters;
- protected EdmFunction function;
- protected EdmFunctionImport functionImport;
- private boolean isParameterListFilled = false;
-
- public UriResourceFunctionImpl() {
- super(UriResourceKind.function);
- }
-
- @Override
- public List<UriParameter> getParameters() {
- List<UriParameter> retList = new ArrayList<UriParameter>();
- for (UriParameterImpl item : parameters) {
- retList.add(item);
- }
- return retList;
- }
-
- public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
- isParameterListFilled = true;
- this.parameters = parameters;
- return this;
- }
-
- @Override
- public EdmFunction getFunction() {
- return function;
- }
-
- public UriResourceFunctionImpl setFunction(final EdmFunction function) {
- this.function = function;
- return this;
- }
-
- @Override
- public EdmFunctionImport getFunctionImport() {
- return functionImport;
- }
-
- public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
- final List<UriParameterImpl> parameters) {
- functionImport = edmFI;
-
- setParameters(parameters);
-
- return this;
- }
-
- @Override
- public EdmType getType() {
- return function.getReturnType().getType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return function.getReturnType().isCollection();
- }
-
- @Override
- public String toString() {
- if (functionImport != null) {
- return functionImport.getName();
- } else if (function != null) {
- return function.getName();
- }
- return "";
- }
-
- public boolean isParameterListFilled() {
- return isParameterListFilled;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImpl.java
deleted file mode 100644
index b26d778..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImpl.java
+++ /dev/null
@@ -1,39 +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.producer.api.uri.UriResource;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public abstract class UriResourceImpl implements UriResource {
- protected UriResourceKind kind;
-
- public UriResourceImpl(final UriResourceKind kind) {
- this.kind = kind;
- }
-
- @Override
- public UriResourceKind getKind() {
- return kind;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
deleted file mode 100644
index 37b7261..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
+++ /dev/null
@@ -1,65 +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.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceItImpl() {
- super(UriResourceKind.it);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceItImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceItImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return "$it";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAllImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAllImpl.java
deleted file mode 100644
index 480dd6e..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAllImpl.java
+++ /dev/null
@@ -1,73 +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.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
- protected EdmProperty property;
- private String lamdaVariable;
- private ExpressionImpl expression;
-
- public UriResourceLambdaAllImpl() {
- super(UriResourceKind.lambdaAll);
- }
-
- @Override
- public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String getLamdaVariable() {
- return lamdaVariable;
- }
-
- public UriResourceLambdaAllImpl setLamdaVariable(final String lamdaVariable) {
- this.lamdaVariable = lamdaVariable;
- return this;
- };
-
- @Override
- public Expression getExpression() {
- return expression;
- }
-
- public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- };
-
- @Override
- public String toString() {
- return "all";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAnyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAnyImpl.java
deleted file mode 100644
index 25a4f20..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaAnyImpl.java
+++ /dev/null
@@ -1,72 +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.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
- protected EdmProperty property;
- private String lamdaVariable;
- private ExpressionImpl expression;
-
- public UriResourceLambdaAnyImpl() {
- super(UriResourceKind.lambdaAny);
- }
-
- @Override
- public EdmType getType() {
- return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String getLamdaVariable() {
- return lamdaVariable;
- }
-
- public UriResourceLambdaAnyImpl setLamdaVariable(final String lamdaVariable) {
- this.lamdaVariable = lamdaVariable;
- return this;
- };
-
- @Override
- public Expression getExpression() {
- return expression;
- }
-
- public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public String toString() {
- return "any";
- };
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaVarImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaVarImpl.java
deleted file mode 100644
index d595289..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceLambdaVarImpl.java
+++ /dev/null
@@ -1,70 +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.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaRef;
-
-public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaRef {
-
- private EdmType type;
- private boolean isCollection;
- private String variableText;
-
- public UriResourceLambdaVarImpl() {
- super(UriResourceKind.lambdaVariable);
- }
-
- @Override
- public String getVariableText() {
- return variableText;
- }
-
- public UriResourceLambdaVarImpl setVariableText(final String variableText) {
- this.variableText = variableText;
- return this;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceLambdaVarImpl setType(final EdmType type) {
- this.type = type;
- return this;
-
- }
-
- @Override
- public boolean isCollection() {
- return isCollection;
- }
-
- public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return variableText;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
deleted file mode 100644
index 3719fa2..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
+++ /dev/null
@@ -1,63 +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.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceNavigation;
-
-public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
-
- protected EdmNavigationProperty navigationProperty;
-
- public UriResourceNavigationPropertyImpl() {
- super(UriResourceKind.navigationProperty);
- }
-
- @Override
- public EdmNavigationProperty getProperty() {
- return navigationProperty;
- }
-
- public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
- navigationProperty = property;
- return this;
-
- }
-
- @Override
- public EdmType getType() {
- return navigationProperty.getType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return navigationProperty.isCollection();
- }
-
- @Override
- public String toString() {
- return navigationProperty.getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePrimitivePropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePrimitivePropertyImpl.java
deleted file mode 100644
index f9c8689..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePrimitivePropertyImpl.java
+++ /dev/null
@@ -1,59 +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.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePrimitiveProperty;
-
-public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
-
- EdmProperty property;
-
- public UriResourcePrimitivePropertyImpl() {
- super(UriResourceKind.primitiveProperty);
- }
-
- @Override
- public EdmProperty getProperty() {
- return property;
- }
-
- public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
- this.property = property;
- return this;
- }
-
- @Override
- public EdmType getType() {
- return property.getType();
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public String toString() {
- return property.getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
deleted file mode 100644
index 9a94674..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRefImpl.java
+++ /dev/null
@@ -1,36 +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.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
-
-public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
-
- public UriResourceRefImpl() {
- super(UriResourceKind.ref);
-
- }
-
- @Override
- public String toString() {
- return "$ref";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
deleted file mode 100644
index 7a3977a..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceRootImpl.java
+++ /dev/null
@@ -1,62 +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.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceRoot;
-
-public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceRootImpl() {
- super(UriResourceKind.root);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceRootImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceRootImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return "$root";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
deleted file mode 100644
index a25aa5e..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
+++ /dev/null
@@ -1,71 +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.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceSingleton;
-
-public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
-
- private EdmSingleton singleton;
-
- public UriResourceSingletonImpl() {
- super(UriResourceKind.singleton);
- }
-
- @Override
- public EdmSingleton getSingleton() {
- return singleton;
- }
-
- public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
-
- this.singleton = singleton;
- return this;
- }
-
- @Override
- public EdmEntityType getEntityTypeFilter() {
- return (EdmEntityType) typeFilter;
- }
-
- @Override
- public EdmType getType() {
- return singleton.getEntityType();
- }
-
- @Override
- public EdmEntityType getEntityType() {
- return singleton.getEntityType();
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String toString() {
- return singleton.getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceStartingTypeFilterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceStartingTypeFilterImpl.java
deleted file mode 100644
index 37a5365..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceStartingTypeFilterImpl.java
+++ /dev/null
@@ -1,68 +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.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceStartingTypeFilter;
-
-public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl
- implements UriResourceStartingTypeFilter {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceStartingTypeFilterImpl() {
- super(UriResourceKind.startingTypeFilter);
- }
-
- @Override
- public UriResourceKind getKind() {
- return kind;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return type.getNamespace() + "." + type.getName();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceTypedImpl.java
deleted file mode 100644
index f8ee2b4..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceTypedImpl.java
+++ /dev/null
@@ -1,60 +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.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
-
-public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
-
- protected EdmType typeFilter = null;
-
- public UriResourceTypedImpl(final UriResourceKind kind) {
- super(kind);
- }
-
- public EdmType getTypeFilter() {
- return typeFilter;
- }
-
- public UriResourceTypedImpl setTypeFilter(final EdmStructuralType typeFilter) {
- this.typeFilter = typeFilter;
- return this;
- }
-
- @Override
- public String toString(final boolean includeFilters) {
- if (includeFilters) {
- if (typeFilter != null) {
- return toString() + "/" + getFQN(typeFilter).toString();
- } else {
- return toString();
- }
- }
- return toString();
- }
-
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
deleted file mode 100644
index dc84d2f..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceValueImpl.java
+++ /dev/null
@@ -1,36 +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.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceValue;
-
-public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
-
- public UriResourceValueImpl() {
- super(UriResourceKind.value);
-
- }
-
- @Override
- public String toString() {
- return "$value";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceWithKeysImpl.java
deleted file mode 100644
index b21fbd1..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceWithKeysImpl.java
+++ /dev/null
@@ -1,98 +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.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriParameter;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
-
-public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
-
- protected EdmType collectionTypeFilter = null;
- protected List<UriParameterImpl> keyPredicates = null;
- protected EdmType entryTypeFilter = null;
-
- public UriResourceWithKeysImpl(final UriResourceKind kind) {
- super(kind);
- }
-
- public EdmType getTypeFilterOnCollection() {
- return collectionTypeFilter;
- }
-
- public EdmType getTypeFilterOnEntry() {
- return entryTypeFilter;
- }
-
- public List<UriParameter> getKeyPredicates() {
- List<UriParameter> retList = new ArrayList<UriParameter>();
- for (UriParameterImpl item : keyPredicates) {
- retList.add(item);
- }
- return retList;
- }
-
- public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
- keyPredicates = list;
- return this;
- }
-
- public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
- this.entryTypeFilter = entryTypeFilter;
- return this;
- }
-
- public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
- this.collectionTypeFilter = collectionTypeFilter;
- return this;
- }
-
- public String toString(final boolean includeFilters) {
-
- if (includeFilters == true) {
- String tmp = "";
- if (collectionTypeFilter != null) {
- tmp += getFQN(collectionTypeFilter).toString();
- }
-
- if (entryTypeFilter != null) {
- if (tmp.length() == 0) {
- tmp = getFQN(entryTypeFilter).toString();
- } else {
- tmp += "/()" + getFQN(entryTypeFilter).toString();
- }
- }
- if (tmp.length() != 0) {
- return toString() + "/" + tmp;
- }
- }
-
- return toString();
- }
-
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
deleted file mode 100644
index d9fdf26..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
+++ /dev/null
@@ -1,38 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.AliasQueryOption;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryOption {
-
- private ExpressionImpl aliasValue;
-
- @Override
- public ExpressionImpl getValue() {
- return aliasValue;
- }
-
- public AliasQueryOptionImpl setAliasValue(final ExpressionImpl aliasValue) {
- this.aliasValue = aliasValue;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
deleted file mode 100644
index b3822a9..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/CustomQueryOptionImpl.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-
-public class CustomQueryOptionImpl extends QueryOptionImpl implements CustomQueryOption {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
deleted file mode 100644
index 0f397a4..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandItemImpl.java
+++ /dev/null
@@ -1,163 +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.queryoption;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.LevelsExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-
-public class ExpandItemImpl implements ExpandItem {
- private LevelsExpandOption levelsExpandOption;
- private FilterOption filterOption;
- private SearchOption searchOption;
- private OrderByOption orderByOption;
- private SkipOption skipOption;
- private TopOption topOption;
- private InlineCountOption inlineCountOption;
- private SelectOption selectOption;
- private ExpandOption expandOption;
-
- private UriInfoResource resourceInfo;
-
- private boolean isStar;
-
- private boolean isRef;
-
- public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) {
-
- if (sysItem.getKind() == SupportedQueryOptions.EXPAND) {
- expandOption = (ExpandOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.FILTER) {
- filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.INLINECOUNT) {
- inlineCountOption = (InlineCountOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.ORDERBY) {
- orderByOption = (OrderByOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.SEARCH) {
- searchOption = (SearchOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.SELECT) {
- selectOption = (SelectOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.SKIP) {
- skipOption = (SkipOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.TOP) {
- topOption = (TopOptionImpl) sysItem;
- } else if (sysItem.getKind() == SupportedQueryOptions.LEVELS) {
- levelsExpandOption = (LevelsExpandOption) sysItem;
- }
- return this;
- }
-
- public ExpandItemImpl setSystemQueryOptions(final List<SystemQueryOptionImpl> list) {
-
- for (SystemQueryOptionImpl item : list) {
- setSystemQueryOption(item);
- }
- return this;
- }
-
- @Override
- public LevelsExpandOption getLevelsOption() {
- return levelsExpandOption;
- }
-
- @Override
- public FilterOption getFilterOption() {
- return filterOption;
- }
-
- @Override
- public SearchOption getSearchOption() {
- return searchOption;
- }
-
- @Override
- public OrderByOption getOrderByOption() {
- return orderByOption;
- }
-
- @Override
- public SkipOption getSkipOption() {
- return skipOption;
- }
-
- @Override
- public TopOption getTopOption() {
- return topOption;
- }
-
- @Override
- public InlineCountOption getInlineCountOption() {
- return inlineCountOption;
- }
-
- @Override
- public SelectOption getSelectOption() {
-
- return selectOption;
- }
-
- @Override
- public ExpandOption getExpandOption() {
- return expandOption;
- }
-
- public ExpandItemImpl setResourceInfo(final UriInfoResource resourceInfo) {
- this.resourceInfo = resourceInfo;
- return this;
- }
-
- @Override
- public UriInfoResource getResourceInfo() {
-
- return resourceInfo;
- }
-
- @Override
- public boolean isStar() {
- return isStar;
- }
-
- public ExpandItemImpl setIsStar(final boolean isStar) {
- this.isStar = isStar;
- return this;
- }
-
- @Override
- public boolean isRef() {
- return isRef;
- }
-
- public ExpandItemImpl setIsRef(final boolean isRef) {
- this.isRef = isRef;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
deleted file mode 100644
index 9affa89..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/ExpandOptionImpl.java
+++ /dev/null
@@ -1,49 +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.queryoption;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption {
-
- List<ExpandItemImpl> expandItems = new ArrayList<ExpandItemImpl>();
-
- public ExpandOptionImpl() {
- setKind(SupportedQueryOptions.EXPAND);
- }
-
- public void addExpandItem(final ExpandItemImpl expandItem) {
- expandItems.add(expandItem);
- }
-
- @Override
- public List<ExpandItem> getExpandItems() {
- List<ExpandItem> retList = new ArrayList<ExpandItem>();
- for (ExpandItemImpl item : expandItems) {
- retList.add(item);
- }
- return retList;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
deleted file mode 100644
index f24f17f..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FilterOptionImpl.java
+++ /dev/null
@@ -1,43 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOption {
-
- private ExpressionImpl expression;
-
- public FilterOptionImpl() {
- setKind(SupportedQueryOptions.FILTER);
- }
-
- public FilterOptionImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public ExpressionImpl getExpression() {
- return expression;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
deleted file mode 100644
index 309463c..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/FormatOptionImpl.java
+++ /dev/null
@@ -1,41 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FormatOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class FormatOptionImpl extends SystemQueryOptionImpl implements FormatOption {
- private String value;
-
- public FormatOptionImpl() {
- setKind(SupportedQueryOptions.FORMAT);
- }
-
- public FormatOptionImpl setFormat(final String value) {
- this.value = value;
- return this;
- }
-
- @Override
- public String getFormat() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
deleted file mode 100644
index 298054d..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/IdOptionImpl.java
+++ /dev/null
@@ -1,40 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.IdOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class IdOptionImpl extends SystemQueryOptionImpl implements IdOption {
- private String value;
-
- public IdOptionImpl() {
- setKind(SupportedQueryOptions.ID);
- }
-
- public IdOptionImpl setValue(final String value) {
- this.value = value;
- return this;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
deleted file mode 100644
index 96f8ee4..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/InlineCountOptionImpl.java
+++ /dev/null
@@ -1,42 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class InlineCountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption {
-
- private boolean count;
-
- public InlineCountOptionImpl() {
- setKind(SupportedQueryOptions.INLINECOUNT);
- }
-
- @Override
- public boolean getValue() {
- return count;
- }
-
- public InlineCountOptionImpl setValue(final boolean count) {
- this.count = count;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelsOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelsOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelsOptionImpl.java
deleted file mode 100644
index 7149433..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/LevelsOptionImpl.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.core.uri.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.LevelsExpandOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class LevelsOptionImpl extends SystemQueryOptionImpl implements LevelsExpandOption {
- private boolean isMax;
- private int value;
-
- public LevelsOptionImpl() {
- setKind(SupportedQueryOptions.LEVELS);
- }
-
- public LevelsOptionImpl setLevel(final int value) {
- this.value = value;
- return this;
- }
-
- @Override
- public boolean isMax() {
- return isMax;
- }
-
- public LevelsOptionImpl setMax() {
- isMax = true;
- return this;
-
- }
-
- @Override
- public int getLevel() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByItemImpl.java
deleted file mode 100644
index 1b180fe..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByItemImpl.java
+++ /dev/null
@@ -1,50 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByItem;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class OrderByItemImpl implements OrderByItem {
-
- private ExpressionImpl expression;
- private boolean descending = false; // default sort order is ascending
-
- @Override
- public boolean isDescending() {
- return descending;
- }
-
- public OrderByItem setDescending(final boolean descending) {
- this.descending = descending;
- return this;
- }
-
- @Override
- public ExpressionImpl getExpression() {
- return expression;
- }
-
- public OrderByItem setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
deleted file mode 100644
index 6710925..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/OrderByOptionImpl.java
+++ /dev/null
@@ -1,50 +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.queryoption;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByOption {
-
- private List<OrderByItemImpl> orders= new ArrayList<OrderByItemImpl>();
-
- public OrderByOptionImpl() {
- setKind(SupportedQueryOptions.ORDERBY);
- }
-
- @Override
- public List<OrderByItem> getOrders() {
- List<OrderByItem> retList = new ArrayList<OrderByItem>();
- for (OrderByItemImpl item : orders) {
- retList.add(item);
- }
- return retList;
- }
-
- public OrderByOptionImpl addOrder(final OrderByItemImpl order) {
- orders.add(order);
- return this;
- }
-
-}
[04/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
new file mode 100644
index 0000000..56b57d7
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java
@@ -0,0 +1,4979 @@
+/*******************************************************************************
+ * 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.server.core.uri.antlr;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.testutil.FilterValidator;
+import org.apache.olingo.odata4.server.core.testutil.UriResourceValidator;
+import org.apache.olingo.odata4.server.core.testutil.UriValidator;
+import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.junit.Test;
+
+public class TestFullResourcePath {
+ Edm edm = null;
+ UriValidator testUri = null;
+ UriResourceValidator testRes = null;
+ FilterValidator testFilter = null;
+
+ public TestFullResourcePath() {
+ edm = new EdmProviderImpl(new EdmTechTestProvider());
+ testUri = new UriValidator().setEdm(edm);
+ testRes = new UriResourceValidator().setEdm(edm);
+ testFilter = new FilterValidator().setEdm(edm);
+ }
+
+ @Test
+ public void test() {}
+
+ @Test
+ public void testFunctionBound_varOverloading() {
+ // on ESTwoKeyNav
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // with string parameter
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // with string parameter
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+ }
+
+ @Test
+ public void runBfuncBnCpropCastRtEs() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
+ .isType(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ }
+
+ @Test
+ public void runBfuncBnCpropCollRtEs() {
+ testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim");
+
+ testUri
+ .run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+ }
+
+ @Test
+ public void runBfuncBnCpropRtEs() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ }
+
+ @Test
+ public void runBfuncBnEntityRtEs() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnEntityCastRtEs() {
+ testUri
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+
+ testUri
+ .run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'(''2'')'")
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnEsCastRtEs() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+ .isType(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCprop() {
+ testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isFunction("BFCESAllPrimRTCTAllPrim")
+ .isType(EdmTechProvider.nameCTAllPrim);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameCTBase);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCpropColl() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntityPpNp() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.ref);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false)
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTAllPrim);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntyPpNpCast() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
+ + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri
+ .run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
+ + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntityPpCp() {
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false)
+ .n()
+ .isValue();
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntyPpCpCast() {
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntityPpSp() {
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false)
+ .n()
+ .isValue();
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEs() {
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isParameter(0, "ParameterString", "'2'")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isParameter(0, "ParameterString", "'3'")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .n()
+ .isCount();
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'");
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEsBa() {
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex"
+ + "/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .n()
+ .isAction("BAESAllPrimRTETAllPrim");
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtPrim() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString")
+ .isType(EdmTechProvider.nameString)
+ .n()
+ .isValue();
+ }
+
+ @Test
+ public void runbfuncBnEsRtPrimColl() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(EdmTechProvider.nameString, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runBfuncBnPpropCollRtEs() {
+ testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runBfuncBnPpropRtEs() {
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runBfuncBnSingleRtEs() {
+
+ testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isFunction("BFCSINavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnSingleCastRtEs() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
+ }
+
+ @Test
+ public void runActionBound_on_EntityEntry() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+ }
+
+ @Test
+ public void runActionBound_on_EntityCollection() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isAction("BAESTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runFunctionBound_on_var_Types() {
+
+ // on primitive
+ testUri.run("ESAllPrim(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETAllPrim)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(EdmTechProvider.nameString);
+
+ // on collection of primitive
+ testUri.run("ESCollAllPrim(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETCollAllPrim)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(EdmTechProvider.nameString);
+
+ // on complex
+ testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .at(2)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // on collection of complex
+ testUri.run("ESKeyNav(1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .at(1)
+ .isType(EdmTechProvider.nameCTPrimComp)
+ .isCollection(true)
+ .at(2)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETAllPrim);
+
+ // on entity
+ testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')"
+ + "/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ // on collection of entity
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isCollection(true)
+ .at(1).isUriPathInfoKind(UriResourceKind.function)
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+ }
+
+ @Test
+ public void runActionBound_on_EntityCast() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/com.sap.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
+ .n()
+ .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
+ }
+
+ @Test
+ public void runCrossjoin() {
+ testUri.run("$crossjoin(ESKeyNav)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
+
+ testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
+ }
+
+ @Test
+ public void runCrossjoinError() {
+ testUri.runEx("$crossjoin").isExSyntax(0);
+ testUri.runEx("$crossjoin/error").isExSyntax(0);
+ testUri.runEx("$crossjoin()").isExSyntax(0);
+ testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid").isExSyntax(0);
+ }
+
+ @Test
+ public void runEntityId() {
+ testUri.run("$entity?$id=ESKeyNav(1)")
+ .isKind(UriInfoKind.entityId)
+ .isIdText("ESKeyNav(1)");
+ testUri.run("$entity/com.sap.odata.test1.ETKeyNav?$id=ESKeyNav(1)")
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EdmTechProvider.nameETKeyNav)
+ .isIdText("ESKeyNav(1)");
+ }
+
+ @Test
+ public void runEntityIdError() {
+ testUri.runEx("$entity").isExSyntax(0);
+ testUri.runEx("$entity?$idfalse=ESKeyNav(1)").isExSyntax(0);
+ testUri.runEx("$entity/com.sap.odata.test1.invalidType?$id=ESKeyNav(1)").isExSemantic(0);
+ testUri.runEx("$entity/invalid?$id=ESKeyNav(1)").isExSyntax(0);
+ }
+
+ @Test
+ public void runEsName() {
+ testUri.run("ESAllPrim")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true);
+
+ testUri.run("ESAllPrim/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runEsNameError() {
+
+ testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(0);
+ testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(0);
+ testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(0);
+ testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(0);
+ testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(0);
+ testUri.runEx("ESAllPrim(PropertyInt16='1')").isExSemantic(0);
+ testUri.runEx("ESAllPrim(PropertyInt16)").isExSemantic(0);
+ testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(0);
+ testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim").isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETAllKey")
+ .isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim('1')/com.sap.odata.test1.ETAllKey")
+ .isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim")
+ .isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
+ .isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETAllKey")
+ .isExSemantic(0);
+
+ testUri.runEx("ETBaseTwoKeyTwoPrim()")
+ .isExSemantic(0);
+
+ testUri.runEx("ESAllNullable(1)/CollPropertyString/$value")
+ .isExSemantic(0);
+
+ testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(0);
+ }
+
+ @Test
+ public void runEsNameCast() {
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768");
+
+ testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768");
+
+ }
+
+ @Test
+ public void runEsNamePpSpCast() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false);
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+ }
+
+ @Test
+ public void runEsNameKey() {
+ testUri.run("ESCollAllPrim(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+
+ testUri.run("ESCollAllPrim(PropertyInt16=1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+
+ testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESFourKeyAlias")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "KeyAlias1", "2")
+ .isKeyPredicate(2, "KeyAlias2", "'3'")
+ .isKeyPredicate(3, "KeyAlias3", "'4'");
+
+ testUri.run("ESCollAllPrim(null)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+ }
+
+ @Test
+ public void runEsNameParaKeys() {
+ testUri.run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
+ + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
+ + "PropertyInt64=-9223372036854775808,PropertyDecimal=0.1,PropertyDate=2013-09-25,"
+ + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
+ + "PropertyDuration=duration'P10DT5H34M21.123456789012S',"
+ + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
+ + "PropertyTimeOfDay=12:34:55.123456789012)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllKey")
+ .isKeyPredicate(0, "PropertyString", "'O''Neil'")
+ .isKeyPredicate(1, "PropertyBoolean", "true")
+ .isKeyPredicate(2, "PropertyByte", "255")
+ .isKeyPredicate(3, "PropertySByte", "-128")
+ .isKeyPredicate(4, "PropertyInt16", "-32768")
+ .isKeyPredicate(5, "PropertyInt32", "-2147483648")
+ .isKeyPredicate(6, "PropertyInt64", "-9223372036854775808")
+ .isKeyPredicate(7, "PropertyDecimal", "0.1")
+ .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");
+ }
+
+ @Test
+ public void runEsNameKeyCast() {
+
+ testUri.runEx("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
+ .isExSemantic(0);
+
+ testUri.runEx("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
+ .isExSemantic(0);
+
+ testUri.runEx("xESBase/com.sap.odata.test1.ETTwoPrim(1)")
+ .isExSemantic(0);
+
+ testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+ }
+
+ @Test
+ public void runEsNameParaKeysCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'");
+ }
+
+ @Test
+ public void run_EsNamePpCp() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+ }
+
+ @Test
+ public void runEsNamePpCpColl() {
+ testUri.run("ESMixPrimCollComp(5)/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .isKeyPredicate(0, "PropertyInt16", "5")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runEsNamePpCpCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTBase);
+
+ testUri
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+ }
+
+ @Test
+ public void runNsNamePpNp() {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2");
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavMany(4)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "4");
+
+ testUri.run("ESKeyNav(1)/PropertyComplex/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
+ + "/PropertyComplex/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'(3)'")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETMediaMany", EdmTechProvider.nameETMedia, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .n()
+ .isNavProperty("NavPropertyETMediaOne", EdmTechProvider.nameETMedia, false)
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runEsNamePpNpCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETKeyNavMany(3)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "3");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "3")
+ .isKeyPredicate(1, "PropertyString", "'4'")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "4")
+ .isKeyPredicate(1, "PropertyString", "'5'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EdmTechProvider.nameETBaseTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
+ + "NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
+ + "NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "4")
+ .isKeyPredicate(1, "PropertyString", "'5'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
+ }
+
+ @Test
+ public void runEsNamePpNpRc() {
+ // checks for using referential constrains to fill missing keys
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+ .isKeyPredicate(1, "PropertyString", "'2'");
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+ .isKeyPredicate(1, "PropertyString", "'2'");
+
+ }
+
+ @Test
+ public void runEsNamePpSp() {
+ testUri.run("ESAllPrim(1)/PropertyByte")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false);
+
+ testUri.run("ESAllPrim(1)/PropertyByte/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyByte", EdmTechProvider.nameByte, false)
+ .n()
+ .isValue();
+
+ testUri.run("ESMixPrimCollComp(1)/PropertyComplex/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+ }
+
+ @Test
+ public void runEsNamePpSpColl() {
+ testUri.run("ESCollAllPrim(1)/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+
+ }
+
+ @Test
+ public void runEsNameRef() {
+ testUri.run("ESAllPrim/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isRef();
+
+ testUri.run("ESAllPrim(-32768)/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "-32768")
+ .n()
+ .isRef();
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runFunctionImpBf() {
+
+ testUri.run("FICRTString()/com.sap.odata.test1.BFCStringRTESTwoKeyNav()");
+ }
+
+ @Test
+ public void runFunctionImpCastBf() {
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+ }
+
+ @Test
+ public void runFunctionImpEntity() {
+
+ testUri.run("FICRTETKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'");
+
+ testUri.run("FICRTETMedia()/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETMedia")
+ .isFunction("UFCRTETMedia")
+ .n()
+ .isValue();
+
+ testUri.run("FICRTETKeyNav()/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .n()
+ .isRef();
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .n()
+ .isRef();
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'");
+ }
+
+ @Test
+ public void runFunctionImpEs() {
+ /**/
+ testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EdmTechProvider.nameETMixPrimCollComp);
+
+ testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FINRTESMixPrimCollCompTwoParam")
+ .isFunction("UFNRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EdmTechProvider.nameETMixPrimCollComp);
+
+ testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EdmTechProvider.nameETMixPrimCollComp)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runFunctionImpError() {
+ testUri.runEx("FICRTCollCTTwoPrimParam()").isExSemantic(0);
+ testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)").isExSemantic(0);
+ }
+
+ @Test
+ public void runFunctionImpEsAlias() {
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)?@parameterAlias=1");
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count?@parameterAlias=1");
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@invalidAlias)?@validAlias=1");
+ }
+
+ @Test
+ public void runFunctionImpEsCast() {
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isCount();
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'");
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ }
+
+ @Test
+ public void runSingletonEntityValue() {
+ testUri.run("SIMedia/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SIMedia")
+ .n().isValue();
+ }
+
+ @Test
+ public void runSingletonPpNpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1");
+
+ }
+
+ @Test
+ public void runSingletonPpCpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTBase);
+
+ }
+
+ @Test
+ public void runSingletonPpSpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
+ .isType(EdmTechProvider.nameString, true);
+
+ }
+
+ @Test
+ public void runSingletonEntityPpNp() {
+ testUri.run("SINav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
+
+ testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'");
+
+ }
+
+ @Test
+ public void runSingletonEntityPpCp() {
+ testUri.run("SINav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
+ }
+
+ @Test
+ public void runSingletonEntityPpCpColl() {
+ testUri.run("SINav/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true);
+
+ testUri.run("SINav/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runSingletonEntityPpSp() {
+ testUri.run("SINav/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
+ }
+
+ @Test
+ public void runSingletonEntityPpSpColl() {
+ testUri.run("SINav/CollPropertyString")
+
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true);
+ testUri.run("SINav/CollPropertyString/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runExpand() {
+
+ testUri.run("ESKeyNav(1)?$expand=*")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegmentStar(0);
+
+ testUri.run("ESKeyNav(1)?$expand=*/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegmentStar(0)
+ .isSegmentRef(1);
+
+ testUri.run("ESKeyNav(1)?$expand=*/$ref,NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegmentStar(0).isSegmentRef(1)
+ .next()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true);
+
+ testUri.run("ESKeyNav(1)?$expand=*($levels=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegmentStar(0)
+ .isLevelText("3");
+
+ testUri.run("ESKeyNav(1)?$expand=*($levels=max)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .isSegmentStar(0)
+ .isLevelText("max");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .n().isRef();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator().isFilterSerialized("<<PropertyInt16> eq <1>>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($orderby=PropertyInt16)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator();// .isFilterSerialized(""); TODO check order BY
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isTopText("2");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($count=true)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isInlineCountText("true");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1;$top=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1")
+ .isTopText("3");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1%3b$top=3)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSkipText("1")
+ .isTopText("3");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isCount();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .n().isCount();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .n().isCount()
+ .goUpExpandValidator()
+ .isFilterSerialized("<<PropertyInt16> gt <1>>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($filter=PropertyInt16 eq 1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isFilterSerialized("<<PropertyInt16> eq <1>>");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($orderby=PropertyInt16)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator();// TODO check orderby
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSkipText("1");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($top=2)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isTopText("2");
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($count=true)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true)
+ .isType(EdmTechProvider.nameETKeyNav, true)
+
<TRUNCATED>
[05/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
new file mode 100644
index 0000000..d24ba73
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+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.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.core.uri.Parser;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriParseTreeVisitor;
+import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+
+public class UriValidator implements Validator {
+ private Edm edm;
+
+ private UriInfoImpl uriInfo;
+ private Exception exception;
+
+ // Setup
+ public UriValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ // Execution
+ public UriValidator run(final String uri) {
+ Parser parser = new Parser();
+ uriInfo = null;
+ try {
+ // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+ uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
+ } catch (UriParserException e) {
+ fail("Exception occured while parsing the URI: " + uri + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ return this;
+ }
+
+ public UriValidator runEx(final String uri) {
+ Parser parser = new Parser();
+ uriInfo = null;
+ try {
+ // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+ uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
+
+ } catch (UriParserException e) {
+ exception = e;
+ }
+
+ return this;
+ }
+
+ public UriValidator log(final String uri) {
+ ParserTest parserTest = new ParserTest();
+ uriInfo = null;
+ try {
+ // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
+ uriInfo = (UriInfoImpl) parserTest.parseUri(uri, new UriParseTreeVisitor(edm));
+ fail("Exception expected");
+ } catch (UriParserException e) {
+ fail("Exception occured while parsing the URI: " + uri + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ return this;
+ }
+
+ // Navigation
+ public UriResourceValidator goPath() {
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("invalid resource kind: " + uriInfo.getKind().toString());
+ }
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo);
+ }
+
+ public FilterValidator goFilter() {
+ FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
+ if (filter == null) {
+ fail("no filter found");
+ }
+ return new FilterValidator().setUriValidator(this).setFilter(filter);
+
+ }
+
+ public ExpandValidator goExpand() {
+ ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+ if (expand == null) {
+ fail("invalid resource kind: " + uriInfo.getKind().toString());
+ }
+
+ return new ExpandValidator().setGoUpValidator(this).setExpand(expand);
+ }
+
+
+ public UriResourceValidator goSelectItemPath(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo1);
+
+ }
+
+ // Validation
+ public UriValidator isKind(final UriInfoKind kind) {
+ assertEquals(kind, uriInfo.getKind());
+ return this;
+ }
+
+ public UriValidator isCustomParameter(final int index, final String name, final String value) {
+ if (uriInfo == null) {
+ fail("hasQueryParameter: uriInfo == null");
+ }
+
+ List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+ if (list.size() <= index) {
+ fail("not enought queryParameters");
+ }
+
+ CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+ assertEquals(name, option.getName());
+ assertEquals(value, option.getText());
+ return this;
+ }
+
+ public void isCrossJoinEntityList(final List<String> entitySets) {
+ if (uriInfo.getKind() != UriInfoKind.crossjoin) {
+ fail("invalid resource kind: " + uriInfo.getKind().toString());
+ }
+
+ int i = 0;
+ for (String entitySet : entitySets) {
+ assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
+ i++;
+ }
+
+ }
+
+ public UriValidator isExSyntax(long errorID) {
+ assertEquals(UriParserSyntaxException.class, exception.getClass());
+ return this;
+ }
+
+ public UriValidator isExSemantic(long errorID) {
+ assertEquals(UriParserSemanticException.class, exception.getClass());
+ return this;
+ }
+
+ public UriValidator isIdText(final String text) {
+ assertEquals(text, uriInfo.getIdOption().getText());
+ return this;
+ }
+
+ public UriValidator isExpandText(final String text) {
+ assertEquals(text, uriInfo.getExpandOption().getText());
+ return this;
+ }
+
+ public UriValidator isSelectText(final String text) {
+ assertEquals(text, uriInfo.getSelectOption().getText());
+ return this;
+ }
+
+ public UriValidator isFormatText(final String text) {
+ assertEquals(text, uriInfo.getFormatOption().getText());
+ return this;
+ }
+
+ public UriValidator isFragmentText(final String text) {
+ if (uriInfo.getKind() != UriInfoKind.metadata) {
+ fail("invalid resource kind: " + uriInfo.getKind().toString());
+ }
+
+ assertEquals(text, uriInfo.getFragment());
+
+ return this;
+ }
+
+ public UriValidator isEntityType(final FullQualifiedName fullName) {
+ if (uriInfo.getKind() != UriInfoKind.entityId) {
+ fail("invalid resource kind: " + uriInfo.getKind().toString());
+ }
+
+ assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
+ return this;
+ }
+
+ private String fullName(final EdmEntityType type) {
+ return type.getNamespace() + "." + type.getName();
+ }
+
+ public UriValidator isSelectItemStar(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(true, item.isStar());
+ return this;
+ }
+
+ public UriValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
new file mode 100644
index 0000000..6febab2
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+public interface Validator {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
new file mode 100644
index 0000000..d6cfa93
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.server.api.uri.UriInfoAll;
+import org.apache.olingo.odata4.server.api.uri.UriInfoBatch;
+import org.apache.olingo.odata4.server.api.uri.UriInfoCrossjoin;
+import org.apache.olingo.odata4.server.api.uri.UriInfoEntityId;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriInfoMetadata;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.UriInfoService;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.InlineCountOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.LevelsOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+import org.junit.Test;
+
+public class UriInfoImplTest {
+
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testKind() {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
+ assertEquals(UriInfoKind.all, uriInfo.getKind());
+ }
+
+ @Test
+ public void testCasts() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+
+ UriInfoAll all = uriInfo.asUriInfoAll();
+ assertEquals(uriInfo, all);
+
+ UriInfoBatch batch = uriInfo.asUriInfoBatch();
+ assertEquals(uriInfo, batch);
+
+ UriInfoCrossjoin crossjoin = uriInfo.asUriInfoCrossjoin();
+ assertEquals(uriInfo, crossjoin);
+
+ UriInfoEntityId entityID = uriInfo.asUriInfoEntityId();
+ assertEquals(uriInfo, entityID);
+
+ UriInfoMetadata metadata = uriInfo.asUriInfoMetadata();
+ assertEquals(uriInfo, metadata);
+
+ UriInfoResource resource = uriInfo.asUriInfoResource();
+ assertEquals(uriInfo, resource);
+
+ UriInfoService service = uriInfo.asUriInfoService();
+ assertEquals(uriInfo, service);
+
+ }
+
+ @Test
+ public void testEntityNames() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+ uriInfo.addEntitySetName("A");
+ uriInfo.addEntitySetName("B");
+
+ assertEquals("A", uriInfo.getEntitySetNames().get(0));
+ assertEquals("B", uriInfo.getEntitySetNames().get(1));
+
+ }
+
+ @Test
+ public void testResourceParts() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+
+ UriResourceActionImpl action = new UriResourceActionImpl();
+ UriResourceEntitySetImpl entitySet0 = new UriResourceEntitySetImpl();
+ UriResourceEntitySetImpl entitySet1 = new UriResourceEntitySetImpl();
+
+ uriInfo.addResourcePart(action);
+ uriInfo.addResourcePart(entitySet0);
+
+ assertEquals(action, uriInfo.getUriResourceParts().get(0));
+ assertEquals(entitySet0, uriInfo.getUriResourceParts().get(1));
+
+ assertEquals(entitySet0, uriInfo.getLastResourcePart());
+
+ uriInfo.addResourcePart(entitySet1);
+ assertEquals(entitySet1, uriInfo.getLastResourcePart());
+ }
+
+ @Test
+ public void testCustomQueryOption() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+
+ List<QueryOptionImpl> queryOptions = new ArrayList<QueryOptionImpl>();
+
+ ExpandOptionImpl expand = new ExpandOptionImpl();
+ FilterOptionImpl filter = new FilterOptionImpl();
+ FormatOptionImpl format = new FormatOptionImpl();
+ IdOptionImpl id = new IdOptionImpl();
+ InlineCountOptionImpl inlinecount = new InlineCountOptionImpl();
+ OrderByOptionImpl orderby = new OrderByOptionImpl();
+ SearchOptionImpl search = new SearchOptionImpl();
+ SelectOptionImpl select = new SelectOptionImpl();
+ SkipOptionImpl skip = new SkipOptionImpl();
+ SkipTokenOptionImpl skipToken = new SkipTokenOptionImpl();
+ TopOptionImpl top = new TopOptionImpl();
+ LevelsOptionImpl levels = new LevelsOptionImpl();
+
+ CustomQueryOptionImpl customOption0 = new CustomQueryOptionImpl();
+ customOption0.setText("A");
+ CustomQueryOptionImpl customOption1 = new CustomQueryOptionImpl();
+ customOption1.setText("B");
+
+ QueryOptionImpl queryOption = new QueryOptionImpl();
+
+ queryOptions.add(expand);
+ queryOptions.add(filter);
+ queryOptions.add(format);
+ queryOptions.add(id);
+ queryOptions.add(inlinecount);
+ queryOptions.add(orderby);
+ queryOptions.add(search);
+ queryOptions.add(select);
+ queryOptions.add(skip);
+ queryOptions.add(skipToken);
+ queryOptions.add(top);
+ queryOptions.add(customOption0);
+ queryOptions.add(customOption1);
+ queryOptions.add(levels);//not stored
+ queryOptions.add(queryOption);//not stored
+ uriInfo.setQueryOptions(queryOptions);
+
+ assertEquals(expand, uriInfo.getExpandOption());
+ assertEquals(filter, uriInfo.getFilterOption());
+ assertEquals(format, uriInfo.getFormatOption());
+ assertEquals(id, uriInfo.getIdOption());
+ assertEquals(inlinecount, uriInfo.getInlineCountOption());
+ assertEquals(orderby, uriInfo.getOrderByOption());
+ assertEquals(search, uriInfo.getSearchOption());
+ assertEquals(select, uriInfo.getSelectOption());
+ assertEquals(skip, uriInfo.getSkipOption());
+ assertEquals(skipToken, uriInfo.getSkipTokenOption());
+ assertEquals(top, uriInfo.getTopOption());
+
+ List<CustomQueryOption> customQueryOptions = uriInfo.getCustomQueryOptions();
+ assertEquals(customOption0, customQueryOptions.get(0));
+ assertEquals(customOption1, customQueryOptions.get(1));
+ }
+
+ @Test
+ public void testFragment() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+ uriInfo.setFragment("F");
+ assertEquals("F",uriInfo.getFragment());
+ }
+
+ @Test
+ public void testEntityTypeCast() {
+ UriInfoImpl uriInfo = new UriInfoImpl();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ assertNotNull(entityType);
+
+ uriInfo.setEntityTypeCast(entityType);
+ assertEquals(entityType,uriInfo.getEntityTypeCast());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
new file mode 100644
index 0000000..18c4e8c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java
@@ -0,0 +1,527 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+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.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.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmComplexTypeImpl;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmEntitySetImpl;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmSingletonImpl;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.server.core.uri.UriParameterImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceCountImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceItImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaVarImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceRefImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceRootImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceStartingTypeFilterImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceValueImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.junit.Test;
+
+public class UriParameterImplTest {
+ Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+ @Test
+ public void testUriParameterImpl() {
+ UriParameterImpl impl = new UriParameterImpl();
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+
+ impl.setText("Text");
+ impl.setName("A");
+ impl.setAlias("@A");
+ impl.setExpression(expression);
+
+ assertEquals("Text", impl.getText());
+ assertEquals("A", impl.getName());
+ assertEquals("@A", impl.getAlias());
+ assertEquals(expression, impl.getExression());
+ }
+
+ @Test
+ public void testUriResourceActionImpl() {
+ UriResourceActionImpl impl = new UriResourceActionImpl();
+ assertEquals(UriResourceKind.action, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // action
+ EdmAction action = edm.getAction(EdmTechTestProvider.nameUARTETParam, null, null);
+ impl.setAction(action);
+ assertEquals(action, impl.getAction());
+ assertEquals(EdmTechTestProvider.nameUARTETParam.getName(), impl.toString());
+
+ // action import
+ impl = new UriResourceActionImpl();
+ EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTPrimParam");
+ impl.setActionImport(actionImport);
+ assertEquals(actionImport, impl.getActionImport());
+ assertEquals(actionImport.getAction(), impl.getAction());
+ assertEquals(false, impl.isCollection());
+ assertEquals("AIRTPrimParam", impl.toString());
+ assertEquals(actionImport.getAction().getReturnType().getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceLambdaAllImpl() {
+ UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
+ assertEquals(UriResourceKind.lambdaAll, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("all", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaAnyImpl() {
+ UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
+ assertEquals(UriResourceKind.lambdaAny, impl.getKind());
+
+ ExpressionImpl expression = new LiteralImpl().setText("Expression");
+ impl.setExpression(expression);
+ impl.setLamdaVariable("A");
+
+ assertEquals(false, impl.isCollection());
+ assertEquals(expression, impl.getExpression());
+ assertEquals("A", impl.getLamdaVariable());
+ assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
+ assertEquals("any", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceComplexPropertyImpl() {
+ UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
+ assertEquals(UriResourceKind.complexProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ assertEquals(property.getType(), impl.getComplexType());
+ EdmComplexType complexType = impl.getComplexType(); // must work without cast
+
+ EdmComplexTypeImpl complexTypeImplType =
+ (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
+
+ impl.setTypeFilter(complexTypeImplType);
+ assertEquals(complexTypeImplType, impl.getTypeFilter());
+ assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
+ complexType = impl.getComplexTypeFilter(); // must work without cast
+
+ }
+
+ @Test
+ public void testUriResourcePrimitivePropertyImpl() {
+ UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
+ assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
+ impl.setProperty(property);
+
+ assertEquals(property, impl.getProperty());
+ assertEquals(property.getName(), impl.toString());
+ assertEquals(false, impl.isCollection());
+ assertEquals(property.getType(), impl.getType());
+ }
+
+ @Test
+ public void testUriResourceCountImpl() {
+ UriResourceCountImpl impl = new UriResourceCountImpl();
+ assertEquals(UriResourceKind.count, impl.getKind());
+ assertEquals("$count", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceEntitySetImpl() {
+ UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
+ assertEquals(UriResourceKind.entitySet, impl.getKind());
+
+ EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
+ impl.setEntitSet(entitySet);
+
+ assertEquals("ESAllPrim", impl.toString());
+ assertEquals(entitySet, impl.getEntitySet());
+
+ assertEquals(entitySet.getEntityType(), impl.getType());
+ assertEquals(entitySet.getEntityType(), impl.getEntityType());
+ EdmEntityType entityType = impl.getEntityType(); // must work without cast
+
+ // is Collection
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceFunctionImpl() {
+ UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
+ assertEquals(UriResourceKind.function, impl.getKind());
+ assertEquals("", impl.toString());
+
+ // function
+ EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
+ .getFunction(new ArrayList<String>());
+ assertNotNull(function);
+ impl.setFunction(function);
+
+ assertEquals(function, impl.getFunction());
+ assertEquals("UFNRTInt16", impl.toString());
+ assertEquals(function.getReturnType().getType(), impl.getType());
+
+ // function import
+ impl = new UriResourceFunctionImpl();
+ EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
+ impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
+ assertEquals(functionImport, impl.getFunctionImport());
+ assertEquals("FINRTInt16", impl.toString());
+
+ // function collection
+ impl = new UriResourceFunctionImpl();
+ functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
+ assertNotNull(function);
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ impl.setFunctionImport(functionImport, Arrays.asList(parameter));
+ assertEquals("FICRTESTwoKeyNavParam", impl.toString());
+
+
+ impl.setFunction(functionImport.getFunction(Arrays.asList("ParameterInt16")));
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
+ assertEquals(false, impl.isCollection());
+
+ assertEquals(parameter, impl.getParameters().get(0));
+ }
+
+ @Test
+ public void testUriResourceImplKeyPred() {
+ class Mock extends UriResourceWithKeysImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public Mock setType(EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock", impl.toString(true));
+
+ // set both
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
+ impl.toString(true));
+
+ // set entry
+ // TODO remove ???
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setEntryTypeFilter(entityTypeBaseEntry);
+ assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
+
+ // set collection
+ // TODO remove ???
+ impl = new Mock();
+ impl.setType(entityType);
+ impl.setCollectionTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
+ assertEquals("mock", impl.toString(false));
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+
+ impl = new Mock();
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ impl.setKeyPredicates(keyPredicates);
+ assertNotNull(null, impl.getKeyPredicates());
+
+ }
+
+ @Test
+ public void testUriResourceImplTyped() {
+ class Mock extends UriResourceTypedImpl {
+ EdmType type;
+
+ public Mock() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ public Mock setType(EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "mock";
+ }
+
+ }
+
+ Mock impl = new Mock();
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ impl.setType(entityType);
+ assertEquals("mock", impl.toString());
+ assertEquals("mock", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getTypeFilter());
+ assertEquals("mock", impl.toString());
+ assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
+ assertEquals("mock", impl.toString(false));
+ //
+ }
+
+ @Test
+ public void testUriResourceItImpl() {
+ UriResourceItImpl impl = new UriResourceItImpl();
+ assertEquals(UriResourceKind.it, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$it", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceNavigationPropertyImpl() {
+ UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
+ assertEquals(UriResourceKind.navigationProperty, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
+ assertNotNull(property);
+
+ impl.setNavigationProperty(property);
+ assertEquals(property, impl.getProperty());
+
+ assertEquals("NavPropertyETKeyNavMany", impl.toString());
+ assertEquals(property.getType(), impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceRefImpl() {
+ UriResourceRefImpl impl = new UriResourceRefImpl();
+ assertEquals(UriResourceKind.ref, impl.getKind());
+ assertEquals("$ref", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceRootImpl() {
+ UriResourceRootImpl impl = new UriResourceRootImpl();
+ assertEquals(UriResourceKind.root, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ assertEquals("$root", impl.toString());
+
+ impl.setType(entityType);
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceSingletonImpl() {
+ UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
+ assertEquals(UriResourceKind.singleton, impl.getKind());
+
+ EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
+ EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+ impl.setSingleton(singleton);
+
+ assertEquals("SINav", impl.toString());
+ assertEquals(singleton, impl.getSingleton());
+
+ assertEquals(singleton.getEntityType(), impl.getType());
+ assertEquals(singleton.getEntityType(), impl.getEntityType());
+ EdmEntityType entityType = impl.getEntityType(); // must work without cast
+
+
+ impl.setTypeFilter(entityTypeBaseColl);
+ assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
+
+ // is Collection
+ assertEquals(false, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceValueImpl() {
+ UriResourceValueImpl impl = new UriResourceValueImpl();
+ assertEquals(UriResourceKind.value, impl.getKind());
+ assertEquals("$value", impl.toString());
+ }
+
+ @Test
+ public void testUriResourceLambdaVarImpl() {
+ UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
+ assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
+
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+ impl.setType(entityType);
+ impl.setVariableText("A");
+
+ assertEquals("A", impl.toString());
+ assertEquals(entityType, impl.getType());
+ assertEquals("A", impl.getVariableText());
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ }
+
+ @Test
+ public void testUriResourceStartingTypeFilterImpl () {
+ UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
+ assertEquals(UriResourceKind.startingTypeFilter, impl.getKind());
+
+ EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
+
+
+ impl.setType(entityType);
+ assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString());
+ assertEquals(entityType, impl.getType());
+
+ UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
+ List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
+ keyPredicates.add(parameter);
+
+ assertEquals(false, impl.isCollection());
+ impl.setCollection(true);
+ assertEquals(true, impl.isCollection());
+ impl.setKeyPredicates(keyPredicates);
+ assertEquals(false, impl.isCollection());
+
+ }
+}
[17/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParseTreeVisitor.java
new file mode 100644
index 0000000..92f3427
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParseTreeVisitor.java
@@ -0,0 +1,2181 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.antlr.v4.runtime.misc.ParseCancellationException;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.antlr.v4.runtime.tree.TerminalNodeImpl;
+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.EdmEnumType;
+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.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+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.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserBaseVisitor;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AllExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltAddContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltAllContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltAndContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltAnyContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltBatchContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltComparismContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltEntityCastContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltEntityContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltEqualityContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltHasContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltMetadataContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltMultContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltOrContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AltResourcePathContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AnyExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.BooleanNonCaseContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.CastExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ConstSegmentContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.CrossjoinContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.DateMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EntityOptionCastContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EntityOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EntityOptionsCastContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EntityOptionsContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EnumLitContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandItemContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandRefOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FilterContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FormatContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.IdContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.InlinecountContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.IsofExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.LevelsContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MaxDateTimeMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MemberExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MinDateTimeMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MinuteMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MonthMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValueOptListContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValuePairContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NamespaceContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NullruleContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByItemContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PathSegmentContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PathSegmentsContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PrimitiveLiteralContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.QueryOptionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.QueryOptionsContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ResourcePathContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.RootExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectItemContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SkipContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SkiptokenContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TopContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.UnaryContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
+import org.apache.olingo.odata4.server.core.uri.queryoption.AliasQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.InlineCountOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.LevelsOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectItemImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ConstantImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
+
+/**
+ * UriVisitor
+ *
+ * Converts the URI parse tree from the generate URI parser into an internal representation
+ * which maybe (TODO) given to the application.
+ * While converting the tree is validated against the EDM.
+ *
+ * Attention:
+ * <li> This UriVisitor is at some point more lax than the original ABNF:
+ * <li> It is more tolerable against additional white spaces
+ * - Whenever it is possible to move edm validation to the AST classes then
+ * this should be done ( see visit {@link #visitSelectSegment} for example)
+ *
+ * Not supported
+ * <li>Parsing the context of $metadata
+ *
+ * TODO
+ * <li>clean up
+ * <li>Overview testcases
+ * <li>search
+ * <li>percent decoding
+ *
+ */
+public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
+ private Edm edm;
+
+ private EdmEntityContainer edmEntityContainer;
+
+ private class LambdaVariables {
+ public boolean isCollection;
+ public String name;
+ public EdmType type;
+ }
+
+ /**
+ * Hold all currently allowed lambda variables
+ * As lambda functions can be nested there may be more than one allowed lambda variables at a time while parsing a
+ * $filter or $orderby expressions.
+ */
+ private Stack<LambdaVariables> allowedLambdaVariables = new Stack<LambdaVariables>();
+
+ private class TypeInformation {
+ private boolean isCollection;
+ private EdmType type;
+
+ TypeInformation(final EdmType type, final boolean isCollection) {
+ this.type = type;
+ this.isCollection = isCollection;
+ }
+
+ public TypeInformation() {
+ // TODO Auto-generated constructor stub
+ }
+ }
+
+ /**
+ * Used to stack type information for nested $expand, $filter query options and other cases.
+ */
+ private Stack<TypeInformation> contextTypes = new Stack<TypeInformation>();
+
+ /**
+ * Set within method {@link #visitExpandItem(ExpandPathContext ctx)} and {@link #visitExpandPathExtension(final
+ * ExpandPathExtensionContext ctx)} to allow nodes
+ * deeper in the expand tree at {@link #visitExpandPathExtension(ExpandPathExtensionContext ctx)} appending path
+ * segments to the currently processed {@link ExpandItemImpl}.
+ */
+ private ExpandItemImpl contextExpandItemPath;
+
+ /**
+ * Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes
+ * deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the
+ * currently processed {@link SelectItemImpl}.
+ */
+ private SelectItemImpl contextSelectItem;
+
+ /**
+ * Stores the currently processed UriInfo objects. There is one URI Info object for the resource path
+ * and one for each new first member access within $filter and $orderBy options.
+ */
+ private UriInfoImpl contextUriInfo;
+
+ private boolean contextReadingFunctionParameters = false;
+
+ // --- class ---
+
+ public void init() {
+ allowedLambdaVariables.clear();
+ contextUriInfo = null;
+ contextExpandItemPath = null;
+ contextSelectItem = null;
+ contextTypes.clear();
+ contextUriInfo = null;
+ }
+
+ public UriInfoImpl getUriInfo() {
+ return contextUriInfo;
+ }
+
+ public UriParseTreeVisitor(final Edm edm) {
+ this.edm = edm;
+ edmEntityContainer = edm.getEntityContainer(null);
+ }
+
+ /**
+ * Simple percent decoding
+ * @param encoded string
+ * @return decoded string
+ */
+ String decode(String encoded) {
+ try {
+ return URLDecoder.decode(encoded, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw wrap(new UriParserSyntaxException("Error while decoding"));
+ }
+ }
+
+ private FullQualifiedName getFullNameFromContext(final NamespaceContext vNS, final String odi) {
+ String namespace = decode(vNS.getText());
+ namespace = namespace.substring(0, namespace.length() - 1); // vNS contains a trailing point that has to be removed
+ return new FullQualifiedName(namespace, odi);
+ }
+
+ private LambdaVariables getLambdaVar(final String odi) {
+ for (LambdaVariables item : allowedLambdaVariables) {
+ if (item.name.equals(odi)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ private TypeInformation getTypeInformation(final UriResource lastResourcePart) {
+
+ TypeInformation typeInformation = new TypeInformation();
+ if (lastResourcePart instanceof UriResourceWithKeysImpl) {
+ UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
+
+ if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
+ typeInformation.type = lastPartWithKeys.getTypeFilterOnEntry();
+ } else if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
+ typeInformation.type = lastPartWithKeys.getTypeFilterOnCollection();
+ } else {
+ typeInformation.type = lastPartWithKeys.getType();
+ }
+ typeInformation.isCollection = lastPartWithKeys.isCollection();
+
+ } else if (lastResourcePart instanceof UriResourceTypedImpl) {
+ UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
+
+ if (lastPartTyped.getTypeFilter() != null) {
+ typeInformation.type = lastPartTyped.getTypeFilter();
+ } else {
+ typeInformation.type = lastPartTyped.getType();
+ }
+
+ typeInformation.isCollection = lastPartTyped.isCollection();
+ }
+
+ return typeInformation;
+ }
+
+ public UriResourceTypedImpl readResourcePathSegment(final PathSegmentContext ctx) {
+
+ boolean checkFirst = false;
+ if (contextUriInfo.getLastResourcePart() == null ||
+ contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
+ checkFirst = true;
+ }
+
+ String odi = decode(ctx.vODI.getText());
+
+ if (checkFirst && ctx.vNS == null) {
+
+ // check EntitySet
+ EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
+ if (edmEntitySet != null) {
+ UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl()
+ .setEntitSet(edmEntitySet);
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ }
+
+ // check Singleton
+ EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
+ if (edmSingleton != null) {
+ UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl()
+ .setSingleton(edmSingleton);
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ }
+
+ // check ActionImport
+ EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
+ if (edmActionImport != null) {
+ UriResourceActionImpl uriResource = new UriResourceActionImpl()
+ .setActionImport(edmActionImport);
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ }
+
+ // check FunctionImport
+ EdmFunctionImport edmFunctionImport = edmEntityContainer.getFunctionImport(odi);
+ if (edmFunctionImport != null) {
+
+ // read the URI parameters
+ this.contextReadingFunctionParameters = true;
+ @SuppressWarnings("unchecked")
+ List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
+ this.contextReadingFunctionParameters = false;
+
+ // mark parameters as consumed
+ ctx.vlNVO.remove(0);
+
+ UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl()
+ .setFunctionImport(edmFunctionImport, parameters);
+
+ // collect parameter names
+ List<String> names = new ArrayList<String>();
+ for (UriParameterImpl item : parameters) {
+ names.add(item.getName());
+ }
+
+ // get function from function import
+ EdmFunction function = edmFunctionImport.getFunction(names);
+ if (function == null) {
+ String tmp = "";
+ for (String name : names) {
+ tmp += (tmp.length() != 0 ? "," : "") + name;
+ }
+ throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
+ + "' with parameters [" + tmp + "] not found"));
+ }
+
+ uriResource.setFunction(edmFunctionImport.getFunction(names));
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ }
+ }
+
+ TypeInformation source = null;
+ UriResource lastResourcePart = contextUriInfo.getLastResourcePart();
+
+ if (lastResourcePart == null) {
+ if (contextTypes.size() == 0) {
+ throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
+ + "resource parts"));
+ }
+ source = contextTypes.peek();
+ } else {
+ source = getTypeInformation(lastResourcePart);
+
+ if (source.type == null) {
+ throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
+ + "resource parts"));
+ }
+ }
+
+ if (ctx.vNS == null) { // without namespace
+
+ // first check for lambda variable because a newly add property should not shadow a long used lambda variable
+ LambdaVariables lVar = getLambdaVar(odi);
+ if (lVar != null) {
+ UriResourceLambdaVarImpl lambdaResource = new UriResourceLambdaVarImpl();
+ lambdaResource.setVariableText(lVar.name);
+ lambdaResource.setType(lVar.type);
+ lambdaResource.setCollection(lVar.isCollection);
+ contextUriInfo.addResourcePart(lambdaResource);
+ return null;
+ }
+
+ if (!(source.type instanceof EdmStructuralType)) {
+ throw wrap(new UriParserSemanticException("Can not parse'" + odi
+ + "'Previous path segment not a structural type."));
+ }
+
+ EdmStructuralType structType = (EdmStructuralType) source.type;
+
+ EdmElement property = structType.getProperty(odi);
+ if (property == null) {
+ throw wrap(new UriParserSemanticException("Property '" + odi + "' not found in type '"
+ + structType.getNamespace() + "." + structType.getName() + "'"));
+ }
+
+ if (property instanceof EdmProperty) {
+ if (((EdmProperty) property).isPrimitive() == true) {
+ // create simple property
+ UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
+ .setProperty((EdmProperty) property);
+ contextUriInfo.addResourcePart(simpleResource);
+ return null;
+ } else {
+ // create complex property
+ UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl()
+ .setProperty((EdmProperty) property);
+ contextUriInfo.addResourcePart(complexResource);
+ return null;
+ }
+ } else if (property instanceof EdmNavigationProperty) {
+ // create navigation property
+ UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
+ .setNavigationProperty((EdmNavigationProperty) property);
+ contextUriInfo.addResourcePart(navigationResource);
+ return null;
+ } else {
+ throw wrap(new UriParserSemanticException("Unkown type for property '" + property + "'"));
+ }
+
+ } else { // with namespace
+
+ FullQualifiedName fullFilterName = getFullNameFromContext(ctx.vNS, odi);
+
+ // EdmType lastType = getLastType(lastTyped);
+
+ if (source.type instanceof EdmEntityType) {
+
+ EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
+ if (filterEntityType != null) {
+ // is entity type cast
+ if (!(filterEntityType.compatibleTo(source.type))) {
+ throw wrap(new UriParserSemanticException(
+ "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
+ }
+
+ if (lastResourcePart == null) {
+ // this may be the case if a member expression within a filter starts with a typeCast
+ UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
+ .setType(source.type)
+ .setCollection(source.isCollection);
+ if (source.isCollection) {
+ uriResource.setCollectionTypeFilter(filterEntityType);
+ } else {
+ uriResource.setEntryTypeFilter(filterEntityType);
+ }
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ } else {
+
+ // check if last segment may contain key properties
+ if (lastResourcePart instanceof UriResourceWithKeysImpl) {
+ UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
+
+ if (lastPartWithKeys.isCollection() == false) {
+ if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
+ throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
+ getName(filterEntityType) + "' behind '" +
+ getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+ }
+ lastPartWithKeys.setEntryTypeFilter(filterEntityType);
+ return null;
+ } else {
+ if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
+ throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
+ getName(filterEntityType) + "' behind '" +
+ getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+ }
+ lastPartWithKeys.setCollectionTypeFilter(filterEntityType);
+ return null;
+ }
+ } else if (lastResourcePart instanceof UriResourceTypedImpl) {
+ UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
+ if (lastPartTyped.getTypeFilter() != null) {
+ throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
+ getName(filterEntityType) + "' behind '" +
+ getName(lastPartTyped.getTypeFilter()) + "'"));
+ }
+
+ lastPartTyped.setTypeFilter(filterEntityType);
+ return null;
+ } else {
+ throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterEntityType)
+ + "' not typed"));
+ }
+ }
+ }
+
+ } else if (source.type instanceof EdmComplexType) {
+
+ EdmComplexType filterComplexType = edm.getComplexType(fullFilterName);
+
+ if (filterComplexType != null) {
+
+ // is complex type cast
+ if (!(filterComplexType.compatibleTo(source.type))) {
+ throw wrap(new UriParserSemanticException(
+ "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
+ + getName(filterComplexType) + "'"));
+ }
+
+ // is simple complex type cast
+ if (lastResourcePart == null) {
+ // this may be the case if a member expression within a filter starts with a typeCast
+ UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
+ .setType(source.type)
+ .setCollection(source.isCollection);
+
+ if (source.isCollection) {
+ uriResource.setCollectionTypeFilter(filterComplexType);
+ } else {
+ uriResource.setEntryTypeFilter(filterComplexType);
+ }
+ contextUriInfo.addResourcePart(uriResource);
+ return null;
+ } else {
+ if (lastResourcePart instanceof UriResourceWithKeysImpl) {
+ // e.g. in case of function returning complex data or a list of complex data
+ UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
+
+ if (lastPartWithKeys.isCollection() == false) {
+ if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
+ throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
+ getName(filterComplexType) + "' behind '" +
+ getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
+ }
+ lastPartWithKeys.setEntryTypeFilter(filterComplexType);
+ return null;
+ } else {
+ if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
+ throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
+ getName(filterComplexType) + "' behind '" +
+ getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
+ }
+ lastPartWithKeys.setCollectionTypeFilter(filterComplexType);
+ return null;
+ }
+
+ } else if (lastResourcePart instanceof UriResourceTypedImpl) {
+ UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
+ if (lastPartTyped.getTypeFilter() != null) {
+ throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
+ getName(filterComplexType) + "' behind '" +
+ getName(lastPartTyped.getTypeFilter()) + "'"));
+ }
+
+ lastPartTyped.setTypeFilter(filterComplexType);
+ return null;
+ } else {
+ throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterComplexType)
+ + "' not typed"));
+ }
+ }
+ }
+ }
+
+ FullQualifiedName fullBindingTypeName = new FullQualifiedName(source.type.getNamespace(), source.type.getName());
+
+ // check for action
+ EdmAction action = edm.getAction(fullFilterName, fullBindingTypeName, source.isCollection);
+ if (action != null) {
+ UriResourceActionImpl pathInfoAction = new UriResourceActionImpl();
+ pathInfoAction.setAction(action);
+ contextUriInfo.addResourcePart(pathInfoAction);
+ return null;
+ }
+
+ // do a check for bound functions (which requires a parameter list)
+ if (ctx.vlNVO.size() == 0) {
+ throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
+ + "'"));
+ }
+
+ this.contextReadingFunctionParameters = true;
+ @SuppressWarnings("unchecked")
+ List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
+ this.contextReadingFunctionParameters = false;
+
+ // get names of function parameters
+ List<String> names = new ArrayList<String>();
+ for (UriParameterImpl item : parameters) {
+ names.add(item.getName());
+ }
+
+ EdmFunction function = edm.getFunction(fullFilterName, fullBindingTypeName, source.isCollection, names);
+
+ if (function != null) {
+ UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
+ .setFunction(function)
+ .setParameters(parameters);
+ contextUriInfo.addResourcePart(pathInfoFunction);
+
+ // mark parameters as consumed
+ ctx.vlNVO.remove(0);
+ return null;
+ }
+
+ // check for unbound function in the $filter case ( where the previous resource segment is a $it)
+ function = edm.getFunction(fullFilterName, null, null, names);
+
+ if (function != null) {
+ UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
+ .setFunction(function)
+ .setParameters(parameters);
+ contextUriInfo.addResourcePart(pathInfoFunction);
+
+ // mark parameters as consumed
+ ctx.vlNVO.remove(0);
+ return null;
+ }
+
+ throw wrap(new UriParserSemanticException("Unknown resource path segment:" + fullFilterName.toString()));
+ }
+ }
+
+ private String getName(EdmType type) {
+ return type.getNamespace() + "." + type.getName();
+ }
+
+ @Override
+ public Object visitAliasAndValue(final AliasAndValueContext ctx) {
+ AliasQueryOptionImpl alias = new AliasQueryOptionImpl();
+ alias.setName(decode(ctx.vODI.getText()));
+ alias.setText(decode(ctx.vV.getText()));
+ alias.setAliasValue((ExpressionImpl) ctx.vV.accept(this));
+ return alias;
+ }
+
+ @Override
+ public Object visitAllExpr(final AllExprContext ctx) {
+ UriResourceLambdaAllImpl all = new UriResourceLambdaAllImpl();
+
+ UriResource obj = contextUriInfo.getLastResourcePart();
+ if (!(obj instanceof UriResourcePartTyped)) {
+ throw wrap(new UriParserSemanticException("any only allowed on typed path segments"));
+ }
+
+ LambdaVariables var = new LambdaVariables();
+ var.name = decode(ctx.vLV.getText());
+ var.type = getTypeInformation((UriResourceImpl) obj).type;
+ var.isCollection = false;
+
+ all.setLamdaVariable(decode(ctx.vLV.getText()));
+ allowedLambdaVariables.push(var);
+ all.setExpression((ExpressionImpl) ctx.vLE.accept(this));
+ allowedLambdaVariables.pop();
+ return all;
+ }
+
+ @Override
+ public ExpressionImpl visitAltAdd(final AltAddContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ int tokenIndex = ctx.vO.getType();
+
+ if (tokenIndex == UriLexer.ADD) {
+ binary.setOperator(SupportedBinaryOperators.ADD);
+ } else if (tokenIndex == UriLexer.SUB) {
+ binary.setOperator(SupportedBinaryOperators.SUB);
+ }
+
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+ return binary;
+ }
+
+ @Override
+ public Object visitAltAll(final AltAllContext ctx) {
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAll(ctx));
+
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+ }
+
+ @Override
+ public ExpressionImpl visitAltAnd(final AltAndContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ binary.setOperator(SupportedBinaryOperators.AND);
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+
+ return binary;
+ }
+
+ @Override
+ public Object visitAltAny(final AltAnyContext ctx) {
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAny(ctx));
+
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+ }
+
+ @Override
+ public Object visitAltBatch(final AltBatchContext ctx) {
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.batch);
+ return null;
+ }
+
+ @Override
+ public ExpressionImpl visitAltComparism(final AltComparismContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ int tokenIndex = ctx.vO.getType();
+
+ if (tokenIndex == UriLexer.GT) {
+ binary.setOperator(SupportedBinaryOperators.GT);
+ } else if (tokenIndex == UriLexer.GE) {
+ binary.setOperator(SupportedBinaryOperators.GE);
+ } else if (tokenIndex == UriLexer.LT) {
+ binary.setOperator(SupportedBinaryOperators.LT);
+ } else if (tokenIndex == UriLexer.LE) {
+ binary.setOperator(SupportedBinaryOperators.LE);
+ }
+
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+ return binary;
+ }
+
+ @Override
+ public Object visitAltEntity(final AltEntityContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
+
+ @SuppressWarnings("unchecked")
+ List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
+ uriInfo.setQueryOptions(list);
+
+ contextUriInfo = uriInfo;
+ return null;
+ }
+
+ @Override
+ public Object visitAltEntityCast(final AltEntityCastContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
+
+ String odi = decode(ctx.vODI.getText());
+ FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
+
+ EdmEntityType type = edm.getEntityType(fullName);
+ if (type == null) {
+ throw wrap(new UriParserSemanticException("Expected EntityTypeName"));
+ }
+ uriInfo.setEntityTypeCast(type);
+
+ contextUriInfo = uriInfo;
+ contextTypes.push(new TypeInformation(uriInfo.getEntityTypeCast(), true));
+
+ @SuppressWarnings("unchecked")
+ List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
+ uriInfo.setQueryOptions(list);
+
+ return null;
+ }
+
+ @Override
+ public ExpressionImpl visitAltEquality(final AltEqualityContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ int tokenIndex = ctx.vO.getType();
+
+ if (tokenIndex == UriLexer.EQ_ALPHA) {
+ binary.setOperator(SupportedBinaryOperators.EQ);
+ } else {
+ binary.setOperator(SupportedBinaryOperators.NE);
+ }
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+
+ return binary;
+ }
+
+ @Override
+ public Object visitAltHas(final AltHasContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ binary.setOperator(SupportedBinaryOperators.HAS);
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+
+ return binary;
+ }
+
+ @Override
+ public Object visitAltMetadata(final AltMetadataContext ctx) {
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.metadata);
+
+ if (ctx.vF != null) {
+ FormatOptionImpl format = (FormatOptionImpl) ctx.vF.accept(this);
+ uriInfo.setSystemQueryOption(format);
+ }
+
+ if (ctx.vCF != null) {
+ uriInfo.setFragment(decode(ctx.vCF.getText()));
+ }
+
+ contextUriInfo = uriInfo;
+ return null;
+ }
+
+ @Override
+ public ExpressionImpl visitAltMult(final AltMultContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ int tokenIndex = ctx.vO.getType();
+
+ if (tokenIndex == UriLexer.MUL) {
+ binary.setOperator(SupportedBinaryOperators.MUL);
+ } else if (tokenIndex == UriLexer.DIV) {
+ binary.setOperator(SupportedBinaryOperators.DIV);
+ } else {
+ binary.setOperator(SupportedBinaryOperators.MOD);
+ }
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+
+ return binary;
+ }
+
+ @Override
+ public ExpressionImpl visitAltOr(final AltOrContext ctx) {
+ BinaryImpl binary = new BinaryImpl();
+
+ binary.setOperator(SupportedBinaryOperators.OR);
+ binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
+ binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
+
+ return binary;
+ }
+
+ @Override
+ public Object visitAltResourcePath(final AltResourcePathContext ctx) {
+ ctx.vRP.accept(this);
+
+ if (ctx.vQO != null) {
+ UriResource lastSegment = contextUriInfo.getLastResourcePart();
+
+ if (lastSegment instanceof UriResourcePartTyped) {
+ UriResourcePartTyped typed = (UriResourcePartTyped) lastSegment;
+ contextTypes.push(new TypeInformation(getTypeInformation((UriResourceImpl) typed).type, typed.isCollection()));
+ }
+ @SuppressWarnings("unchecked")
+ List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vQO.accept(this);
+ contextUriInfo.setQueryOptions(list);
+ }
+ return null;
+ }
+
+ @Override
+ public Object visitAnyExpr(final AnyExprContext ctx) {
+ UriResourceLambdaAnyImpl any = new UriResourceLambdaAnyImpl();
+ if (ctx.vLV != null) {
+ // TODO
+ UriResourceImpl lastResourcePart = (UriResourceImpl) contextUriInfo.getLastResourcePart();
+ if (!(lastResourcePart instanceof UriResourcePartTyped)) {
+ throw wrap(new UriParserSemanticException("any only allowed on typed path segments"));
+ }
+
+ LambdaVariables var = new LambdaVariables();
+ var.name = decode(ctx.vLV.getText());
+ var.type = getTypeInformation(lastResourcePart).type;
+ var.isCollection = false;
+
+ any.setLamdaVariable(decode(ctx.vLV.getText()));
+ allowedLambdaVariables.push(var);
+ any.setExpression((ExpressionImpl) ctx.vLE.accept(this));
+ allowedLambdaVariables.pop();
+ }
+ return any;
+ }
+
+ @Override
+ public Object visitBooleanNonCase(BooleanNonCaseContext ctx) {
+ String text = decode(ctx.getText()).toLowerCase();
+
+ if (text.equals("false")) {
+ return new ConstantImpl().setKind(SupportedConstants.FALSE);
+ }
+ return new ConstantImpl().setKind(SupportedConstants.TRUE);
+ }
+
+ @Override
+ public ExpressionImpl visitCastExpr(final CastExprContext ctx) {
+ MethodCallImpl method = new MethodCallImpl();
+ if (ctx.vE1 != null) {
+ // is optional parameter
+ ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
+ method.addParameter(onExpression);
+ }
+
+ String namespace = decode(ctx.vNS.getText());
+ namespace = namespace.substring(0, namespace.length() - 1);
+
+ FullQualifiedName fullName = new FullQualifiedName(namespace, decode(ctx.vODI.getText()));
+ EdmType type = getType(fullName);
+ method.setMethod(SupportedMethodCalls.CAST);
+ method.addParameter(new TypeLiteralImpl().setType(type));
+ return method;
+ }
+
+ private EdmType getType(final FullQualifiedName fullName) {
+ EdmType type = null;
+
+ type = edm.getEntityType(fullName);
+ if (type != null) {
+ return type;
+ }
+
+ type = edm.getComplexType(fullName);
+ if (type != null) {
+ return type;
+ }
+
+ type = edm.getEnumType(fullName);
+ if (type != null) {
+ return type;
+ }
+
+ if (fullName.getNamespace().equals("Edm")) {
+ EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
+ type = typeKind.getEdmPrimitiveTypeInstance();
+ if (type != null) {
+ return type;
+ }
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.CEILING)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.CONCAT)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public Object visitConstSegment(final ConstSegmentContext ctx) {
+ UriInfoImpl uriInfoResource = contextUriInfo;
+ UriResource pathInfo = uriInfoResource.getLastResourcePart();
+
+ if (ctx.vV != null) {
+ if (pathInfo instanceof UriResourcePartTyped) {
+ if (!((UriResourcePartTyped) pathInfo).isCollection()) {
+ contextUriInfo.addResourcePart(new UriResourceValueImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
+ }
+ return null;
+ } else {
+ throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
+ }
+
+ } else if (ctx.vC != null) {
+ if (pathInfo instanceof UriResourcePartTyped) {
+ if (((UriResourcePartTyped) pathInfo).isCollection()) {
+ contextUriInfo.addResourcePart(new UriResourceCountImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$count only allowed on collection properties"));
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("$count only allowed on typed properties"));
+ }
+ } else if (ctx.vR != null) {
+ if (pathInfo instanceof UriResourcePartTyped) {
+ EdmType type = ((UriResourcePartTyped) pathInfo).getType();
+ if (type instanceof EdmEntityType) {
+ contextUriInfo.addResourcePart(new UriResourceRefImpl());
+ } else {
+ throw wrap(new UriParserSemanticException("$ref only allowd on endity types"));
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("$ref only allowed on typed properties"));
+ }
+
+ } else if (ctx.vAll != null) {
+ contextUriInfo.addResourcePart((UriResourceLambdaAllImpl) ctx.vAll.accept(this));
+ } else if (ctx.vAny != null) {
+ contextUriInfo.addResourcePart((UriResourceLambdaAnyImpl) ctx.vAny.accept(this));
+ }
+ return null;
+ }
+
+ @Override
+ public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.CONTAINS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public Object visitCrossjoin(final CrossjoinContext ctx) {
+ UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.crossjoin);
+
+ for (OdataIdentifierContext obj : ctx.vlODI) {
+ crossJoin.addEntitySetName(decode(obj.getText()));
+ }
+
+ contextUriInfo = crossJoin;
+ return null;
+ }
+
+ @Override
+ public Object visitCustomQueryOption(final CustomQueryOptionContext ctx) {
+ CustomQueryOptionImpl queryOption = new CustomQueryOptionImpl();
+ queryOption.setName(decode(ctx.getChild(0).getText()));
+
+ // set value only if present
+ if (ctx.getChildCount() > 1) {
+ queryOption.setText(decode(ctx.getChild(2).getText()));
+ }
+
+ return queryOption;
+ }
+
+ @Override
+ public Object visitDateMethodCallExpr(final DateMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.DATE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.DAY)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.GEODISTANCE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.ENDSWITH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public Object visitEntityOptions(final EntityOptionsContext ctx) {
+ List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
+
+ for (EntityOptionContext entityOption : ctx.vlEOb) {
+ queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
+ }
+
+ queryOptionList.add((QueryOptionImpl) ctx.vlEOm.accept(this));
+
+ for (EntityOptionContext entityOption : ctx.vlEOa) {
+ queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
+ }
+ return queryOptionList;
+ }
+
+ @Override
+ public Object visitEntityOptionsCast(final EntityOptionsCastContext ctx) {
+ List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
+ for (EntityOptionCastContext entityOption : ctx.vlEOb) {
+ queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
+ }
+
+ queryOptionList.add((QueryOptionImpl) ctx.vlEOm.accept(this));
+
+ for (EntityOptionCastContext entityOption : ctx.vlEOa) {
+ queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
+ }
+ return queryOptionList;
+ }
+
+ @Override
+ public Object visitEnumLit(final EnumLitContext ctx) {
+ EnumerationImpl enum1 = new EnumerationImpl();
+
+ // get type
+ String odi = decode(ctx.vODI.getText());
+
+ FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
+ EdmEnumType edmEnumType = edm.getEnumType(fullName);
+
+ enum1.setType(edmEnumType);
+
+ String valueString = decode(ctx.vValues.getText());
+ valueString = valueString.substring(1, valueString.length() - 1);
+
+ String[] values = valueString.split(",");
+ for (String item : values) {
+ enum1.addValue(item);
+ }
+
+ return enum1;
+ }
+
+ @Override
+ public Object visitExpand(final ExpandContext ctx) {
+ ExpandOptionImpl expand = new ExpandOptionImpl();
+ expand.setText(decode(ctx.getChild(2).getText()));
+ for (ExpandItemContext eI : ctx.vlEI) {
+ expand.addExpandItem((ExpandItemImpl) eI.accept(this));
+ }
+
+ return expand;
+ }
+
+ @Override
+ public Object visitExpandItem(final ExpandItemContext ctx) {
+
+ ExpandItemImpl expandItem = null;
+ if (ctx.vS != null) {
+ expandItem = new ExpandItemImpl().setIsStar(true);
+ if (ctx.vR != null) {
+ expandItem.setIsRef(true);
+ } else if (ctx.vM != null) {
+ LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
+ levels.setText(decode(ctx.vM.getText()));
+ expandItem.setSystemQueryOption(levels);
+ } else if (ctx.vL != null) {
+ // TODO set value as integer
+ LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
+ levels.setText(decode(ctx.vL.getText()));
+ expandItem.setSystemQueryOption(levels);
+ }
+
+ } else if (ctx.vEP != null) {
+ expandItem = (ExpandItemImpl) ctx.vEP.accept(this);
+
+ if (ctx.vEPE != null) {
+ ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
+ contextExpandItemPath = expandItem;
+
+ @SuppressWarnings("unchecked")
+ List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
+ for (SystemQueryOptionImpl option : list) {
+ expandItem.setSystemQueryOption(option);
+ }
+ contextExpandItemPath = contextExpandItemPathBU;
+ }
+ }
+
+ return expandItem;
+
+ }
+
+ @Override
+ public Object visitExpandPath(final ExpandPathContext ctx) {
+ ExpandItemImpl expandItem = new ExpandItemImpl();
+
+ // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
+
+ contextUriInfo.getLastResourcePart();
+
+ // save context
+ ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
+ UriInfoImpl uriInfoResourceBU = contextUriInfo;
+
+ // set tmp context
+ contextExpandItemPath = expandItem;
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ // contextUriInfo.addPathInfo(pathInfoIT);
+
+ super.visitExpandPath(ctx);
+ expandItem.setResourceInfo(contextUriInfo);
+
+ // reset context
+ contextUriInfo = uriInfoResourceBU;
+ contextExpandItemPath = contextExpandItemPathBU;
+
+ return expandItem;
+ }
+
+ @Override
+ public Object visitExpandPathExtension(final ExpandPathExtensionContext ctx) {
+ List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
+
+ EdmType targetType = null;
+ boolean isColl = false;
+ if (contextExpandItemPath == null) {
+ // use the type of the last resource path segement
+ UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) contextUriInfo.getLastResourcePart();
+ targetType = getTypeInformation(lastSegment).type;
+ isColl = lastSegment.isCollection();
+ } else {
+ if (contextExpandItemPath.getResourceInfo() == null) {
+ // use the type of the last resource path segement
+ UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) contextUriInfo.getLastResourcePart();
+ targetType = getTypeInformation(lastSegment).type;
+ isColl = lastSegment.isCollection();
+ } else {
+ // use the type of the last ''expand'' path segement
+ UriInfoImpl info = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
+ targetType = getTypeInformation((UriResourceImpl) info.getLastResourcePart()).type;
+ isColl = ((UriResourcePartTyped) info.getLastResourcePart()).isCollection();
+ }
+ }
+
+ contextTypes.push(new TypeInformation(targetType, isColl));
+
+ if (ctx.vC != null) {
+ UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
+ resourcePath.addResourcePart(new UriResourceCountImpl());
+
+ for (ExpandCountOptionContext s : ctx.vlEOC) {
+ list.add((SystemQueryOptionImpl) s.accept(this));
+ }
+ } else if (ctx.vR != null) {
+ UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
+ resourcePath.addResourcePart(new UriResourceRefImpl());
+
+ for (ExpandRefOptionContext s : ctx.vlEOR) {
+ list.add((SystemQueryOptionImpl) s.accept(this));
+ }
+ } else {
+ for (ExpandOptionContext s : ctx.vlEO) {
+ list.add((SystemQueryOptionImpl) s.accept(this));
+ }
+ }
+
+ contextTypes.pop();
+ return list;
+
+ }
+
+ @Override
+ public Object visitFilter(final FilterContext ctx) {
+
+ FilterOptionImpl filter = new FilterOptionImpl().setExpression((ExpressionImpl) ctx.children.get(2).accept(this));
+ return filter;
+ }
+
+ @Override
+ public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.FLOOR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitFormat(final FormatContext ctx) {
+ FormatOptionImpl format = new FormatOptionImpl();
+
+ TerminalNodeImpl c2 = (TerminalNodeImpl) ctx.children.get(2);
+ if (c2.symbol.getType() == UriLexer.ATOM) {
+ format.setFormat("atom");
+ } else if (c2.symbol.getType() == UriLexer.JSON) {
+ format.setFormat("json");
+ } else if (c2.symbol.getType() == UriLexer.XML) {
+ format.setFormat("xml");
+ } else if (c2.symbol.getType() == UriLexer.PCHARS) {
+ if (ctx.getChildCount() == 2) {
+ format.setFormat(decode(c2.getText()));
+ } else {
+ format.setFormat(decode(c2.getText()) + "/" + decode(ctx.children.get(4).getText()));
+ }
+ }
+ String text = decode(ctx.children.get(2).getText());
+ if (ctx.getChildCount() > 4) {
+ text += decode(ctx.children.get(3).getText());
+ text += decode(ctx.children.get(4).getText());
+ }
+
+ format.setText(text);
+
+ return format;
+ }
+
+ @Override
+ public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.FRACTIONALSECONDS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.GEOLENGTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.HOUR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitId(final IdContext ctx) {
+ IdOptionImpl id = new IdOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ return id.setValue(text).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.INDEXOF)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public Object visitInlinecount(final InlinecountContext ctx) {
+ InlineCountOptionImpl inlineCount = new InlineCountOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ return inlineCount.setValue(text.equals("true") ? true : false).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.GEOINTERSECTS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitIsofExpr(final IsofExprContext ctx) {
+ MethodCallImpl method = new MethodCallImpl();
+ if (ctx.vE1 != null) {
+ ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
+ method.addParameter(onExpression);
+ }
+
+ /* TODO improve coding */
+ String namespace = decode(ctx.vNS.getText());
+ namespace = namespace.substring(0, namespace.length() - 1);
+
+ FullQualifiedName fullName = new FullQualifiedName(namespace, decode(ctx.vODI.getText()));
+ EdmType type = getType(fullName);
+ method.setMethod(SupportedMethodCalls.ISOF);
+ method.addParameter(new TypeLiteralImpl().setType(type));
+
+ return method;
+ }
+
+ @Override
+ public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.LENGTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitLevels(LevelsContext ctx) {
+
+ LevelsOptionImpl levels = new LevelsOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ if (text.equals("max")) {
+ levels.setMax();
+ }
+ levels.setText(text);
+ // TODO set value as integer
+
+ return levels;
+
+ }
+
+ @Override
+ public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.MAXDATETIME);
+ }
+
+ @Override
+ public Object visitMemberExpr(final MemberExprContext ctx) {
+
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+
+ TypeInformation lastTypeInfo = contextTypes.peek();
+
+ if (ctx.vIt != null || ctx.vIts != null) {
+ UriResourceItImpl pathInfoIT = new UriResourceItImpl();
+ pathInfoIT.setType(lastTypeInfo.type);
+ pathInfoIT.setCollection(lastTypeInfo.isCollection);
+ uriInfoImplpath.addResourcePart(pathInfoIT);
+ }
+
+ if (ctx.vPs != null) {
+ // save the context
+ UriInfoImpl backupUriInfoPath = contextUriInfo;
+
+ // set temporary uriInfoPath
+ contextUriInfo = uriInfoImplpath;
+
+ ctx.vPs.accept(this);
+
+ // reset context
+ contextUriInfo = backupUriInfoPath;
+ }
+
+ if (ctx.vALL != null) {
+ uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vALL.accept(this));
+ }
+ if (ctx.vANY != null) {
+ uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vANY.accept(this));
+ }
+
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+ }
+
+ @Override
+ public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.MINDATETIME);
+ }
+
+ @Override
+ public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.MINUTE)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.MONTH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitNameValueOptList(final NameValueOptListContext ctx) {
+ if (ctx.vVO != null) {
+
+ // is single key predicate without a name
+ String valueText = decode(ctx.vVO.vV.getText());
+ ExpressionImpl expression = null;
+ try {
+ expression = (ExpressionImpl) ctx.vVO.vV.accept(this);
+ } catch (Exception ex) {
+ throw wrap(new UriParserSemanticException("Invalid key value: " + valueText));
+ }
+
+ // get type of last resource part
+ UriResource last = contextUriInfo.getLastResourcePart();
+ if (!(last instanceof UriResourcePartTyped)) {
+ throw wrap(new UriParserSemanticException("Paramterslist on untyped resource path segement not allowed"));
+ }
+ EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
+
+ // get list of keys for lastType
+ List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
+
+ // if there is exactly one key defined in the EDM, then this key the the key written in the URI,
+ // so fill the keylist with this key and return
+ if (lastKeyPredicates.size() == 1) {
+ String keyName = lastKeyPredicates.get(0);
+ List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
+ list.add(new UriParameterImpl().setName(keyName).setText(valueText).setExpression(expression));
+ return list;
+ }
+
+ // There are more keys defined in the EDM, but only one is written in the URI. This is allowed only if
+ // referential constrains are defined on this navigation property which can be used to will up all required
+ // key.
+
+ // for using referential constrains the last resource part must be a navigation property
+ if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
+ throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
+ }
+ UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
+
+ // get the partner of the navigation property
+ EdmNavigationProperty partner = lastNav.getProperty().getPartner();
+ if (partner == null) {
+ throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
+ }
+
+ // create the keylist
+ List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
+
+ // find the key not filled by referential constrains and collect the other keys filled by
+ // referential constrains
+ String missedKey = null;
+ for (String item : lastKeyPredicates) {
+ String property = partner.getReferencingPropertyName(item);
+ if (property != null) {
+ list.add(new UriParameterImpl().setName(item).setRefencedProperty(property));
+ } else {
+ if (missedKey == null) {
+ missedKey = item;
+ } else {
+ // two of more keys are missing
+ throw wrap(new UriParserSemanticException("Not enougth referntial contrains defined"));
+ }
+ }
+ }
+
+ // the missing key is the one which is defined in the URI
+ list.add(new UriParameterImpl().setName(missedKey).setText(valueText).setExpression(expression));
+
+ return list;
+ } else if (ctx.vNVL != null) {
+
+ List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
+
+ for (ParseTree c : ctx.vNVL.vlNVP) {
+ list.add((UriParameterImpl) c.accept(this));
+ }
+
+ if (contextReadingFunctionParameters) {
+ return list;
+ }
+
+ UriResource last = contextUriInfo.getLastResourcePart();
+ // if the last resource part is a function
+ /*
+ * if (last instanceof UriResourceFunctionImpl) {
+ * UriResourceFunctionImpl function = (UriResourceFunctionImpl) last;
+ * if (!function.isParameterListFilled()) {
+ * return list;
+ * }
+ * }
+ */
+
+ // get type of last resource part
+ if (!(last instanceof UriResourcePartTyped)) {
+ throw wrap(new UriParserSemanticException("Parameterslist on untyped resource path segement not allowed"));
+ }
+ EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
+
+ // get list of keys for lastType
+ List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
+
+ // check if all key are filled from the URI
+ if (list.size() == lastKeyPredicates.size()) {
+ return list;
+ }
+
+ // if not, check if the missing key predicates can be satisfied with help of the defined referential constrains
+
+ // for using referential constrains the last resource part must be a navigation property
+ if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
+ throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
+ }
+ UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
+
+ // get the partner of the navigation property
+ EdmNavigationProperty partner = lastNav.getProperty().getPartner();
+ if (partner == null) {
+ throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
+ }
+
+ // fill missing keys from referential constrains
+ for (String key : lastKeyPredicates) {
+ boolean found = false;
+ for (UriParameterImpl item : list) {
+ if (item.getName().equals(key)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ String property = partner.getReferencingPropertyName(key);
+ if (property != null) {
+ // store the key name as referenced property
+ list.add(0, new UriParameterImpl().setName(key).setRefencedProperty(property));
+ }
+ }
+ }
+
+ // check again if all keyPredicate are filled from the URI
+ if (list.size() == lastKeyPredicates.size()) {
+ return list;
+ }
+
+ throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
+ }
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public UriParameterImpl visitNameValuePair(final NameValuePairContext ctx) {
+ UriParameterImpl uriParameter = new UriParameterImpl();
+ uriParameter.setName(decode(ctx.vODI.getText()));
+
+ if (ctx.vCOM != null) {
+ uriParameter.setText(decode(ctx.vCOM.getText()));
+ uriParameter.setExpression((ExpressionImpl) ctx.vCOM.accept(this));
+ } else {
+ uriParameter.setAlias(decode(ctx.vALI.getText()));
+ }
+
+ return uriParameter;
+ }
+
+ @Override
+ public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.NOW);
+ }
+
+ @Override
+ public Object visitNullrule(NullruleContext ctx) {
+ return new ConstantImpl().setKind(SupportedConstants.NULL);
+ }
+
+ @Override
+ public Object visitOdataRelativeUriEOF(final OdataRelativeUriEOFContext ctx) {
+ contextUriInfo = null;
+ super.visitOdataRelativeUriEOF(ctx);
+ return contextUriInfo;
+ }
+
+ @Override
+ public Object visitOrderBy(final OrderByContext ctx) {
+
+ OrderByOptionImpl orderBy = new OrderByOptionImpl();
+
+ for (OrderByItemContext item : ctx.vlOI) {
+ OrderByItemImpl oItem = (OrderByItemImpl) item.accept(this);
+ orderBy.addOrder(oItem);
+ }
+
+ return orderBy;
+ }
+
+ @Override
+ public Object visitOrderByItem(OrderByItemContext ctx) {
+ OrderByItemImpl oItem = new OrderByItemImpl();
+ if (ctx.vD != null) {
+ oItem.setDescending(true);
+ }
+
+ oItem.setExpression((ExpressionImpl) ctx.vC.accept(this));
+ return oItem;
+ }
+
+ @Override
+ public Object visitPathSegment(final PathSegmentContext ctx) {
+ readResourcePathSegment(ctx);
+ /*
+ * if (contextUriInfo.getLastResourcePart() == null ||
+ * contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
+ *
+ * } else {
+ * readNextPathInfoSegment(ctx);
+ * }
+ */
+ UriResourceImpl pathInfoSegment = (UriResourceImpl) contextUriInfo.getLastResourcePart();
+
+ if (ctx.vlNVO.size() > 0) {
+ // check for keyPredicates
+ if (pathInfoSegment instanceof UriResourceWithKeysImpl) {
+ @SuppressWarnings("unchecked")
+ List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
+ ((UriResourceWithKeysImpl) pathInfoSegment)
+ .setKeyPredicates(list);
+ } else {
+ throw wrap(new UriParserSemanticException("Key properties not allowed"));
+ // throw UriSemanticError.addKrepredicatesNotAllowed();
+ }
+ }
+
+ return pathInfoSegment;
+ }
+
+ @Override
+ public Object visitPathSegments(final PathSegmentsContext ctx) {
+ // path segment
+ for (PathSegmentContext it : ctx.vlPS) {
+ it.accept(this);
+ }
+
+ // const segment
+ if (ctx.vCS != null) {
+ ctx.vCS.accept(this);
+ }
+ return null;
+ }
+
+ @Override
+ public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
+ ParseTree child1 = ctx.children.get(0);
+
+ if (child1 instanceof EnumLitContext ||
+ child1 instanceof BooleanNonCaseContext ||
+ child1 instanceof NullruleContext) {
+ return child1.accept(this);
+ }
+ return new LiteralImpl().setText(decode(ctx.getText()));
+ }
+
+ @Override
+ public Object visitQueryOptions(final QueryOptionsContext ctx) {
+
+ List<QueryOptionImpl> qpList = new ArrayList<QueryOptionImpl>();
+ for (QueryOptionContext entityOption : ctx.vlQO) {
+ qpList.add((QueryOptionImpl) entityOption.accept(this));
+ }
+
+ return qpList;
+ }
+
+ @Override
+ public Object visitResourcePath(final ResourcePathContext ctx) {
+ if (ctx.vAll != null) {
+ contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
+ } else if (ctx.vCJ != null) {
+ ctx.vCJ.accept(this);
+ } else if (ctx.vlPS != null) {
+ UriInfoImpl uriInfoPath = new UriInfoImpl().setKind(UriInfoKind.resource);
+ contextUriInfo = uriInfoPath;
+ super.visitResourcePath(ctx); // visit all children of ctx
+ }
+ return contextUriInfo;
+ }
+
+ @Override
+ public Object visitRootExpr(final RootExprContext ctx) {
+
+ UriResource lastResource = contextUriInfo.getLastResourcePart();
+
+ if (!(lastResource instanceof UriResourcePartTyped)) {
+ throw wrap(new UriParserSemanticException("Resource path not typed"));
+ }
+
+ UriResourcePartTyped lastType = (UriResourcePartTyped) lastResource;
+
+ UriResourceRootImpl pathInfoRoot = new UriResourceRootImpl();
+ pathInfoRoot.setCollection(lastType.isCollection());
+ pathInfoRoot.setType(getTypeInformation((UriResourceImpl) lastType).type);
+
+ UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
+ uriInfoImplpath.addResourcePart(pathInfoRoot);
+
+ if (ctx.vPs != null) {
+ // store the context uriInfoPath
+ UriInfoImpl backupUriInfoPath = contextUriInfo;
+
+ // set temporary uriInfoPath to collect the path information of the memberExpression
+ contextUriInfo = uriInfoImplpath;
+
+ ctx.vPs.accept(this);
+
+ contextUriInfo = backupUriInfoPath;
+
+ }
+ return new MemberImpl()
+ .setPath(uriInfoImplpath);
+
+ }
+
+ @Override
+ public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.ROUND)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.SECOND)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitSelect(final SelectContext ctx) {
+ List<SelectItemImpl> selectItems = new ArrayList<SelectItemImpl>();
+
+ for (SelectItemContext si : ctx.vlSI) {
+ selectItems.add((SelectItemImpl) si.accept(this));
+ }
+
+ return new SelectOptionImpl().setSelectItems(selectItems).setText(decode(ctx.children.get(2).getText()));
+ }
+
+ @Override
+ public Object visitSelectItem(final SelectItemContext ctx) {
+ SelectItemImpl selectItem = new SelectItemImpl();
+
+ contextSelectItem = selectItem;
+ for (SelectSegmentContext si : ctx.vlSS) {
+ si.accept(this);
+ }
+ contextSelectItem = null;
+
+ return selectItem;
+ }
+
+ @Override
+ public Object visitSelectSegment(final SelectSegmentContext ctx) {
+
+ if (ctx.vS != null) {
+ if (ctx.vNS != null) {
+ String namespace = decode(ctx.vNS.getText());
+ namespace = namespace.substring(0, namespace.length() - 1);
+ FullQualifiedName fullName = new FullQualifiedName(namespace, "*");
+ contextSelectItem.addAllOperationsInSchema(fullName);
+ } else {
+ contextSelectItem.setStar(true);
+ }
+ return null;
+ }
+
+ String odi = decode(decode(ctx.vODI.getText()));
+ if (ctx.vNS == null) {
+
+ EdmType prevType = null;
+ if (contextSelectItem.getResourceInfo() == null) {
+ prevType = contextTypes.peek().type;
+ } else {
+ UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ UriResource last = uriInfo.getLastResourcePart();
+ if (!(last instanceof UriResourceTypedImpl)) {
+ throw wrap(new UriParserSemanticException("prev segement typed"));
+ }
+ prevType = getTypeInformation((UriResourceTypedImpl) last).type;
+ }
+
+ if (!(prevType instanceof EdmStructuralType)) {
+ throw wrap(new UriParserSemanticException("Previous select item is not a structural type"));
+ }
+
+ EdmStructuralType structType = (EdmStructuralType) prevType;
+ EdmElement element = structType.getProperty(odi);
+ if (element == null) {
+ throw wrap(new UriParserSemanticException("Previous select item has not property: " + odi));
+ }
+
+ // create new segment
+ // SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
+ // contextSelectItem.addSegment(newSegment);
+ if (element instanceof EdmProperty) {
+ EdmProperty property = (EdmProperty) element;
+ if (property.isPrimitive()) {
+
+ UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
+ simple.setProperty(property);
+
+ UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ if (uriInfo == null) {
+ uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ uriInfo.addResourcePart(simple);
+ contextSelectItem.setResourceInfo(uriInfo);
+ } else {
+ uriInfo.addResourcePart(simple);
+ }
+ return this;
+ } else {
+ UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+
+ UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
+ complex.setProperty(property);
+
+ if (uriInfo == null) {
+ uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ uriInfo.addResourcePart(complex);
+ contextSelectItem.setResourceInfo(uriInfo);
+ } else {
+ uriInfo.addResourcePart(complex);
+ }
+ return this;
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("Only Simple and Complex properties within select allowed"));
+ }
+ } else {
+ String namespace = decode(ctx.vNS.getText());
+ namespace = namespace.substring(0, namespace.length() - 1);
+
+ FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
+ // contextSelectItem.addQualifiedThing(fullName);
+
+ if (contextSelectItem.getResourceInfo() == null) {
+ EdmType prevType = contextTypes.peek().type;
+
+ // check for complex type cast
+ if (prevType instanceof EdmComplexType) {
+ EdmComplexType ct = edm.getComplexType(fullName);
+ if (ct != null) {
+ if ((ct.compatibleTo((EdmStructuralType) prevType))) {
+ UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+ resourcePart.setCollectionTypeFilter(ct);
+
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ uriInfo.addResourcePart(resourcePart);
+ contextSelectItem.setResourceInfo(uriInfo);
+ return this;
+ }
+ }
+ } else if (prevType instanceof EdmEntityType) {
+ EdmEntityType et = edm.getEntityType(fullName);
+ if (et != null) {
+ if ((et.compatibleTo((EdmStructuralType) prevType))) {
+ UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+ resourcePart.setCollectionTypeFilter(et);
+
+ UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
+ uriInfo.addResourcePart(resourcePart);
+ contextSelectItem.setResourceInfo(uriInfo);
+ return this;
+ }
+ }
+ } else {
+ throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
+ }
+
+ } else {
+ UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ UriResource last = uriInfo.getLastResourcePart();
+ if (!(last instanceof UriResourceTypedImpl)) {
+ throw wrap(new UriParserSemanticException("prev segement typed"));
+ }
+ EdmType prevType = getTypeInformation((UriResourceTypedImpl) last).type;
+
+ if (prevType instanceof EdmComplexType) {
+ EdmComplexType ct = edm.getComplexType(fullName);
+ if (ct != null) {
+ if ((ct.compatibleTo((EdmStructuralType) prevType))) {
+ UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+ resourcePart.setCollectionTypeFilter(ct);
+
+ uriInfo.addResourcePart(resourcePart);
+ return this;
+ }
+ }
+ } else if (prevType instanceof EdmEntityType) {
+ throw wrap(new UriParserSemanticException("Error"));
+ /*
+ * EdmEntityType et = edm.getEntityType(fullName);
+ * if (et != null) {
+ * if ((et.compatibleTo((EdmStructuralType) prevType))) {
+ * UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
+ * resourcePart.setEntryTypeFilter(et);
+ *
+ * uriInfo.addResourcePart(resourcePart);
+ * return this;
+ * }
+ * }
+ */
+ } else {
+ throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
+ }
+ }
+
+ EdmType prevType = null;
+ if (contextSelectItem.getResourceInfo() == null) {
+ prevType = contextTypes.peek().type;
+ } else {
+ UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ UriResource last = uriInfo.getLastResourcePart();
+ if (!(last instanceof UriResourceTypedImpl)) {
+ throw wrap(new UriParserSemanticException("prev segement typed"));
+ }
+ prevType = getTypeInformation((UriResourceTypedImpl) last).type;
+ }
+
+ FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
+
+ // check for action
+ EdmAction action = edm.getAction(fullName, finalTypeName, null);
+ // TODO verify that null ignores if it is a collection
+
+ if (action != null) {
+ UriResourceActionImpl uriAction = new UriResourceActionImpl();
+ uriAction.setAction(action);
+
+ UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ resourcePath.addResourcePart(uriAction);
+ }
+
+ // check for function
+ EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
+ // TODO verify that null ignores if it is a collection
+
+ if (function != null) {
+ UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
+ uriFunction.setFunction(function);
+
+ UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
+ resourcePath.addResourcePart(uriFunction);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Object visitSkip(final SkipContext ctx) {
+ SkipOptionImpl skiptoken = new SkipOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ return skiptoken.setValue(text).setText(text);
+ }
+
+ @Override
+ public Object visitSkiptoken(final SkiptokenContext ctx) {
+ SkipTokenOptionImpl skiptoken = new SkipTokenOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ return skiptoken.setValue(text).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.STARTSWITH)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this))
+ .addParameter((ExpressionImpl) ctx.vE2.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitSubstringMethodCallExpr(final SubstringMethodCallExprContext ctx) {
+ MethodCallImpl ret = new MethodCallImpl();
+ ret.setMethod(SupportedMethodCalls.SUBSTRING);
+ ret.addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ ret.addParameter((ExpressionImpl) ctx.vE2.accept(this));
+
+ if (ctx.vE3 != null) {
+ ret.addParameter((ExpressionImpl) ctx.vE3.accept(this));
+ }
+
+ return ret;
+
+ }
+
+ @Override
+ public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TIME)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitTop(final TopContext ctx) {
+ TopOptionImpl top = new TopOptionImpl();
+
+ String text = decode(ctx.children.get(2).getText());
+
+ return top.setValue(text).setText(text);
+ }
+
+ @Override
+ public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TOLOWER)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TOTALOFFSETMINUTES)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TOTALSECONDS)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TOUPPER)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.TRIM)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ @Override
+ public Object visitUnary(final UnaryContext ctx) {
+ // TODO implement
+ return super.visitUnary(ctx);
+ }
+
+ @Override
+ public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
+ return new MethodCallImpl()
+ .setMethod(SupportedMethodCalls.YEAR)
+ .addParameter((ExpressionImpl) ctx.vE1.accept(this));
+ }
+
+ private ParseCancellationException wrap(final UriParserException uriParserException) {
+ return new ParseCancellationException(uriParserException);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
new file mode 100644
index 0000000..826951c
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public UriParserException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UriParserException(final String message) {
+ super(message, null);
+ }
+
+}
[27/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
new file mode 100644
index 0000000..1777cff
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/JsonReader.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import org.apache.olingo.odata4.client.api.deserializer.ConsumerException;
+import org.apache.olingo.odata4.client.api.deserializer.Entity;
+import org.apache.olingo.odata4.client.api.deserializer.EntitySet;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.Reader;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+
+public class JsonReader implements Reader {
+
+ @Override
+ public EntitySet readEntitySet(final InputStream in) throws ConsumerException {
+
+ JsonFactory jsonFactory = new JsonFactory();
+ // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
+ try {
+ JsonParser jp = jsonFactory.createParser(in);
+ EntitySetBuilder entitySet = new EntitySetBuilder(jp);
+ return entitySet.buildEntitySet();
+ } catch (JsonParseException e) {
+ throw new ConsumerException("JSON Parsing failed.", e);
+ } catch (IOException e) {
+ throw new ConsumerException("JSON Parsing failed.", e);
+ }
+ }
+
+ @Override
+ public Entity readEntity(final InputStream in) throws ConsumerException {
+ Entity entity = null;
+
+ JsonFactory jsonFactory = new JsonFactory();
+ // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
+ try {
+ JsonParser jp = jsonFactory.createParser(in);
+ PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
+ builder.parseNext();
+ entity = builder.buildEntity();
+ } catch (JsonParseException e) {
+ throw new ConsumerException("JSON Parsing failed.", e);
+ } catch (IOException e) {
+ throw new ConsumerException("JSON Parsing failed.", e);
+ }
+
+ return entity;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.olingo.core.consumer.Reader#parseProperty(java.io.InputStream)
+ */
+ @Override
+ public Property readProperty(final InputStream in) throws ConsumerException {
+ Entity entity = readEntity(in);
+
+ Map<String, StructuralProperty> properties = entity.getStructuralProperties();
+ if (properties.size() == 1) {
+ return properties.values().iterator().next();
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
new file mode 100644
index 0000000..e69fd37
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/NavigationPropertyImpl.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
+
+public class NavigationPropertyImpl implements NavigationProperty {
+
+ private final String name;
+ private String associationLink;
+ private String navigationLink;
+
+ public NavigationPropertyImpl(final String name) {
+ this.name = parseName(name);
+ }
+
+ public NavigationPropertyImpl(final String name, final String link) {
+ this(name);
+ updateLink(name, link);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getAssociationLink() {
+ return associationLink;
+ }
+
+ @Override
+ public String getNavigationLink() {
+ return navigationLink;
+ }
+
+ public void updateLink(final String name, final String link) {
+ String regexNavigationLink = ".*@odata.navigationLink$";
+ String regexAssociationLink = ".*@odata.associationLink$";
+ if (name.matches(regexNavigationLink)) {
+ navigationLink = link;
+ } else if (name.matches(regexAssociationLink)) {
+ associationLink = link;
+ }
+ }
+
+ private String parseName(final String nameToParse) {
+ String[] split = nameToParse.split("@");
+ if (split.length == 2) {
+ return split[0];
+ } else {
+ throw new IllegalArgumentException("Got OData Navigation with unparseable format '"
+ + nameToParse + "'.");
+ }
+ }
+
+ public void updateLink(final NavigationProperty navigationProperty) {
+ if (navigationProperty.getAssociationLink() != null) {
+ associationLink = navigationProperty.getAssociationLink();
+ }
+ if (navigationProperty.getNavigationLink() != null) {
+ navigationLink = navigationProperty.getNavigationLink();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "NavigationPropertyImpl [name=" + name + ", associationLink=" + associationLink
+ + ", navigationLink=" + navigationLink + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PrimitiveValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PrimitiveValue.java
new file mode 100644
index 0000000..f510c1b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PrimitiveValue.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+
+public class PrimitiveValue implements Value {
+
+ private final Object content;
+
+ public PrimitiveValue(final Object content) {
+ this.content = content;
+ }
+
+ @Override
+ public boolean isComplex() {
+ return false;
+ }
+
+ @Override
+ public Object getContent() {
+ return content;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getContentAs(final T type) {
+ return (T) content;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(content);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
new file mode 100644
index 0000000..ce21036
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollection.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+
+abstract class PropertyCollection {
+ protected Map<String, AnnotationProperty> annotationProperties = new HashMap<String, AnnotationProperty>();
+ protected Map<String, NavigationProperty> navigationProperties = new HashMap<String, NavigationProperty>();
+ protected Map<String, StructuralProperty> structuralProperties = new HashMap<String, StructuralProperty>();
+
+ public PropertyCollection() {}
+
+ protected PropertyCollection(final Map<String, AnnotationProperty> annotationProperties,
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+ this.annotationProperties = annotationProperties;
+ this.navigationProperties = navigationProperties;
+ this.structuralProperties = structuralProperties;
+ }
+
+ public List<Property> getProperties() {
+ int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
+
+ List<Property> properties = new ArrayList<Property>(initialCapacity);
+ properties.addAll(annotationProperties.values());
+ properties.addAll(navigationProperties.values());
+ properties.addAll(structuralProperties.values());
+
+ return properties;
+ }
+
+ public Map<String, AnnotationProperty> getAnnotationProperties() {
+ return Collections.unmodifiableMap(annotationProperties);
+ }
+
+ public Map<String, NavigationProperty> getNavigationProperties() {
+ return Collections.unmodifiableMap(navigationProperties);
+ }
+
+ public Map<String, StructuralProperty> getStructuralProperties() {
+ return Collections.unmodifiableMap(structuralProperties);
+ }
+
+ public void addProperty(final Property property) {
+ if (property == null) {
+ throw new IllegalArgumentException("Property parameter MUST NOT be NULL.");
+ }
+
+ if (property instanceof NavigationPropertyImpl) {
+ NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
+ if (navProperty == null) {
+ navigationProperties.put(property.getName(), (NavigationPropertyImpl) property);
+ } else {
+ NavigationProperty temp = (NavigationProperty) property;
+ navProperty.updateLink(temp);
+ }
+ } else if (property instanceof AnnotationPropertyImpl) {
+ annotationProperties.put(property.getName(), (AnnotationPropertyImpl) property);
+ } else if (property instanceof StructuralProperty) {
+ structuralProperties.put(property.getName(), (StructuralProperty) property);
+ } else {
+ throw new IllegalArgumentException("Unknown class '" + property.getClass() + "'.");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
new file mode 100644
index 0000000..37b1202
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.olingo.odata4.client.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.client.api.deserializer.Entity;
+import org.apache.olingo.odata4.client.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+public class PropertyCollectionBuilder extends PropertyCollection {
+ private JsonParser parser;
+ private EntitySetImpl enclosingEntitySet;
+
+ public PropertyCollectionBuilder(final JsonParser parser) {
+ this.parser = parser;
+ }
+
+ private PropertyCollectionBuilder() {};
+
+ public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
+ this(jp);
+ enclosingEntitySet = entitySet;
+ }
+
+ public Entity buildEntity() {
+ Entity v = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
+ resetProperties();
+ return v;
+ }
+
+ public ComplexValue buildComplexValue() {
+ ComplexValue v = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
+ resetProperties();
+ return v;
+ }
+
+ private void resetProperties() {
+ annotationProperties = new HashMap<String, AnnotationProperty>();
+ navigationProperties = new HashMap<String, NavigationProperty>();
+ structuralProperties = new HashMap<String, StructuralProperty>();
+ }
+
+ private PropertyCollectionBuilder next = null;
+
+ public boolean hasNext() throws JsonParseException, IOException {
+ if (parser.isClosed()) {
+ return false;
+ }
+ next = parseNextObject(parser, this);
+ return (next != null);
+ }
+
+ public boolean parseNext() {
+ try {
+ if (hasNext()) {
+ if (next != null) {
+ return true;
+ }
+
+ if (next == null) {
+ parser.close();
+ return false;
+ }
+ return true;
+ }
+ } catch (JsonParseException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return false;
+
+ }
+
+ /**
+ *
+ * @param jp
+ * @param builder
+ * @return
+ * @throws IOException
+ * @throws JsonParseException
+ */
+ private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
+ throws JsonParseException, IOException {
+ boolean endReached = readToStartObjectOrEnd(jp);
+ if (endReached) {
+ return null;
+ }
+
+ //
+ String currentFieldName = null;
+ List<Value> values = null;
+
+ while (jp.nextToken() != null) {
+ JsonToken token = jp.getCurrentToken();
+ switch (token) {
+ case START_OBJECT:
+ if (currentFieldName != null) {
+ ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
+ if (values == null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
+ } else {
+ values.add(cvp);
+ }
+ }
+ break;
+ case END_OBJECT:
+ return builder;
+ case START_ARRAY:
+ values = new ArrayList<Value>();
+ break;
+ case END_ARRAY:
+ if (values != null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
+ values = null;
+ }
+ break;
+ case FIELD_NAME:
+ currentFieldName = jp.getCurrentName();
+ break;
+ case NOT_AVAILABLE:
+ break;
+ case VALUE_EMBEDDED_OBJECT:
+ break;
+ case VALUE_NULL:
+ Property nullProperty = createProperty(jp.getCurrentName(), null);
+ builder.addProperty(nullProperty);
+ break;
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_STRING:
+ case VALUE_TRUE:
+ if (values == null) {
+ Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
+ builder.addProperty(property);
+ } else {
+ PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
+ values.add(value);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
+ JsonToken endToken = JsonToken.START_OBJECT;
+ JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
+ while (token != null && token != endToken) {
+ if (enclosingEntitySet != null) {
+ switch (token) {
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_TRUE:
+ case VALUE_STRING:
+ enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+ break;
+ default:
+ break;
+ }
+ }
+ //
+ token = jp.nextToken();
+ }
+
+ return token == null;
+ }
+
+ private Property createProperty(final String name, final String value) {
+ if (name.contains("@")) {
+ return new NavigationPropertyImpl(name, value);
+ } else if (name.contains(".")) {
+ return new AnnotationPropertyImpl(name, value);
+ } else {
+ return new StructuralPropertyImpl(name, new PrimitiveValue(value));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.java
new file mode 100644
index 0000000..b83083f
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/StructuralPropertyImpl.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.client.core.deserializer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+
+public class StructuralPropertyImpl implements StructuralProperty {
+
+ private final List<Value> values;
+ private final String name;
+ private final boolean containsCollection;
+
+ public StructuralPropertyImpl(final String name, final Value value) {
+ this(name, false, value);
+ }
+
+ public StructuralPropertyImpl(final String name, final List<Value> values) {
+ // XXX: ugly -> refactore
+ this(name, true, values.toArray(new Value[0]));
+ }
+
+ public StructuralPropertyImpl(final String name, final boolean asCollection, final Value... value) {
+ if (value == null || value.length == 0) {
+ throw new IllegalArgumentException("Missing or NULL value argument.");
+ }
+
+ containsCollection = asCollection;
+ this.name = name;
+ values = new ArrayList<Value>(value.length);
+ for (Value v : value) {
+ values.add(v);
+ }
+ }
+
+ @Override
+ public Value getValue() {
+ return values.get(0);
+ }
+
+ @Override
+ public List<Value> getValues() {
+ return Collections.unmodifiableList(values);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean containsCollection() {
+ return containsCollection;
+ }
+
+ @Override
+ public String toString() {
+ return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
+ + ", values=" + values + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
deleted file mode 100644
index ec61bba..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
+++ /dev/null
@@ -1,33 +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.consumer.core;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.core.ODataCommonsCoreImpl;
-import org.apache.olingo.odata4.consumer.api.ODataConsumer;
-
-public class ODataConsumerImpl extends ODataConsumer {
-
- @Override
- public Edm createEdm(final EdmProvider provider) {
- return new ODataCommonsCoreImpl().createEdm(provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
deleted file mode 100644
index f404f02..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
+++ /dev/null
@@ -1,52 +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.consumer.core.deserializer;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-
-public class AnnotationPropertyImpl implements AnnotationProperty {
-
- private final String name;
- private final String value;
-
- public AnnotationPropertyImpl(final String name, final String value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
deleted file mode 100644
index e50cecf..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
+++ /dev/null
@@ -1,80 +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.consumer.core.deserializer;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-
-public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
-
- public ComplexValueImpl() {}
-
- public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- super(annotationProperties, navigationProperties, structuralProperties);
- }
-
- @Override
- public Value getValue(final String name) {
- StructuralProperty property = structuralProperties.get(name);
- if (property == null) {
- return null;
- }
- return property.getValue();
- }
-
- @Override
- public Map<String, AnnotationProperty> getAnnotationProperties() {
- return Collections.unmodifiableMap(annotationProperties);
- }
-
- @Override
- public Map<String, NavigationProperty> getNavigationProperties() {
- return Collections.unmodifiableMap(navigationProperties);
- }
-
- @Override
- public boolean isComplex() {
- return true;
- }
-
- @Override
- public Map<String, StructuralProperty> getContent() {
- return Collections.unmodifiableMap(structuralProperties);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getContentAs(final T type) {
- return (T) getContent();
- }
-
- @Override
- public String toString() {
- return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
- + ", properties=" + structuralProperties + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntityImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntityImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntityImpl.java
deleted file mode 100644
index dd48083..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntityImpl.java
+++ /dev/null
@@ -1,124 +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.consumer.core.deserializer;
-
-import java.util.Map;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-
-public class EntityImpl extends PropertyCollection implements Entity {
-
- public EntityImpl() {}
-
- public EntityImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- super(annotationProperties, navigationProperties, structuralProperties);
- }
-
- @Override
- public String getODataMetaDataEtag() {
- return getAnnotationValue("odata.metadataEtag");
- }
-
- @Override
- public String getODataType() {
- return getAnnotationValue("odata.type");
- }
-
- @Override
- public Long getODataCount() {
- return Long.valueOf(getAnnotationValue("odata.count"));
- }
-
- @Override
- public String getODataNextLink() {
- return getAnnotationValue("odata.nextLink");
- }
-
- @Override
- public String getODataDeltaLink() {
- return getAnnotationValue("odata.deltaLink");
- }
-
- @Override
- public String getODataReadLink() {
- return getAnnotationValue("odata.readLink");
- }
-
- @Override
- public String getODataContext() {
- return getAnnotationValue("odata.context");
- }
-
- @Override
- public String getODataId() {
- return getAnnotationValue("odata.id");
- }
-
- @Override
- public String getODataETag() {
- return getAnnotationValue("odata.etag");
- }
-
- @Override
- public String getODataEditLink() {
- return getAnnotationValue("odata.editLink");
- }
-
- @Override
- public Object getPropertyContent(final String name) {
- StructuralProperty property = structuralProperties.get(name);
- if (property != null) {
- return property.getValue().getContent();
- }
- return null;
- }
-
- @Override
- public Property getProperty(final String name) {
- Property p = structuralProperties.get(name);
- if (p == null) {
- p = annotationProperties.get(name);
- }
- if (p == null) {
- p = navigationProperties.get(name);
- }
- return p;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends Property> T getProperty(final String name, final Class<T> clazz) {
- Property p = getProperty(name);
- return (T) p;
- }
-
- private String getAnnotationValue(final String key) {
- AnnotationProperty prop = annotationProperties.get(key);
- if (prop == null) {
- return null;
- }
- return prop.getValue();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetBuilder.java
deleted file mode 100644
index 35a98d8..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetBuilder.java
+++ /dev/null
@@ -1,68 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.EntitySet;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-
-public class EntitySetBuilder {
-
- private final JsonParser parser;
-
- public EntitySetBuilder(final JsonParser jp) {
- parser = jp;
- }
-
- public EntitySet buildEntitySet() throws JsonParseException, IOException {
- return parseEntitySet(parser);
- }
-
- private EntitySet parseEntitySet(final JsonParser jp) throws JsonParseException, IOException {
- EntitySetImpl entitySet = new EntitySetImpl();
- boolean arrayStarted = false;
-
- while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
- switch (token) {
- case START_ARRAY:
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
- entitySet.setPropertyCollectionBuilder(builder);
- arrayStarted = true;
- break;
- case START_OBJECT:
- if (arrayStarted) {
- return entitySet;
- }
- break;
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- default:
- break;
- }
- }
-
- return entitySet;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetImpl.java
deleted file mode 100644
index 2b55e4c..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/EntitySetImpl.java
+++ /dev/null
@@ -1,113 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
-import org.apache.olingo.odata4.consumer.api.deserializer.EntitySet;
-
-import com.fasterxml.jackson.core.JsonParseException;
-
-public class EntitySetImpl implements EntitySet, Iterator<Entity> {
-
- private String odataContext;
- private Long odataCount;
- private String odataNextLink;
- private String odataDeltaLink;
- private List<Entity> entities = null;
-
- private PropertyCollectionBuilder propertyCollectionsBuilder;
-
- @Override
- public String getODataContext() {
- return odataContext;
- }
-
- @Override
- public Long getODataCount() {
- return odataCount;
- }
-
- @Override
- public String getODataNextLink() {
- return odataNextLink;
- }
-
- @Override
- public String getODataDeltaLink() {
- return odataDeltaLink;
- }
-
- public void addAnnotation(final String name, final String value) {
- if ("odata.context".equalsIgnoreCase(name)) {
- odataContext = value;
- } else if ("odata.deltaLink".equalsIgnoreCase(name)) {
- odataDeltaLink = value;
- } else if ("odata.count".equalsIgnoreCase(name)) {
- odataCount = Long.parseLong(value);
- } else if ("odata.nextLink".equalsIgnoreCase(name)) {
- odataNextLink = value;
- }
- }
-
- @Override
- public List<Entity> getEntities() {
- if (entities == null) {
- entities = new ArrayList<Entity>();
-
- while (propertyCollectionsBuilder.parseNext()) {
- entities.add(propertyCollectionsBuilder.buildEntity());
- }
- }
-
- return entities;
- }
-
- public void setPropertyCollectionBuilder(final PropertyCollectionBuilder builder) {
- propertyCollectionsBuilder = builder;
- }
-
- @Override
- public boolean hasNext() {
- try {
- return propertyCollectionsBuilder.hasNext();
- } catch (JsonParseException e) {} catch (IOException e) {}
- return false;
- }
-
- @Override
- public Entity next() {
- if (propertyCollectionsBuilder.parseNext()) {
- return propertyCollectionsBuilder.buildEntity();
- }
- return null;
- }
-
- @Override
- public void remove() {}
-
- @Override
- public Iterator<Entity> iterator() {
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReader.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReader.java
deleted file mode 100644
index 2129a92..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReader.java
+++ /dev/null
@@ -1,89 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.ConsumerException;
-import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
-import org.apache.olingo.odata4.consumer.api.deserializer.EntitySet;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.Reader;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-
-public class JsonReader implements Reader {
-
- @Override
- public EntitySet readEntitySet(final InputStream in) throws ConsumerException {
-
- JsonFactory jsonFactory = new JsonFactory();
- // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
- try {
- JsonParser jp = jsonFactory.createParser(in);
- EntitySetBuilder entitySet = new EntitySetBuilder(jp);
- return entitySet.buildEntitySet();
- } catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- } catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- }
- }
-
- @Override
- public Entity readEntity(final InputStream in) throws ConsumerException {
- Entity entity = null;
-
- JsonFactory jsonFactory = new JsonFactory();
- // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
- try {
- JsonParser jp = jsonFactory.createParser(in);
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
- builder.parseNext();
- entity = builder.buildEntity();
- } catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- } catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- }
-
- return entity;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.olingo.core.consumer.Reader#parseProperty(java.io.InputStream)
- */
- @Override
- public Property readProperty(final InputStream in) throws ConsumerException {
- Entity entity = readEntity(in);
-
- Map<String, StructuralProperty> properties = entity.getStructuralProperties();
- if (properties.size() == 1) {
- return properties.values().iterator().next();
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/NavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/NavigationPropertyImpl.java
deleted file mode 100644
index 2a43ca8..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/NavigationPropertyImpl.java
+++ /dev/null
@@ -1,87 +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.consumer.core.deserializer;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-
-public class NavigationPropertyImpl implements NavigationProperty {
-
- private final String name;
- private String associationLink;
- private String navigationLink;
-
- public NavigationPropertyImpl(final String name) {
- this.name = parseName(name);
- }
-
- public NavigationPropertyImpl(final String name, final String link) {
- this(name);
- updateLink(name, link);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getAssociationLink() {
- return associationLink;
- }
-
- @Override
- public String getNavigationLink() {
- return navigationLink;
- }
-
- public void updateLink(final String name, final String link) {
- String regexNavigationLink = ".*@odata.navigationLink$";
- String regexAssociationLink = ".*@odata.associationLink$";
- if (name.matches(regexNavigationLink)) {
- navigationLink = link;
- } else if (name.matches(regexAssociationLink)) {
- associationLink = link;
- }
- }
-
- private String parseName(final String nameToParse) {
- String[] split = nameToParse.split("@");
- if (split.length == 2) {
- return split[0];
- } else {
- throw new IllegalArgumentException("Got OData Navigation with unparseable format '"
- + nameToParse + "'.");
- }
- }
-
- public void updateLink(final NavigationProperty navigationProperty) {
- if (navigationProperty.getAssociationLink() != null) {
- associationLink = navigationProperty.getAssociationLink();
- }
- if (navigationProperty.getNavigationLink() != null) {
- navigationLink = navigationProperty.getNavigationLink();
- }
- }
-
- @Override
- public String toString() {
- return "NavigationPropertyImpl [name=" + name + ", associationLink=" + associationLink
- + ", navigationLink=" + navigationLink + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PrimitiveValue.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PrimitiveValue.java
deleted file mode 100644
index 01e9b61..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PrimitiveValue.java
+++ /dev/null
@@ -1,51 +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.consumer.core.deserializer;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-
-public class PrimitiveValue implements Value {
-
- private final Object content;
-
- public PrimitiveValue(final Object content) {
- this.content = content;
- }
-
- @Override
- public boolean isComplex() {
- return false;
- }
-
- @Override
- public Object getContent() {
- return content;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getContentAs(final T type) {
- return (T) content;
- }
-
- @Override
- public String toString() {
- return String.valueOf(content);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollection.java
deleted file mode 100644
index de5679a..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollection.java
+++ /dev/null
@@ -1,91 +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.consumer.core.deserializer;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-
-abstract class PropertyCollection {
- protected Map<String, AnnotationProperty> annotationProperties = new HashMap<String, AnnotationProperty>();
- protected Map<String, NavigationProperty> navigationProperties = new HashMap<String, NavigationProperty>();
- protected Map<String, StructuralProperty> structuralProperties = new HashMap<String, StructuralProperty>();
-
- public PropertyCollection() {}
-
- protected PropertyCollection(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- this.annotationProperties = annotationProperties;
- this.navigationProperties = navigationProperties;
- this.structuralProperties = structuralProperties;
- }
-
- public List<Property> getProperties() {
- int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
-
- List<Property> properties = new ArrayList<Property>(initialCapacity);
- properties.addAll(annotationProperties.values());
- properties.addAll(navigationProperties.values());
- properties.addAll(structuralProperties.values());
-
- return properties;
- }
-
- public Map<String, AnnotationProperty> getAnnotationProperties() {
- return Collections.unmodifiableMap(annotationProperties);
- }
-
- public Map<String, NavigationProperty> getNavigationProperties() {
- return Collections.unmodifiableMap(navigationProperties);
- }
-
- public Map<String, StructuralProperty> getStructuralProperties() {
- return Collections.unmodifiableMap(structuralProperties);
- }
-
- public void addProperty(final Property property) {
- if (property == null) {
- throw new IllegalArgumentException("Property parameter MUST NOT be NULL.");
- }
-
- if (property instanceof NavigationPropertyImpl) {
- NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
- if (navProperty == null) {
- navigationProperties.put(property.getName(), (NavigationPropertyImpl) property);
- } else {
- NavigationProperty temp = (NavigationProperty) property;
- navProperty.updateLink(temp);
- }
- } else if (property instanceof AnnotationPropertyImpl) {
- annotationProperties.put(property.getName(), (AnnotationPropertyImpl) property);
- } else if (property instanceof StructuralProperty) {
- structuralProperties.put(property.getName(), (StructuralProperty) property);
- } else {
- throw new IllegalArgumentException("Unknown class '" + property.getClass() + "'.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
deleted file mode 100644
index fa92ec4..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
+++ /dev/null
@@ -1,211 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Property;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-
-public class PropertyCollectionBuilder extends PropertyCollection {
- private JsonParser parser;
- private EntitySetImpl enclosingEntitySet;
-
- public PropertyCollectionBuilder(final JsonParser parser) {
- this.parser = parser;
- }
-
- private PropertyCollectionBuilder() {};
-
- public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
- this(jp);
- enclosingEntitySet = entitySet;
- }
-
- public Entity buildEntity() {
- Entity v = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
- resetProperties();
- return v;
- }
-
- public ComplexValue buildComplexValue() {
- ComplexValue v = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
- resetProperties();
- return v;
- }
-
- private void resetProperties() {
- annotationProperties = new HashMap<String, AnnotationProperty>();
- navigationProperties = new HashMap<String, NavigationProperty>();
- structuralProperties = new HashMap<String, StructuralProperty>();
- }
-
- private PropertyCollectionBuilder next = null;
-
- public boolean hasNext() throws JsonParseException, IOException {
- if (parser.isClosed()) {
- return false;
- }
- next = parseNextObject(parser, this);
- return (next != null);
- }
-
- public boolean parseNext() {
- try {
- if (hasNext()) {
- if (next != null) {
- return true;
- }
-
- if (next == null) {
- parser.close();
- return false;
- }
- return true;
- }
- } catch (JsonParseException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return false;
-
- }
-
- /**
- *
- * @param jp
- * @param builder
- * @return
- * @throws IOException
- * @throws JsonParseException
- */
- private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
- throws JsonParseException, IOException {
- boolean endReached = readToStartObjectOrEnd(jp);
- if (endReached) {
- return null;
- }
-
- //
- String currentFieldName = null;
- List<Value> values = null;
-
- while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
- switch (token) {
- case START_OBJECT:
- if (currentFieldName != null) {
- ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
- if (values == null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
- } else {
- values.add(cvp);
- }
- }
- break;
- case END_OBJECT:
- return builder;
- case START_ARRAY:
- values = new ArrayList<Value>();
- break;
- case END_ARRAY:
- if (values != null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
- values = null;
- }
- break;
- case FIELD_NAME:
- currentFieldName = jp.getCurrentName();
- break;
- case NOT_AVAILABLE:
- break;
- case VALUE_EMBEDDED_OBJECT:
- break;
- case VALUE_NULL:
- Property nullProperty = createProperty(jp.getCurrentName(), null);
- builder.addProperty(nullProperty);
- break;
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- case VALUE_TRUE:
- if (values == null) {
- Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
- builder.addProperty(property);
- } else {
- PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
- values.add(value);
- }
- break;
- default:
- break;
- }
- }
-
- return null;
- }
-
- private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
- JsonToken endToken = JsonToken.START_OBJECT;
- JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
- while (token != null && token != endToken) {
- if (enclosingEntitySet != null) {
- switch (token) {
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_TRUE:
- case VALUE_STRING:
- enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- break;
- default:
- break;
- }
- }
- //
- token = jp.nextToken();
- }
-
- return token == null;
- }
-
- private Property createProperty(final String name, final String value) {
- if (name.contains("@")) {
- return new NavigationPropertyImpl(name, value);
- } else if (name.contains(".")) {
- return new AnnotationPropertyImpl(name, value);
- } else {
- return new StructuralPropertyImpl(name, new PrimitiveValue(value));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
deleted file mode 100644
index 5e88417..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
+++ /dev/null
@@ -1,81 +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.consumer.core.deserializer;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-
-public class StructuralPropertyImpl implements StructuralProperty {
-
- private final List<Value> values;
- private final String name;
- private final boolean containsCollection;
-
- public StructuralPropertyImpl(final String name, final Value value) {
- this(name, false, value);
- }
-
- public StructuralPropertyImpl(final String name, final List<Value> values) {
- // XXX: ugly -> refactore
- this(name, true, values.toArray(new Value[0]));
- }
-
- public StructuralPropertyImpl(final String name, final boolean asCollection, final Value... value) {
- if (value == null || value.length == 0) {
- throw new IllegalArgumentException("Missing or NULL value argument.");
- }
-
- containsCollection = asCollection;
- this.name = name;
- values = new ArrayList<Value>(value.length);
- for (Value v : value) {
- values.add(v);
- }
- }
-
- @Override
- public Value getValue() {
- return values.get(0);
- }
-
- @Override
- public List<Value> getValues() {
- return Collections.unmodifiableList(values);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public boolean containsCollection() {
- return containsCollection;
- }
-
- @Override
- public String toString() {
- return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
- + ", values=" + values + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
new file mode 100644
index 0000000..91467fb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/ODataConsumerTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.client.core;
+
+import org.apache.olingo.odata4.client.api.ODataConsumer;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ODataConsumerTest {
+
+ private ODataConsumer consumer;
+
+ @Before
+ public void before() {
+ consumer = ODataConsumer.create();
+ }
+
+ @Test
+ public void edmtest() {
+ EdmProvider provider = null;
+ consumer.createEdm(provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
new file mode 100644
index 0000000..fb7f4a2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/client/core/deserializer/JsonReaderPerformance.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.client.core.deserializer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata4.client.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.client.api.deserializer.Property;
+import org.apache.olingo.odata4.client.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.client.api.deserializer.Value;
+import org.apache.olingo.odata4.client.core.deserializer.JsonReader;
+import org.apache.olingo.odata4.client.core.testutil.StringHelper;
+import org.junit.Test;
+
+public class JsonReaderPerformance {
+
+ @Test
+ public void testComplexPropertyPerformance() throws Exception {
+ JsonReader consumer = new JsonReader();
+ int runs = 1000; // * 100;
+
+ InputStream in = JsonReaderPerformance.class.getResourceAsStream("/complexProperty.json");
+ String content = StringHelper.inputStreamToString(in);
+
+// System.out.println("Started...");
+ ComplexValue complex = null;
+// long startTime = System.currentTimeMillis();
+ for (int i = 0; i < runs; i++) {
+ Property property = consumer.readProperty(StringHelper.encapsulate(content));
+ complex = (ComplexValue) ((StructuralProperty) property).getValue();
+ }
+// long endTime = System.currentTimeMillis();
+
+// long duration = endTime - startTime;
+// System.out.println("Duration: " + duration + " ms");
+// System.out.println("Duration per run: " + (duration / (float) runs) + " ms");
+
+ testComplexProperty(complex);
+ }
+
+ private void testComplexProperty(final Value value) {
+ assertNotNull(value);
+ assertTrue(value.isComplex());
+
+ ComplexValue complex = (ComplexValue) value;
+
+ assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
+ assertEquals("Berlin", complex.getValue("City").getContent());
+ assertNull(complex.getValue("Region").getContent());
+ assertEquals("D-12209", complex.getValue("PostalCode").getContent());
+ }
+}
[07/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
new file mode 100644
index 0000000..41e1181
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
@@ -0,0 +1,1975 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.provider.Action;
+import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
+import org.apache.olingo.odata4.commons.api.edm.provider.AliasInfo;
+import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainerInfo;
+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.FullQualifiedName;
+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.NavigationPropertyBinding;
+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.Target;
+import org.apache.olingo.odata4.commons.api.exception.ODataException;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public class EdmTechProvider extends EdmProvider {
+
+ public static final String nameSpace = "com.sap.odata.test1";
+
+ public static final FullQualifiedName nameBAESAllPrimRTETAllPrim =
+ new FullQualifiedName(nameSpace, "BAESAllPrimRTETAllPrim");
+
+ public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BAESTwoKeyNavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
+
+ public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
+
+ public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BAETTwoKeyNavRTETTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
+ new FullQualifiedName(nameSpace, "BFCCollCTPrimCompRTESAllPrim");
+
+ public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCollStringRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNavParam =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNavParam");
+
+ public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
+ new FullQualifiedName(nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam");
+
+ public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
+ new FullQualifiedName(nameSpace, "BFCESAllPrimRTCTAllPrim");
+
+ public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
+ new FullQualifiedName(nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey");
+
+ public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNav");
+
+ public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
+ new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNavParam");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollString");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCTTwoPrim");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTString =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTString");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTStringParam");
+
+ public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey");
+
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETKeyNavRTETKeyNav");
+
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTCTTwoPrim");
+
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCSINavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFCStringRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
+ new FullQualifiedName(nameSpace, "BFESTwoKeyNavRTESTwoKeyNav");
+
+ public static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
+ public static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
+ public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
+ public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
+ public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(nameSpace, "CTAllPrim");
+ public static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase");
+ public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(nameSpace, "CTBasePrimCompNav");
+ 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");
+ public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(nameSpace, "CTCompNav");
+
+ public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace, "CTMixPrimCollComp");
+ public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(nameSpace, "CTNavFiveProp");
+ public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim");
+ public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(nameSpace, "CTPrimComp");
+ public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(nameSpace, "CTPrimEnum");
+ public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase");
+ public static final FullQualifiedName nameCTTwoBasePrimCompNav =
+ new FullQualifiedName(nameSpace, "CTTwoBasePrimCompNav");
+ 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");
+ public static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey");
+ public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable");
+ public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim");
+ public static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase");
+ public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav");
+ public static final FullQualifiedName nameETBaseTwoKeyTwoPrim =
+ new FullQualifiedName(nameSpace, "ETBaseTwoKeyTwoPrim");
+ public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(nameSpace, "ETCollAllPrim");
+ public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim");
+ public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim");
+ public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp");
+ public static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp");
+ public static final FullQualifiedName nameETCompMixPrimCollComp =
+ new FullQualifiedName(nameSpace, "ETCompMixPrimCollComp");
+ public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(nameSpace, "ETFourKeyAlias");
+ public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(nameSpace, "ETKeyNav");
+ public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(nameSpace, "ETKeyPrimNav");
+ public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp");
+ public static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia");
+ public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp");
+ public static final FullQualifiedName nameETServerSidePaging =
+ new FullQualifiedName(nameSpace, "ETServerSidePaging");
+ public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase");
+ public static final FullQualifiedName nameETTwoBaseTwoKeyNav =
+ new FullQualifiedName(nameSpace, "ETTwoBaseTwoKeyNav");
+ public 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 nameGuid = 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();
+ public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam");
+ public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam");
+ public static final FullQualifiedName nameUARTETCollAllPrimParam =
+ new FullQualifiedName(nameSpace, "UARTETCollAllPrimParam");
+
+ public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
+ public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
+ public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
+ public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
+ new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim");
+ public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam =
+ new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrimParam");
+ public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString");
+ public static final FullQualifiedName nameUFCRTCollStringTwoParam =
+ new FullQualifiedName(nameSpace, "UFCRTCollStringTwoParam");
+ public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam =
+ new FullQualifiedName(nameSpace, "UFCRTCTAllPrimTwoParam");
+ public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim");
+ public static final FullQualifiedName nameUFCRTCTTwoPrimParam =
+ new FullQualifiedName(nameSpace, "UFCRTCTTwoPrimParam");
+ public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam =
+ new FullQualifiedName(nameSpace, "UFCRTESMixPrimCollCompTwoParam");
+ public static final FullQualifiedName nameUFCRTESTwoKeyNavParam =
+ new FullQualifiedName(nameSpace, "UFCRTESTwoKeyNavParam");
+ public static final FullQualifiedName nameUFCRTETAllPrimTwoParam =
+ new FullQualifiedName(nameSpace, "UFCRTETAllPrimTwoParam");
+ public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav");
+ public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia");
+
+ public static final FullQualifiedName nameUFCRTETTwoKeyNavParam =
+ new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParam");
+
+ public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim =
+ new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim");
+
+ public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString");
+
+ public static final FullQualifiedName nameUFCRTStringTwoParam =
+ new FullQualifiedName(nameSpace, "UFCRTStringTwoParam");
+
+ public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam =
+ new FullQualifiedName(nameSpace, "UFNRTESMixPrimCollCompTwoParam");
+ public 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");
+
+ NavigationProperty collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(nameETTwoKeyNav);
+
+ Property collPropertyBinary = new Property()
+ .setName("CollPropertyBinary")
+ .setType(nameBinary)
+ .setCollection(true);
+
+ Property collPropertyBoolean = new Property()
+ .setName("CollPropertyBoolean")
+ .setType(nameBoolean)
+ .setCollection(true);
+
+ Property collPropertyByte = new Property()
+ .setName("CollPropertyByte")
+ .setType(nameByte)
+ .setCollection(true);
+
+ 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(nameDate)
+ .setCollection(true);
+
+ Property collPropertyDateTimeOffset = new Property()
+ .setName("CollPropertyDateTimeOffset")
+ .setType(nameDateTimeOffset)
+ .setCollection(true);
+
+ Property collPropertyDecimal = new Property()
+ .setName("CollPropertyDecimal")
+ .setType(nameDecimal)
+ .setCollection(true);
+
+ Property collPropertyDouble = new Property()
+ .setName("CollPropertyDouble")
+ .setType(nameDouble)
+ .setCollection(true);
+
+ Property collPropertyDuration = new Property()
+ .setName("CollPropertyDuration")
+ .setType(nameDuration)
+ .setCollection(true);
+ Property collPropertyGuid = new Property()
+ .setName("CollPropertyGuid")
+ .setType(nameGuid)
+ .setCollection(true);
+ Property collPropertyInt16 = new Property()
+ .setName("CollPropertyInt16")
+ .setType(nameInt16)
+ .setCollection(true);
+ Property collPropertyInt32 = new Property()
+ .setName("CollPropertyInt32")
+ .setType(nameInt32)
+ .setCollection(true);
+ Property collPropertyInt64 = new Property()
+ .setName("CollPropertyInt64")
+ .setType(nameInt64)
+ .setCollection(true);
+
+ Property collPropertySByte = new Property()
+ .setName("CollPropertySByte")
+ .setType(nameSByte)
+ .setCollection(true);
+
+ Property collPropertySingle = new Property()
+ .setName("CollPropertySingle")
+ .setType(nameSingle)
+ .setCollection(true);
+ Property collPropertyString = new Property()
+ .setName("CollPropertyString")
+ .setType(nameString)
+ .setCollection(true);
+ Property collPropertyTimeOfDay = new Property()
+ .setName("CollPropertyTimeOfDay")
+ .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);
+
+ /*
+ * TODO add stream property
+ * Property propertyStream = new Property()
+ * .setName("PropertyStream")
+ * .setType(EdmStream.getFullQualifiedName());
+ */
+ NavigationProperty navPropertyETKeyPrimNavOne = new NavigationProperty()
+ .setName("NavPropertyETKeyPrimNavOne")
+ .setType(nameETKeyPrimNav);
+
+ NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
+ .setName("NavPropertyETTwoKeyNavOne")
+ .setType(nameETTwoKeyNav);
+ 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);
+ 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);
+ 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);
+ 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(nameGuid);
+
+ Property propertyInt16 = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16);
+
+ Property propertyInt16_NotNullable = new Property()
+ .setName("PropertyInt16")
+ .setType(nameInt16);
+ 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);
+
+ 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);
+
+ Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay")
+ .setType(nameTimeOfDay);
+
+ @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 List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
+ if (actionName.equals(nameUARTPrimParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTPrimParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+
+ .setReturnType(new ReturnType().setType(nameString))
+ );
+
+ } else if (actionName.equals(nameUARTPrimCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTPrimCollParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(nameString).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameUARTCompParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim))
+ );
+
+ } else if (actionName.equals(nameUARTCompCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompCollParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameUARTETParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompCollParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyTwoPrim))
+ );
+
+ } else if (actionName.equals(nameUARTETCollAllPrimParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTETCollAllPrimParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(nameETCollAllPrim).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav))
+ ,
+ new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterETKeyNav").setType(nameETKeyNav)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav))
+ );
+
+ } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
+ return Arrays.asList(
+ new Action().setName("BAESAllPrimRTETAllPrim")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterESAllPrim").setType(nameETAllPrim).setCollection(true)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETAllPrim))
+ );
+
+ } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Action().setName("BAESTwoKeyNavRTESTwoKeyNav")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav).setCollection(true)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
+ return Arrays.asList(
+ new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterETTwoKeyNav").setType(nameETBaseTwoKeyNav)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav))
+ );
+
+ } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
+ return Arrays.asList(
+ new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(nameETTwoBaseTwoKeyNav)))
+ .setBound(true)
+ .setReturnType(
+ new ReturnType().setType(nameETBaseTwoKeyNav))
+ );
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<AliasInfo> getAliasInfos() throws ODataException {
+ return Arrays.asList(
+ new AliasInfo().setAlias("Namespace1_Alias").setNamespace(nameSpace)
+ );
+ }
+
+ @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 add steam property */));
+
+ } 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 add collectionPropertyStream */));
+
+ } else if (complexTypeName.equals(nameCTTwoPrim)) {
+ return new ComplexType()
+ .setName("CTTwoPrim")
+ .setProperties(Arrays.asList(propertyInt16, propertyString));
+
+ } else if (complexTypeName.equals(nameCTCompNav)) {
+ return new ComplexType()
+ .setName("CTCompNav")
+ .setProperties(Arrays.asList(propertyInt16, propertyComplex_CTNavFiveProp));
+
+ } 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")
+ .setBaseType(nameCTTwoPrim)
+ .setProperties(Arrays.asList(
+ new Property()
+ .setName("AdditionalPropString")
+ .setType(new FullQualifiedName("Edm", "String"))));
+
+ } else if (complexTypeName.equals(nameCTTwoBase)) {
+ return new ComplexType()
+ .setName("CTTwoBase")
+ .setBaseType(nameCTBase)
+ .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))
+ .setNavigationProperties((Arrays.asList(
+ collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
+ collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ new NavigationProperty()
+ .setName("NavPropertyETMediaOne")
+ .setType(nameETMedia),
+ new NavigationProperty()
+ .setName("NavPropertyETMediaMany")
+ .setType(nameETMedia).setCollection(true)
+ )));
+
+ } else if (complexTypeName.equals(nameCTBasePrimCompNav)) {
+ return new ComplexType()
+ .setName("CTBasePrimCompNav")
+ .setBaseType(nameCTPrimComp)
+ .setNavigationProperties(Arrays.asList(
+ collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav));
+
+ } else if (complexTypeName.equals(nameCTPrimEnum)) {
+ return new ComplexType()
+ .setName("CTPrimEnum")
+ .setProperties(Arrays.asList(propertyInt16, propertyEnumString_ENString));
+
+ } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
+ return new ComplexType()
+ .setName("CTTwoBasePrimCompNav")
+ .setBaseType(nameCTBasePrimCompNav);
+
+ }
+
+ 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 == nameContainer) {
+ if (name.equals("ESAllPrim")) {
+ return new EntitySet()
+ .setName("ESAllPrim")
+ .setType(nameETAllPrim);
+
+ } else if (name.equals("ESCollAllPrim")) {
+ return new EntitySet()
+ .setName("ESCollAllPrim")
+ .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);
+ } 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);
+ } else if (name.equals("ESFourKeyAlias")) {
+ return new EntitySet()
+ .setName("ESFourKeyAlias")
+ .setType(nameETFourKeyAlias);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
+
+ if (entityTypeName.equals(nameETAllPrim)) {
+ return new EntityType()
+ .setName("ETAllPrim")
+ .setKey(Arrays.asList(
+ new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString,
+ propertyBoolean, propertyByte, propertySByte,
+ propertyInt32, propertyInt64,
+ propertySingle, propertyDouble, propertyDecimal,
+ propertyBinary, propertyDate, propertyDateTimeOffset,
+ propertyDuration, propertyGuid,
+ propertyTimeOfDay /* TODO add stream property */));
+
+ } else if (entityTypeName.equals(nameETCollAllPrim)) {
+ return new EntityType()
+ .setName("ETCollAllPrim")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable,
+ collPropertyString, collPropertyBoolean,
+ collPropertyByte, collPropertySByte,
+ collPropertyInt16, collPropertyInt32, collPropertyInt64,
+ collPropertySingle, collPropertyDouble, collPropertyDecimal,
+ collPropertyBinary, collPropertyDate, collPropertyDateTimeOffset,
+ collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream property */));
+
+ } else if (entityTypeName.equals(nameETTwoPrim)) {
+ return new EntityType()
+ .setName("ETTwoPrim")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString));
+
+ } else if (entityTypeName.equals(nameETMixPrimCollComp)) {
+ return new EntityType()
+ .setName("ETMixPrimCollComp")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, collPropertyString,
+ propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim));
+
+ } else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) {
+ return new EntityType()
+ .setName("ETTwoKeyTwoPrim")
+ .setKey(Arrays.asList(
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyString")))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString));
+
+ } else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) {
+ return new EntityType()
+ .setName("ETBaseTwoKeyTwoPrim")
+ .setBaseType(nameETTwoKeyTwoPrim);
+
+ } else if (entityTypeName.equals(nameETTwoBaseTwoKeyTwoPrim)) {
+ return new EntityType()
+ .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")
+ .setBaseType(nameETBase)
+ .setProperties(Arrays.asList(new Property()
+ .setName("AdditionalPropertyString_6")
+ .setType(nameString))
+ );
+
+ } else if (entityTypeName.equals(nameETAllKey)) {
+ return new EntityType()
+ .setName("ETAllKey")
+ .setKey(Arrays.asList(
+ 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")))
+ .setProperties(Arrays.asList(
+ propertyString, propertyBoolean,
+ propertyByte, propertySByte,
+ propertyInt16, propertyInt32, propertyInt64,
+ propertyDecimal, propertyDate,
+ propertySingle, propertyDouble, propertyDateTimeOffset,
+ propertyDuration, propertyGuid,
+ propertyTimeOfDay /* TODO add stream property */));
+
+ } else if (entityTypeName.equals(nameETCompAllPrim)) {
+ return new EntityType()
+ .setName("ETCompAllPrim")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTAllPrim));
+
+ } else if (entityTypeName.equals(nameETCompCollAllPrim)) {
+ return new EntityType()
+ .setName("ETCompAllPrim")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCollAllPrim));
+
+ } else if (entityTypeName.equals(nameETCompComp)) {
+ return new EntityType()
+ .setName("ETCompComp")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompComp));
+
+ } else if (entityTypeName.equals(nameETCompCollComp)) {
+ return new EntityType()
+ .setName("ETCompCollComp")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompCollComp));
+
+ } else if (entityTypeName.equals(nameETMedia)) {
+ return new EntityType()
+ .setName("ETCompCollComp")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyInt16_NotNullable))
+ .setHasStream(true);
+
+ } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) {
+ return new EntityType()
+ .setName("ETKeyTwoKeyComp")
+ .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")))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp));
+
+ } else if (entityTypeName.equals(nameETServerSidePaging)) {
+ return new EntityType()
+ .setName("ETKeyTwoKeyComp")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString));
+
+ } else if (entityTypeName.equals(nameETAllNullable)) {
+ return new EntityType()
+ .setName("ETAllNullable")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey")))
+ .setProperties(Arrays.asList(
+ new Property()
+ .setName("PropertyKey").setType(nameInt16),
+ propertyInt16,
+ propertyString, propertyBoolean,
+ propertyByte, propertySByte,
+ propertyInt32, propertyInt64,
+ propertySingle, propertyDouble,
+ propertyDecimal, propertyBinary, propertyDate,
+ propertyDateTimeOffset,
+ propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add stream property */,
+ collPropertyString, collPropertyBoolean,
+ collPropertyByte, collPropertySByte,
+ collPropertyInt16,
+ collPropertyInt32, collPropertyInt64,
+ collPropertySingle, collPropertyDouble,
+ collPropertyDecimal, collPropertyBinary, collPropertyDate,
+ collPropertyDateTimeOffset,
+ collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream property */));
+
+ } else if (entityTypeName.equals(nameETKeyNav)) {
+ return new EntityType()
+ .setName("ETKeyNav")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp,
+ propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim,
+ collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp,
+ new Property()
+ .setName("PropertyComplexComplex").setType(nameCTCompNav)
+ ))
+ .setNavigationProperties(Arrays.asList(
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
+ navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia
+ ));
+ } else if (entityTypeName.equals(nameETKeyPrimNav)) {
+ return new EntityType()
+ .setName("ETKeyNav")
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(
+ propertyInt16_NotNullable, propertyString_NotNullable))
+ .setNavigationProperties(Arrays.asList(
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
+ navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
+ navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia
+ ));
+
+ } else if (entityTypeName.equals(nameETTwoKeyNav)) {
+ return new EntityType()
+ .setName("ETTwoKeyNav")
+ .setKey(Arrays.asList(
+ new PropertyRef().setPropertyName("PropertyInt16"),
+ new PropertyRef().setPropertyName("PropertyString")))
+ .setProperties(Arrays.asList(
+ propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable,
+ new Property().setName("PropertyComplexNav").setType(nameCTBasePrimCompNav),
+ propertyComplexEnum_CTPrimEnum_NotNullable,
+ collPropertyComplex_CTPrimComp,
+ new Property().setName("CollPropertyComplexNav").setType(nameCTNavFiveProp).setCollection(true),
+ 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,
+ navPropertyETTwoKeyNavOne_ETTwoKeyNav,
+ collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav));
+
+ } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
+ return new EntityType()
+ .setName("ETBaseTwoKeyNav")
+ .setBaseType(nameETTwoKeyNav)
+ .setProperties(Arrays.asList(propertyDate))
+ .setNavigationProperties(Arrays.asList(
+ new NavigationProperty()
+ .setName("NavPropertyETBaseTwoKeyNav")
+ .setType(nameETBaseTwoKeyNav),
+ new NavigationProperty()
+ .setName("NavPropertyETTwoBaseTwoKeyNav")
+ .setType(nameETTwoBaseTwoKeyNav)))
+ .setHasStream(true);
+
+ } else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) {
+ return new EntityType()
+ .setName("ETTwoBaseTwoKeyNav")
+ .setBaseType(nameETBaseTwoKeyNav)
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(propertyGuid))
+ .setNavigationProperties(Arrays.asList(
+ new NavigationProperty()
+ .setName("NavPropertyETBaseTwoKeyNavOne")
+ .setType(nameETBaseTwoKeyNav),
+ new NavigationProperty()
+ .setName("NavPropertyETBaseTwoKeyNavMany")
+ .setType(nameETBaseTwoKeyNav)
+ .setCollection(true)
+ ));
+
+ } else if (entityTypeName.equals(nameETFourKeyAlias)) {
+ return new EntityType()
+ .setName("ETFourKeyAlias")
+ .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")))
+ .setProperties(Arrays.asList(propertyGuid, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp));
+ }
+
+ 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")));
+ }
+
+ 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 (name.equals("FINInvisibleRTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisibleRTInt16")
+ .setFunction(nameUFNRTInt16);
+
+ } else if (name.equals("FINInvisible2RTInt16")) {
+ return new FunctionImport()
+ .setName("FINInvisible2RTInt16")
+ .setFunction(nameUFNRTInt16);
+
+ } else if (name.equals("FICRTETKeyNav")) {
+ return new FunctionImport()
+ .setName("FICRTETKeyNav")
+ .setFunction(nameUFCRTETKeyNav);
+
+ } else if (name.equals("FICRTETTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTETTwoKeyNavParam")
+ .setFunction(nameUFCRTETTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTStringTwoParam")
+ .setFunction(nameUFCRTStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCollStringTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCollStringTwoParam")
+ .setFunction(nameUFCRTCollStringTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCTAllPrimTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTAllPrimTwoParam")
+ .setFunction(nameUFCRTCTAllPrimTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FICRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFCRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
+ return new FunctionImport()
+ .setName("FINRTESMixPrimCollCompTwoParam")
+ .setFunction(nameUFNRTESMixPrimCollCompTwoParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCollCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCollCTTwoPrim")
+ .setFunction(nameUFCRTCollCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTETMedia")) {
+ return new FunctionImport()
+ .setName("FICRTETMedia")
+ .setFunction(nameUFCRTETMedia)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCTTwoPrimParam")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrimParam")
+ .setFunction(nameUFCRTCTTwoPrimParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCTTwoPrim")) {
+ return new FunctionImport()
+ .setName("FICRTCTTwoPrim")
+ .setFunction(nameUFCRTCTTwoPrim)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCollString")) {
+ return new FunctionImport()
+ .setName("FICRTCollString")
+ .setFunction(nameUFCRTCollString)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTString")) {
+ return new FunctionImport()
+ .setName("FICRTString")
+ .setFunction(nameUFCRTString)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTESTwoKeyNavParam")) {
+ return new FunctionImport()
+ .setName("FICRTESTwoKeyNavParam")
+ .setFunction(nameUFCRTESTwoKeyNavParam)
+ .setIncludeInServiceDocument(true);
+
+ } else if (name.equals("FICRTCollCTTwoPrimParam")) {
+ return new FunctionImport()
+ .setName("FICRTCollCTTwoPrimParam")
+ .setFunction(nameUFCRTCollCTTwoPrimParam)
+ .setIncludeInServiceDocument(true);
+
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
+
+ if (functionName.equals(nameUFNRTInt16)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTInt16")
+ .setParameters(new ArrayList<Parameter>())
+ .setReturnType(
+ new ReturnType().setType(nameString))
+ );
+
+ } else if (functionName.equals(nameUFCRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETKeyNav")
+ .setParameters(new ArrayList<Parameter>())
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav))
+ );
+
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETTwoKeyNavParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav)
+ )
+ );
+
+ } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETTwoKeyNavParamCTTwoPrim")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterCTTwoPrim").setType(nameCTTwoPrim)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav)
+ )
+ );
+
+ } else if (functionName.equals(nameUFCRTStringTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTStringTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString)),
+ new Function()
+ .setName("UFCRTStringTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterString")
+ .setType(nameString),
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString))
+
+ );
+
+ } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTESTwoKeyNavParam")
+ .setParameters(Arrays.asList(
+ new Parameter()
+ .setName("ParameterInt16")
+ .setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTString")
+
+ .setComposable(true)
+ .setParameters(new ArrayList<Parameter>())
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString)
+ )
+ );
+
+ } else if (functionName.equals(nameUFCRTCollStringTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollStringTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTCollString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollString")
+ .setParameters(new ArrayList<Parameter>())
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTAllPrimTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTAllPrim))
+ );
+
+ } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrimParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim))
+ );
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollCTTwoPrimParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrim")
+ .setParameters(new ArrayList<Parameter>())
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim))
+ );
+
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCTTwoPrim")
+
+ .setParameters(new ArrayList<Parameter>())
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTETMedia)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETMedia")
+ .setParameters(new ArrayList<Parameter>())
+ .setReturnType(
+ new ReturnType().setType(nameETMedia))
+ );
+
+ } else if (functionName.equals(nameUFCRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTString")
+ .setParameters(new ArrayList<Parameter>())
+ .setReturnType(new ReturnType()
+ .setType(nameString)
+ )
+ );
+
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTCollCTTwoPrim")
+ .setComposable(true)
+ .setParameters(new ArrayList<Parameter>())
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFNRTESMixPrimCollCompTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(false)
+ .setReturnType(
+ new ReturnType().setType(nameETMixPrimCollComp).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTETAllPrimTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETAllPrim))
+ );
+
+ } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("UFCRTESMixPrimCollCompTwoParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterString").setType(nameString),
+ new Parameter().setName("ParameterInt16").setType(nameInt16)
+ ))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETMixPrimCollComp).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
+
+ new Function()
+ .setName("BFCESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true),
+ new Parameter().setName("ParameterString").setType(nameString).setCollection(false)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
+ new Function()
+ .setName("BFCESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
+ new Function()
+ .setName("BFCESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(
+ Arrays.asList(new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true),
+ new Parameter().setName("ParameterString").setType(nameString).setCollection(false)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function().setName("BFCStringRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameString)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav)
+ )
+ );
+
+ } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)
+ .setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESAllPrimRTCTAllPrim")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETAllPrim).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTAllPrim))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCTTwoPrim")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTString")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTCollString")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCSINavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCollStringRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameString).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTESBaseTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCollCTPrimCompRTESAllPrim")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETAllPrim).setCollection(true))
+ );
+
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav))
+ );
+
+ } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESKeyNavRTETKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav))
+ );
+
+ } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETKeyNavRTETKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav))
+ );
+ } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFESTwoKeyNavRTESTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
+ .setComposable(true)
+ .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+
+ );
+
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTETTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav))
+ );
+
+ } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCETTwoKeyNavRTCTTwoPrim")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim))
+ );
+ } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESTwoKeyNavRTStringParam")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true),
+ new Parameter().setName("ParameterComplex").setType(nameCTTwoPrim)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameString))
+ );
+
+ } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCESKeyNavRTETKeyNavParam")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true),
+ new Parameter().setName("ParameterString").setType(nameString)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETKeyNav))
+ );
+ } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTETTwoKeyNavParam")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp),
+ new Parameter().setName("ParameterString").setType(nameString)))
+ .setComposable(true)
+ .setReturnType(new ReturnType()
+ .setType(nameETTwoKeyNav)
+ )
+ );
+ } else if (functionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BAETTwoKeyNavRTETTwoKeyNav")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameInt16).setCollection(true),
+ new Parameter().setName("ParameterString").setType(nameString).setNullable(true)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
+ );
+ } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) {
+ return Arrays.asList(
+ new Function()
+ .setName("BFCCTPrimCompRTESTwoKeyNavParam")
+ .setBound(true)
+ .setParameters(Arrays.asList(
+ new Parameter().setName("BindingParam").setType(nameCTPrimComp),
+ new Parameter().setName("ParameterString").setType(nameString)))
+ .setComposable(true)
+ .setReturnType(
+ new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
+ );
+ }
+
+ return null;
+ }
+
+ @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("SINav")
+ .setType(nameETTwoKeyNav)
+ .setNavigationPropertyBindings(Arrays.asList(
+ new NavigationPropertyBinding()
+ .setPath("NavPropertyETTwoKeyNavMany")
+ .setTarget(new Target().setTargetName("ESTwoKeyNav"))));
+
+ } else if (name.equals("SIMedia")) {
+ return new Singleton()
+ .setName("SIMedia")
+ .setType(nameETMedia);
+ }
+ }
+ return null;
+ };
+}
[13/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
deleted file mode 100644
index 4df8654..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechTestProvider.java
+++ /dev/null
@@ -1,95 +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.testutil;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
-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.FullQualifiedName;
-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.exception.ODataException;
-
-
-/**
- * Implement the EdmTechProvider and
- * <li>adds a entity type <b>ETabc with</b> properties a,b,c,d,e,f</li>
- * <li>adds a complex type <b>CTabc</b> with properties a,b,c,d,e,f</li>
- * <li>adds a <b>abc</b> entity set of type <b>ETabc</b></li>
- */
-public class EdmTechTestProvider extends EdmTechProvider {
-
- Property propertyAInt16 = new Property().setName("a").setType(nameInt16);
- Property propertyBInt16 = new Property().setName("b").setType(nameInt16);
- Property propertyCInt16 = new Property().setName("c").setType(nameInt16);
- Property propertyDInt16 = new Property().setName("d").setType(nameInt16);
- Property propertyEInt16 = new Property().setName("e").setType(nameInt16);
- Property propertyFInt16 = new Property().setName("f").setType(nameInt16);
-
- public static final FullQualifiedName nameCTabc = new FullQualifiedName(nameSpace, "CTabc");
- public static final FullQualifiedName nameETabc = new FullQualifiedName(nameSpace, "ETabc");
-
- @Override
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- if (complexTypeName.equals(nameCTabc)) {
- return new ComplexType()
- .setName("CTabc")
- .setProperties(Arrays.asList(
- propertyAInt16, propertyBInt16, propertyCInt16,
- propertyDInt16, propertyEInt16, propertyFInt16
- ));
-
- }
-
- return super.getComplexType(complexTypeName);
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer == nameContainer) {
- if (name.equals("ESabc")) {
- return new EntitySet()
- .setName("ESabc")
- .setType(nameETabc);
- }
- }
-
- return super.getEntitySet(entityContainer, name);
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("a"));
-
- if (entityTypeName.equals(nameETabc)) {
- return new EntityType()
- .setName("ETabc")
- .setProperties(Arrays.asList(
- propertyAInt16, propertyBInt16, propertyCInt16,
- propertyDInt16, propertyEInt16, propertyFInt16))
- .setKey(oneKeyPropertyInt16);
- }
-
- return super.getEntityType(entityTypeName);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
deleted file mode 100644
index a6cb095..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ExpandValidator.java
+++ /dev/null
@@ -1,208 +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.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-
-public class ExpandValidator implements Validator {
- private Edm edm;
- private Validator invokedByValidator;
-
- private int expandItemIndex;
- private ExpandOptionImpl expandOption;
- private ExpandItem expandItem;
-
- // --- Setup ---
-
- public ExpandValidator setGoUpValidator(final Validator parentValidator) {
- invokedByValidator = parentValidator;
- return this;
- }
-
- public ExpandValidator setExpand(final ExpandOptionImpl expand) {
- expandOption = expand;
- first();
- return this;
- }
-
- public ExpandValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- // --- Navigation ---
-
- public UriResourceValidator goPath() {
- UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourceInfo();
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("goPath() can only be used on UriInfoKind.resource");
- }
-
- return new UriResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
-
- }
-
- public UriResourceValidator goSelectItemPath(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo();
-
- return new UriResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
-
- }
-
-
-
- public ExpandValidator goExpand() {
- ExpandValidator val = new ExpandValidator();
- val.setExpand((ExpandOptionImpl) expandItem.getExpandOption());
- val.setGoUpValidator(this);
- return val;
- }
-
- public ExpandValidator goUpToExpandValidator() {
- return (ExpandValidator) invokedByValidator;
- }
-
- public UriResourceValidator goUpToUriResourceValidator() {
- return (UriResourceValidator) invokedByValidator;
- }
-
- public ExpandValidator first() {
- expandItemIndex = 0;
- expandItem = expandOption.getExpandItems().get(expandItemIndex);
- return this;
- }
-
- public ExpandValidator next() {
- expandItemIndex++;
-
- try {
- expandItem = expandOption.getExpandItems().get(expandItemIndex);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segments");
- }
- return this;
-
- }
-
- public ExpandValidator isSegmentStar(final int index) {
- assertEquals(true, expandItem.isStar());
- return this;
- }
-
- public ExpandValidator isSegmentRef(final int index) {
- assertEquals(true, expandItem.isRef());
- return this;
- }
-
- public ExpandValidator isLevelText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSkipText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isTopText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isInlineCountText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getInlineCountOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSelectText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSelectItemStar(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(true, item.isStar());
- return this;
- }
-
- public ExpandValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
- SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-
-
- public ExpandValidator isFilterText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isFilterSerialized(final String serialized) {
- FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilterOption();
-
- try {
- String tmp = FilterTreeToText.Serialize(filter);
- assertEquals(serialized, tmp);
- } catch (ExceptionVisitExpression e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- } catch (ODataApplicationException e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
deleted file mode 100644
index 62409af..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterTreeToText.java
+++ /dev/null
@@ -1,161 +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.testutil;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.UriResource;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-
-public class FilterTreeToText implements ExpressionVisitor<String> {
-
- public static String Serialize(final FilterOption filter)
- throws ExceptionVisitExpression, ODataApplicationException {
-
- Expression expression = filter.getExpression();
- return expression.accept(new FilterTreeToText());
- }
-
- public static String Serialize(final Expression expression)
- throws ExceptionVisitExpression, ODataApplicationException {
-
- return expression.accept(new FilterTreeToText());
- }
-
- @Override
- public String visitBinaryOperator(final SupportedBinaryOperators operator, final String left, final String right)
- throws ExceptionVisitExpression {
-
- return "<" + left + " " + operator.toString() + " " + right + ">";
- }
-
- @Override
- public String visitUnaryOperator(final SupportedUnaryOperators operator, final String operand)
- throws ExceptionVisitExpression {
-
- return "<" + operator + " " + operand.toString() + ">";
- }
-
- @Override
- public String visitMethodCall(final SupportedMethodCalls methodCall, final List<String> parameters)
- throws ExceptionVisitExpression {
-
- String text = "<" + methodCall + "(";
- int i = 0;
- while (i < parameters.size()) {
- if (i > 0) {
- text += ",";
- }
- text += parameters.get(i);
- i++;
- }
- return text + ")>";
- }
-
- @Override
- public String visitLiteral(final String literal) throws ExceptionVisitExpression {
- return "<" + literal + ">";
- }
-
- @Override
- public String visitMember(final UriInfoResource resource) throws ExceptionVisitExpression, ODataApplicationException {
- String ret = "";
-
- UriInfoResource path = resource;
-
- for (UriResource item : path.getUriResourceParts()) {
- String tmp = "";
- if (item instanceof UriResourceLambdaAll) {
- UriResourceLambdaAll all = (UriResourceLambdaAll) item;
- tmp = visitLambdaExpression("ALL", all.getLamdaVariable(), all.getExpression());
- } else if (item instanceof UriResourceLambdaAny) {
- UriResourceLambdaAny any = (UriResourceLambdaAny) item;
- // TODO create enum
- tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
- } else if (item instanceof UriResourcePartTyped) {
- UriResourcePartTyped typed = (UriResourcePartTyped) item;
- tmp = typed.toString(true);
- }
-
- if (ret.length() != 0) {
- ret += "/";
- }
- ret += tmp;
-
- }
- return "<" + ret + ">";
- }
-
- @Override
- public String visitAlias(final String referenceName) throws ExceptionVisitExpression {
- return "<" + referenceName + ">";
- }
-
- @Override
- public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
- throws ExceptionVisitExpression, ODataApplicationException {
-
- return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
- }
-
- @Override
- public String visitTypeLiteral(final EdmType type) {
- return "<" + type.getNamespace() + "." + type.getName() + ">";
- }
-
- @Override
- public String visitLambdaReference(final String variableText) {
- return "<" + variableText + ">";
- }
-
- @Override
- public String visitEnum(final EdmEnumType type, final List<String> enumValues)
- throws ExceptionVisitExpression, ODataApplicationException {
- String tmp = "";
-
- for (String item : enumValues) {
- if (tmp.length() > 0) {
- tmp += ",";
- }
- tmp += item;
- }
-
- return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
- }
-
- @Override
- public String visitConstant(SupportedConstants kind) throws ExceptionVisitExpression, ODataApplicationException {
- // TODO Auto-generated method stub
- return "<" + kind.toString() + ">";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
deleted file mode 100644
index 951814b..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
+++ /dev/null
@@ -1,491 +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.testutil;
-
-import static org.junit.Assert.assertEquals;
-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.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.core.uri.Parser;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.apache.olingo.odata4.producer.core.uri.UriParserSemanticException;
-import org.apache.olingo.odata4.producer.core.uri.UriParserSyntaxException;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ConstantImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.EnumerationImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MethodCallImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLiteralImpl;
-
-public class FilterValidator implements Validator {
- private Edm edm;
-
- private Validator invokedByValidator;
- private FilterOptionImpl filter;
-
- private Expression curExpression;
- private Expression rootExpression;
-
- private OrderByOptionImpl orderBy;
-
- private UriParserException exception;
-
- // --- Setup ---
- public FilterValidator setUriResourcePathValidator(final UriResourceValidator uriResourcePathValidator) {
- invokedByValidator = uriResourcePathValidator;
- return this;
- }
-
- public FilterValidator setUriValidator(final UriValidator uriValidator) {
- invokedByValidator = uriValidator;
- return this;
- }
-
- public FilterValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public FilterValidator setFilter(final FilterOptionImpl filter) {
- this.filter = filter;
-
- if (filter.getExpression() == null) {
- fail("FilterValidator: no filter found");
- }
- setExpression(filter.getExpression());
- return this;
- }
-
- public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
- this.orderBy = orderBy;
-
- return this;
- }
-
- public FilterValidator setExpression(final Expression expression) {
- rootExpression = curExpression = expression;
- return this;
- }
-
- // --- Execution ---
-
- public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
- String uri = "ESAllPrim?$orderby=" + orderBy.trim();
- return runUriOrderBy(uri);
- }
-
- public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
- String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
- return runUriOrderBy(uri);
- }
-
- public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
- String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
- return runUriOrderByEx(uri);
- }
-
- public FilterValidator runOnETTwoKeyNav(final String filter) throws UriParserException {
- // TODO change to ESTwoKeyNav
- String uri = "SINav?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
- // TODO change to ESTwoKeyNav
- String uri = "SINav?$filter=" + filter.trim();
- return runUriEx(uri);
- }
-
- public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
- String uri = "ESAllPrim(1)?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
- String uri = "ESKeyNav(1)?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnETKeyNavEx(final String filter) throws UriParserException {
- String uri = "ESKeyNav(1)?$filter=" + filter.trim();
- return runUriEx(uri);
- }
-
- public FilterValidator runOnCTTwoPrim(final String filter) throws UriParserException {
- String uri = "SINav/PropertyComplexTwoPrim?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnString(final String filter) throws UriParserException {
- String uri = "SINav/PropertyString?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnInt32(final String filter) throws UriParserException {
- String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
- String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnDuration(final String filter) throws UriParserException {
- String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
- String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runESabc(final String filter) throws UriParserException {
- String uri = "ESabc?$filter=" + filter.trim();
- return runUri(uri);
- }
-
- public FilterValidator runUri(final String uri) throws UriParserException {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setFilter((FilterOptionImpl) uriInfo.getFilterOption());
- curExpression = filter.getExpression();
- return this;
- }
-
- public FilterValidator runUriEx(final String uri) {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- try {
- uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
- } catch (UriParserException e) {
- this.exception = e;
- return this;
- }
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setFilter((FilterOptionImpl) uriInfo.getFilterOption());
- curExpression = filter.getExpression();
- return this;
- }
-
- public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
- return this;
- }
-
- public FilterValidator runUriOrderByEx(final String uri) {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- try {
- uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
- } catch (UriParserException e) {
- this.exception = e;
- return this;
- }
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
- return this;
- }
-
-
- // --- Navigation ---
-
- public Validator goUp() {
- return invokedByValidator;
- }
-
- public UriResourceValidator goPath() {
- if (!(curExpression instanceof MemberImpl)) {
- fail("Current expression not a member");
- }
-
- MemberImpl member = (MemberImpl) curExpression;
- UriResourceValidator uriValidator = new UriResourceValidator();
- uriValidator.setEdm(edm);
- uriValidator.setUriInfoImplPath((UriInfoImpl) member.getPath());
- uriValidator.setUpValidator(this);
- return uriValidator;
- }
-
- public FilterValidator goParameter(final int parameterIndex) {
- if (curExpression instanceof MethodCallImpl) {
- MethodCallImpl methodCall = (MethodCallImpl) curExpression;
-
- curExpression = methodCall.getParameters().get(parameterIndex);
- } else {
- fail("Current expression not a methodCall");
- }
- return this;
- }
-
- // --- Validation ---
-
- /**
- * Validates the serialized filterTree against a given filterString
- * The given expected filterString is compressed before to allow better readable code in the unit tests
- * @param toBeCompr
- * @return
- */
- public FilterValidator isCompr(final String toBeCompr) {
- return is(compress(toBeCompr));
- }
-
- public FilterValidator is(final String expectedFilterAsString) {
- try {
- String actualFilterAsText = FilterTreeToText.Serialize((FilterOptionImpl) filter);
- assertEquals(expectedFilterAsString, actualFilterAsText);
- } catch (ExceptionVisitExpression e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- } catch (ODataApplicationException e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
- // --- Helper ---
-
- private String compress(final String expected) {
- String ret = expected.replaceAll("\\s+", " ");
- ret = ret.replaceAll("< ", "<");
- ret = ret.replaceAll(" >", ">");
- return ret;
- }
-
- public FilterValidator isType(final FullQualifiedName fullName) {
- EdmType actualType = null;
-
- if (curExpression instanceof MemberImpl) {
- Member member = (Member) curExpression;
- actualType = member.getType();
- } else if (curExpression instanceof TypeLiteralImpl) {
- TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
- actualType = typeLiteral.getType();
- }
-
- if (actualType == null) {
- fail("Current expression not typed");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
- }
-
- public FilterValidator left() {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression not a binary operator");
- }
-
- curExpression = ((BinaryImpl) curExpression).getLeftOperand();
-
- return this;
- }
-
- public FilterValidator root() {
- if (filter != null) {
- curExpression = filter.getExpression();
- } else {
- curExpression = rootExpression;
- }
-
- return this;
- }
-
- public FilterValidator right() {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression is not a binary operator");
- }
-
- curExpression = ((BinaryImpl) curExpression).getRightOperand();
-
- return this;
-
- }
-
- public FilterValidator isLiteral(final String literalText) {
- if (!(curExpression instanceof LiteralImpl)) {
- fail("Current expression is not a literal");
- }
-
- String actualLiteralText = ((LiteralImpl) curExpression).getText();
- assertEquals(literalText, actualLiteralText);
-
- return this;
- }
-
- public FilterValidator isMethod(final SupportedMethodCalls methodKind, final int parameterCount) {
- if (!(curExpression instanceof MethodCallImpl)) {
- fail("Current expression is not a methodCall");
- }
-
- MethodCallImpl methodCall = (MethodCallImpl) curExpression;
- assertEquals(methodKind, methodCall.getMethod());
- assertEquals(parameterCount, methodCall.getParameters().size());
-
- return this;
- }
-
-
- public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
- throws ExceptionVisitExpression, ODataApplicationException {
-
- if (!(curExpression instanceof MethodCallImpl)) {
- fail("Current expression is not a method");
- }
-
- MethodCallImpl methodCall = (MethodCallImpl) curExpression;
-
- Expression parameter = methodCall.getParameters().get(parameterIndex);
- String actualParameterText = FilterTreeToText.Serialize(parameter);
- assertEquals(parameterText, actualParameterText);
-
- return this;
- }
-
- public FilterValidator isBinary(final SupportedBinaryOperators binaryOperator) {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression is not a binary operator");
- }
-
- BinaryImpl binary = (BinaryImpl) curExpression;
- assertEquals(binaryOperator, binary.getOperator());
-
- return this;
- }
-
- public FilterValidator isTypedLiteral(FullQualifiedName fullName) {
- if (!(curExpression instanceof TypeLiteralImpl)) {
- fail("Current expression not a typeLiteral");
- }
-
- this.isType(fullName);
-
- return this;
- }
-
- public FilterValidator isMember() {
- if (!(curExpression instanceof MemberImpl)) {
- fail("Current expression not a member");
- }
-
- return this;
- }
-
- public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
- if (!(curExpression instanceof EnumerationImpl)) {
- fail("Current expression not a enumeration");
- }
-
- EnumerationImpl enumeration = (EnumerationImpl) curExpression;
-
- FullQualifiedName actualName =
- new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
-
- // check name
- assertEquals(nameenstring.toString(), actualName.toString());
-
- // check values
- int i = 0;
- for (String item : enumValues) {
- assertEquals(item, enumeration.getValues().get(i));
- i++;
- }
-
- return this;
- }
-
- public FilterValidator isConstant(SupportedConstants kind) {
- if (!(curExpression instanceof ConstantImpl)) {
- fail("Current expression not a constant");
- }
-
- assertEquals(kind, ((ConstantImpl) curExpression).getKind());
-
- return this;
- }
-
- public FilterValidator isSortOrder(int index, boolean descending) {
- assertEquals(descending, orderBy.getOrders().get(index).isDescending());
- return this;
- }
-
- public FilterValidator goOrder(int index) {
- curExpression = orderBy.getOrders().get(index).getExpression();
- return this;
- }
-
- public FilterValidator isExSyntax(long errorID) {
- assertEquals(UriParserSyntaxException.class, exception.getClass());
- return this;
- }
-
- public FilterValidator isExSemantic(long errorID) {
- assertEquals(UriParserSemanticException.class, exception.getClass());
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
deleted file mode 100644
index c7fa306..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParseTreeToText.java
+++ /dev/null
@@ -1,82 +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.testutil;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.misc.NotNull;
-import org.antlr.v4.runtime.misc.Nullable;
-import org.antlr.v4.runtime.misc.Utils;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.RuleNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.antlr.v4.runtime.tree.Tree;
-
-public class ParseTreeToText {
-
- public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
- return toStringTree(contextTree, Arrays.asList(ruleNames));
- }
-
- private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
-
- if (t.getChildCount() == 0) {
- return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- }
-
- StringBuilder buf = new StringBuilder();
- String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- buf.append(s);
- buf.append("(");
-
- for (int i = 0; i < t.getChildCount(); i++) {
- if (i > 0) {
- buf.append(' ');
- }
- buf.append(toStringTree(t.getChild(i), ruleNames));
- }
- buf.append(")");
- return buf.toString();
- }
-
- private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
- if (ruleNames != null) {
- if (t instanceof RuleNode) {
- int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
- return ruleNames.get(ruleIndex);
- } else if (t instanceof ErrorNode) {
- return t.toString();
- } else if (t instanceof TerminalNode) {
- Token symbol = ((TerminalNode) t).getSymbol();
- if (symbol != null) {
- String s = symbol.getText();
- return s;
- }
- }
- }
- // no recog for rule names
- Object payload = t.getPayload();
- if (payload instanceof Token) {
- return ((Token) payload).getText();
- }
- return t.getPayload().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
deleted file mode 100644
index 622bce7..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserTest.java
+++ /dev/null
@@ -1,53 +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.testutil;
-
-import org.antlr.v4.runtime.DefaultErrorStrategy;
-import org.apache.olingo.odata4.producer.core.uri.Parser;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
-
-public class ParserTest extends Parser {
- TestErrorLogger errorCollector1;
- TestErrorLogger errorCollector2;
-
- public ParserTest() {
- errorCollector1 = new TestErrorLogger("Stage 1", 1);
- errorCollector2 = new TestErrorLogger("Stage 2", 1);
- }
-
- @Override
- protected void addStage2ErrorStategy(UriParserParser parser) {
- // Don't throw an at first syntax error, so the error listener will be called
- parser.setErrorHandler(new DefaultErrorStrategy());
- }
-
- @Override
- protected void addStage1ErrorListener(UriParserParser parser) {
- // Log error to console
- parser.removeErrorListeners();
- parser.addErrorListener(errorCollector1);
- }
-
- @Override
- protected void addStage2ErrorListener(UriParserParser parser) {
- // Log error to console
- parser.removeErrorListeners();
- parser.addErrorListener(errorCollector2);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
deleted file mode 100644
index e29255f..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/ParserValidator.java
+++ /dev/null
@@ -1,249 +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.testutil;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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.ParserRuleContext;
-import org.antlr.v4.runtime.atn.PredictionMode;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
-
-// TODO extend to test also exception which can occure while paring
-public class ParserValidator {
-
- private String input = null;
- private ParserRuleContext root;
-
- int logLevel = 0;
- private int lexerLogLevel = 0;
-
- boolean allowFullContext;
- boolean allowContextSensitifity;
- boolean allowAmbiguity;
-
- List<Exception> exceptions = new ArrayList<Exception>();
- private Exception curException = null;
-
- // --- Setup ---
-
- public ParserValidator log(final int logLevel) {
- this.logLevel = logLevel;
- return this;
- }
-
- public ParserValidator lexerLog(final int logLevel) {
- lexerLogLevel = logLevel;
- return this;
- }
-
- /**
- * TODO verify
- * Used in fast LL Parsing:
- * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
- * required
- * @return
- */
- public ParserValidator aFC() {
- allowFullContext = true;
- return this;
- }
-
- /**
- *
- * TODO verify
- * Used in fast LL Parsing:
- * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
- * and indicate that there is a context sensitivity ( which may not be an error).
- * @return
- */
- public ParserValidator aCS() {
- allowContextSensitifity = true;
- return this;
- }
-
- /**
- * TODO verify
- * Used in fast LL Parsing:
- * Allows ambiguities
- * @return
- */
- public ParserValidator aAM() {
- allowAmbiguity = true;
- return this;
- }
-
- // --- Execution ---
-
- public ParserValidator run(final String uri) {
- input = uri;
-
- // just run a short lexer step. E.g. to print the tokens
- if (lexerLogLevel > 0) {
- (new TokenValidator()).log(lexerLogLevel).run(input);
- }
-
- root = parseInput(uri);
-
- // if LOG > 0 - Write serialized tree
- if (logLevel > 0) {
- if (root != null) {
- System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
- } else {
- System.out.println("root == null");
- }
- }
-
- // reset for next test
- allowFullContext = false;
- allowContextSensitifity = false;
- allowAmbiguity = false;
- logLevel = 0;
-
- return this;
- }
-
- // --- Navigation ---
-
- public ParserValidator exFirst() {
- try {
- // curWeakException = exceptions.get(0);
- } catch (IndexOutOfBoundsException ex) {
- // curWeakException = null;
- }
- return this;
-
- }
-
- public ParserValidator exLast() {
- // curWeakException = exceptions.get(exceptions.size() - 1);
- return this;
- }
-
- public ParserValidator exAt(final int index) {
- try {
- // curWeakException = exceptions.get(index);
- } catch (IndexOutOfBoundsException ex) {
- // curWeakException = null;
- }
- return this;
- }
-
- // --- Validation ---
-
- public ParserValidator isText(final String expected) {
-
- assertEquals(null, curException);
- assertEquals(0, exceptions.size());
-
- String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
-
- assertEquals(expected, actualTreeAsText);
- return this;
- }
-
- public ParserValidator isExeptionType(final Class<?> exClass) {
- assertEquals(exClass, curException.getClass());
- return this;
- }
-
- // --- Helper ---
-
- private OdataRelativeUriEOFContext parseInput(final String input) {
- UriParserParser parser = null;
- UriLexerWithTrace lexer = null;
- OdataRelativeUriEOFContext ret = null;
-
- // Use 2 stage approach to improve performance
- // see https://github.com/antlr/antlr4/issues/192
- // TODO verify this
-
- // stage= 1
- try {
- curException = null;
- exceptions.clear();
-
- // create parser
- lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
- parser = new UriParserParser(new CommonTokenStream(lexer));
-
- // write always a error message in case of syntax errors
- // parser.addErrorListener(new TestErrorHandler<Object>());
- // check error message if whether they are allowed or not
- // parser.addErrorListener(new ErrorCollector());
-
- // bail out of parser at first syntax error. --> proceed in catch block with step 2
- parser.setErrorHandler(new BailErrorStrategy());
-
- // user the faster SLL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-
- // parse
- if (logLevel > 0) {
- System.out.println("Step 1");
- System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
- }
- ret = parser.odataRelativeUriEOF();
-
- } catch (Exception exception) {
- curException = exception;
- try {
- // clear status
- curException = null;
- exceptions.clear();
-
- // create parser
- lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
- parser = new UriParserParser(new CommonTokenStream(lexer));
-
- // write always a error message in case of syntax errors
- // parser.addErrorListener(new ErrorCollector(this));
- // check error message if whether they are allowed or not
- // parser.addErrorListener(new ErrorCollector(this));
-
- // Used default error strategy
- parser.setErrorHandler(new DefaultErrorStrategy());
-
- // User the slower SLL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-
- // parse
- if (logLevel > 1) {
- System.out.println("Step 2");
- System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
- }
- ret = parser.odataRelativeUriEOF();
-
- } catch (Exception exception1) {
- curException = exception1;
- // exceptionOnStage = 2;
- }
- }
-
- return ret;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
deleted file mode 100644
index 8e40072..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TestErrorLogger.java
+++ /dev/null
@@ -1,174 +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.testutil;
-
-import java.util.BitSet;
-import java.util.Collections;
-import java.util.List;
-
-import org.antlr.v4.runtime.ANTLRErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.antlr.v4.runtime.atn.ATNConfigSet;
-import org.antlr.v4.runtime.dfa.DFA;
-
-class TestErrorLogger implements ANTLRErrorListener {
-
- private String prefix;
- private int logLevel = 0;
-
- public TestErrorLogger(String prefix, int logLevel) {
- this.prefix = prefix;
- this.logLevel = logLevel;
- }
-
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
- final int charPositionInLine,
- final String msg, final RecognitionException e) {
-
- // Collect the exception
- if (logLevel > 0) {
- System.out.println("\n" + prefix + " -- SyntaxError");
- trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
- }
-
- }
-
- @Override
- public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
- final boolean exact,
- final BitSet ambigAlts, final ATNConfigSet configs) {
-
- /*
- * if (tokenValidator.logLevel > 0) {
- * System.out.println("reportAmbiguity: ");
- * System.out.println(" ambigAlts: " + ambigAlts);
- * System.out.println(" configs: " + configs);
- * System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
- * }
- */
- /*
- * if (!tokenValidator.allowAmbiguity) {
- * printStack(recognizer);
- * fail("reportAmbiguity");
- * }
- */
- }
-
- @Override
- public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex,
- final BitSet conflictingAlts, final ATNConfigSet configs) {
- /*
- * // The grammar should be written in order to avoid attempting a full context parse because its negative
- * // impact on the performance, so trace and stop here
- * if (tokenValidator.logLevel > 0) {
- * System.out.println("allowed AttemptingFullContext");
- * }
- *
- * if (!tokenValidator.allowFullContext) {
- * printStack(recognizer);
- * fail("reportAttemptingFullContext");
- * }
- */
- }
-
- @Override
- public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex, final int prediction,
- final ATNConfigSet configs) {
- /*
- * if (tokenValidator.logLevel > 0) {
- * System.out.println("allowed ContextSensitivity");
- * }
- *
- * if (!tokenValidator.allowContextSensitifity) {
- * printStack(recognizer);
- * fail("reportContextSensitivity");
- * }
- */
- }
-
- /*
- * private void printStack(final Parser recognizer) {
- * List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- * Collections.reverse(stack);
- *
- * System.out.println(" Rule stack: " + stack);
- * }
- */
- private void printStack(final Recognizer<?, ?> recognizer) {
- List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- Collections.reverse(stack);
- System.out.println(" rule stack: " + stack);
- }
-
- public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
- final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
-
- System.out.println("Error message: " + msg);
- // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
-
- printStack(recognizer);
-
- if (e != null && e.getOffendingToken() != null) {
-
- // String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
- String lexerTokenName = "";
- try {
- // TODO check how the Lexer is accessed in the new package structure
- // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
- } catch (ArrayIndexOutOfBoundsException es) {
- lexerTokenName = "token error";
- }
- System.out.println(" line " + line + ":" + charPositionInLine + " at " +
- offendingSymbol + "/" + lexerTokenName + ": " + msg);
- } else {
- System.out.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
- }
- }
-
- public static int getDecisionRule(Recognizer<?, ?> recognizer, int decision) {
- if (recognizer == null || decision < 0) {
- return -1;
- }
-
- if (decision >= recognizer.getATN().decisionToState.size()) {
- return -1;
- }
-
- return recognizer.getATN().decisionToState.get(decision).ruleIndex;
-}
-
-public static String getRuleDisplayName(Recognizer<?, ?> recognizer, int ruleIndex) {
- if (recognizer == null || ruleIndex < 0) {
- return Integer.toString(ruleIndex);
- }
-
- String[] ruleNames = recognizer.getRuleNames();
- if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
- return Integer.toString(ruleIndex);
- }
-
- return ruleNames[ruleIndex];
-}
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
deleted file mode 100644
index 4f452b8..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/TokenValidator.java
+++ /dev/null
@@ -1,194 +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.testutil;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
-
-//TODO extend to test also exception which can occure while paring
-public class TokenValidator {
-
- private String input = null;
-
- private List<? extends Token> tokens = null;
- private Token curToken = null;
- private Exception curException = null;
-
- private int startMode;
- private int logLevel = 0;
-
- // --- Setup ---
-
- public TokenValidator log(final int logLevel) {
- this.logLevel = logLevel;
- return this;
- }
-
- // --- Execution ---
-
- public TokenValidator run(final String uri) {
- input = uri;
-
- tokens = parseInput(uri);
- if (logLevel > 0) {
- showTokens();
- }
-
- first();
- exFirst();
- logLevel = 0;
-
- return this;
- }
-
- // --- Navigation ---
-
- // navigate within the tokenlist
- public TokenValidator first() {
- try {
- curToken = tokens.get(0);
- } catch (IndexOutOfBoundsException ex) {
- curToken = null;
- }
- return this;
- }
-
- public TokenValidator last() {
- curToken = tokens.get(tokens.size() - 1);
- return this;
- }
-
- public TokenValidator at(final int index) {
- try {
- curToken = tokens.get(index);
- } catch (IndexOutOfBoundsException ex) {
- curToken = null;
- }
- return this;
- }
-
- public TokenValidator exLast() {
- // curException = exceptions.get(exceptions.size() - 1);
- return this;
- }
-
- // navigate within the exception list
- public TokenValidator exFirst() {
- try {
- // curException = exceptions.get(0);
- } catch (IndexOutOfBoundsException ex) {
- curException = null;
- }
- return this;
-
- }
-
- public TokenValidator exAt(final int index) {
- try {
- // curException = exceptions.get(index);
- } catch (IndexOutOfBoundsException ex) {
- curException = null;
- }
- return this;
- }
-
- // --- Validation ---
-
- public TokenValidator isText(final String expected) {
- assertEquals(expected, curToken.getText());
- return this;
- }
-
- public TokenValidator isAllText(final String expected) {
- String actual = "";
-
- for (Token curToken : tokens) {
- actual += curToken.getText();
- }
- assertEquals(expected, actual);
- return this;
- }
-
- public TokenValidator isAllInput() {
- String actual = "";
-
- for (Token curToken : tokens) {
- actual += curToken.getText();
- }
- assertEquals(input, actual);
- return this;
- }
-
- public TokenValidator isInput() {
- assertEquals(input, curToken.getText());
- return this;
- }
-
- public TokenValidator isType(final int expected) {
- assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
- return this;
- }
-
- public TokenValidator isExType(final Class<?> exClass) {
- assertEquals(exClass, curException.getClass());
- return this;
- }
-
- public void globalMode(final int mode) {
- startMode = mode;
- }
-
- // --- Helper ---
-
- private List<? extends Token> parseInput(final String input) {
- ANTLRInputStream inputStream = new ANTLRInputStream(input);
-
- UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
- // lexer.addErrorListener(new ErrorCollector(this));
- return lexer.getAllTokens();
- }
-
- public TokenValidator showTokens() {
- boolean first = true;
- System.out.println("input: " + input);
- String nL = "\n";
- String out = "[" + nL;
- for (Token token : tokens) {
- if (!first) {
- out += ",";
- first = false;
- }
- int index = token.getType();
- if (index != -1) {
- out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
- } else {
- out += "\"" + token.getText() + "\"" + " " + index + nL;
- }
- }
- out += ']';
- System.out.println("tokens: " + out);
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
deleted file mode 100644
index 9576ea0..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriLexerWithTrace.java
+++ /dev/null
@@ -1,85 +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.testutil;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
-
-public class UriLexerWithTrace extends UriLexer {
- int logLevel = 0;
-
- public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel) {
- super(antlrInputStream);
- this.logLevel = logLevel;
- }
-
- public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel, final int mode) {
- super(antlrInputStream);
- super.mode(mode);
- this.logLevel = logLevel;
- }
-
- @Override
- public void emit(final Token token) {
- if (logLevel > 1) {
- String out = String.format("%1$-" + 20 + "s", token.getText());
-
- int tokenType = token.getType();
- if (tokenType == -1) {
- out += "-1/EOF";
- } else {
- out += UriLexer.tokenNames[tokenType];
- }
- System.out.println("Lexer.emit(...):" + out);
- }
-
- super.emit(token);
- }
-
- @Override
- public void pushMode(final int m) {
-
- String out = UriLexer.modeNames[_mode] + "-->";
-
- super.pushMode(m);
-
- out += UriLexer.modeNames[_mode];
-
- if (logLevel > 1) {
- System.out.println(out + " ");
- }
- }
-
- @Override
- public int popMode() {
-
- String out = UriLexer.modeNames[_mode] + "-->";
-
- int m = super.popMode();
-
- out += UriLexer.modeNames[_mode];
-
- if (logLevel > 1) {
- System.out.println(out + " ");
- }
-
- return m;
- }
-}
[06/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
new file mode 100644
index 0000000..803226e
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
+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.FullQualifiedName;
+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.exception.ODataException;
+
+
+/**
+ * Implement the EdmTechProvider and
+ * <li>adds a entity type <b>ETabc with</b> properties a,b,c,d,e,f</li>
+ * <li>adds a complex type <b>CTabc</b> with properties a,b,c,d,e,f</li>
+ * <li>adds a <b>abc</b> entity set of type <b>ETabc</b></li>
+ */
+public class EdmTechTestProvider extends EdmTechProvider {
+
+ Property propertyAInt16 = new Property().setName("a").setType(nameInt16);
+ Property propertyBInt16 = new Property().setName("b").setType(nameInt16);
+ Property propertyCInt16 = new Property().setName("c").setType(nameInt16);
+ Property propertyDInt16 = new Property().setName("d").setType(nameInt16);
+ Property propertyEInt16 = new Property().setName("e").setType(nameInt16);
+ Property propertyFInt16 = new Property().setName("f").setType(nameInt16);
+
+ public static final FullQualifiedName nameCTabc = new FullQualifiedName(nameSpace, "CTabc");
+ public static final FullQualifiedName nameETabc = new FullQualifiedName(nameSpace, "ETabc");
+
+ @Override
+ public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
+ if (complexTypeName.equals(nameCTabc)) {
+ return new ComplexType()
+ .setName("CTabc")
+ .setProperties(Arrays.asList(
+ propertyAInt16, propertyBInt16, propertyCInt16,
+ propertyDInt16, propertyEInt16, propertyFInt16
+ ));
+
+ }
+
+ return super.getComplexType(complexTypeName);
+ }
+
+ @Override
+ public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
+ if (entityContainer == nameContainer) {
+ if (name.equals("ESabc")) {
+ return new EntitySet()
+ .setName("ESabc")
+ .setType(nameETabc);
+ }
+ }
+
+ return super.getEntitySet(entityContainer, name);
+ }
+
+ @Override
+ public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
+ List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("a"));
+
+ if (entityTypeName.equals(nameETabc)) {
+ return new EntityType()
+ .setName("ETabc")
+ .setProperties(Arrays.asList(
+ propertyAInt16, propertyBInt16, propertyCInt16,
+ propertyDInt16, propertyEInt16, propertyFInt16))
+ .setKey(oneKeyPropertyInt16);
+ }
+
+ return super.getEntityType(entityTypeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
new file mode 100644
index 0000000..dfee6c9
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ *
+ * 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.server.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+
+public class ExpandValidator implements Validator {
+ private Edm edm;
+ private Validator invokedByValidator;
+
+ private int expandItemIndex;
+ private ExpandOptionImpl expandOption;
+ private ExpandItem expandItem;
+
+ // --- Setup ---
+
+ public ExpandValidator setGoUpValidator(final Validator parentValidator) {
+ invokedByValidator = parentValidator;
+ return this;
+ }
+
+ public ExpandValidator setExpand(final ExpandOptionImpl expand) {
+ expandOption = expand;
+ first();
+ return this;
+ }
+
+ public ExpandValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ // --- Navigation ---
+
+ public UriResourceValidator goPath() {
+ UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourceInfo();
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("goPath() can only be used on UriInfoKind.resource");
+ }
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo);
+
+ }
+
+ public UriResourceValidator goSelectItemPath(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo();
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo);
+
+ }
+
+
+
+ public ExpandValidator goExpand() {
+ ExpandValidator val = new ExpandValidator();
+ val.setExpand((ExpandOptionImpl) expandItem.getExpandOption());
+ val.setGoUpValidator(this);
+ return val;
+ }
+
+ public ExpandValidator goUpToExpandValidator() {
+ return (ExpandValidator) invokedByValidator;
+ }
+
+ public UriResourceValidator goUpToUriResourceValidator() {
+ return (UriResourceValidator) invokedByValidator;
+ }
+
+ public ExpandValidator first() {
+ expandItemIndex = 0;
+ expandItem = expandOption.getExpandItems().get(expandItemIndex);
+ return this;
+ }
+
+ public ExpandValidator next() {
+ expandItemIndex++;
+
+ try {
+ expandItem = expandOption.getExpandItems().get(expandItemIndex);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segments");
+ }
+ return this;
+
+ }
+
+ public ExpandValidator isSegmentStar(final int index) {
+ assertEquals(true, expandItem.isStar());
+ return this;
+ }
+
+ public ExpandValidator isSegmentRef(final int index) {
+ assertEquals(true, expandItem.isRef());
+ return this;
+ }
+
+ public ExpandValidator isLevelText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isSkipText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isTopText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isInlineCountText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getInlineCountOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isSelectText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isSelectItemStar(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(true, item.isStar());
+ return this;
+ }
+
+ public ExpandValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+ SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+ return this;
+ }
+
+
+ public ExpandValidator isFilterText(final String text) {
+ QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
+ assertEquals(text, option.getText());
+ return this;
+ }
+
+ public ExpandValidator isFilterSerialized(final String serialized) {
+ FilterOptionImpl filter = (FilterOptionImpl) expandItem.getFilterOption();
+
+ try {
+ String tmp = FilterTreeToText.Serialize(filter);
+ assertEquals(serialized, tmp);
+ } catch (ExceptionVisitExpression e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
+ } catch (ODataApplicationException e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
new file mode 100644
index 0000000..a7c2158
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedUnaryOperators;
+
+public class FilterTreeToText implements ExpressionVisitor<String> {
+
+ public static String Serialize(final FilterOption filter)
+ throws ExceptionVisitExpression, ODataApplicationException {
+
+ Expression expression = filter.getExpression();
+ return expression.accept(new FilterTreeToText());
+ }
+
+ public static String Serialize(final Expression expression)
+ throws ExceptionVisitExpression, ODataApplicationException {
+
+ return expression.accept(new FilterTreeToText());
+ }
+
+ @Override
+ public String visitBinaryOperator(final SupportedBinaryOperators operator, final String left, final String right)
+ throws ExceptionVisitExpression {
+
+ return "<" + left + " " + operator.toString() + " " + right + ">";
+ }
+
+ @Override
+ public String visitUnaryOperator(final SupportedUnaryOperators operator, final String operand)
+ throws ExceptionVisitExpression {
+
+ return "<" + operator + " " + operand.toString() + ">";
+ }
+
+ @Override
+ public String visitMethodCall(final SupportedMethodCalls methodCall, final List<String> parameters)
+ throws ExceptionVisitExpression {
+
+ String text = "<" + methodCall + "(";
+ int i = 0;
+ while (i < parameters.size()) {
+ if (i > 0) {
+ text += ",";
+ }
+ text += parameters.get(i);
+ i++;
+ }
+ return text + ")>";
+ }
+
+ @Override
+ public String visitLiteral(final String literal) throws ExceptionVisitExpression {
+ return "<" + literal + ">";
+ }
+
+ @Override
+ public String visitMember(final UriInfoResource resource) throws ExceptionVisitExpression, ODataApplicationException {
+ String ret = "";
+
+ UriInfoResource path = resource;
+
+ for (UriResource item : path.getUriResourceParts()) {
+ String tmp = "";
+ if (item instanceof UriResourceLambdaAll) {
+ UriResourceLambdaAll all = (UriResourceLambdaAll) item;
+ tmp = visitLambdaExpression("ALL", all.getLamdaVariable(), all.getExpression());
+ } else if (item instanceof UriResourceLambdaAny) {
+ UriResourceLambdaAny any = (UriResourceLambdaAny) item;
+ // TODO create enum
+ tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
+ } else if (item instanceof UriResourcePartTyped) {
+ UriResourcePartTyped typed = (UriResourcePartTyped) item;
+ tmp = typed.toString(true);
+ }
+
+ if (ret.length() != 0) {
+ ret += "/";
+ }
+ ret += tmp;
+
+ }
+ return "<" + ret + ">";
+ }
+
+ @Override
+ public String visitAlias(final String referenceName) throws ExceptionVisitExpression {
+ return "<" + referenceName + ">";
+ }
+
+ @Override
+ public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
+ throws ExceptionVisitExpression, ODataApplicationException {
+
+ return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
+ }
+
+ @Override
+ public String visitTypeLiteral(final EdmType type) {
+ return "<" + type.getNamespace() + "." + type.getName() + ">";
+ }
+
+ @Override
+ public String visitLambdaReference(final String variableText) {
+ return "<" + variableText + ">";
+ }
+
+ @Override
+ public String visitEnum(final EdmEnumType type, final List<String> enumValues)
+ throws ExceptionVisitExpression, ODataApplicationException {
+ String tmp = "";
+
+ for (String item : enumValues) {
+ if (tmp.length() > 0) {
+ tmp += ",";
+ }
+ tmp += item;
+ }
+
+ return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
+ }
+
+ @Override
+ public String visitConstant(SupportedConstants kind) throws ExceptionVisitExpression, ODataApplicationException {
+ // TODO Auto-generated method stub
+ return "<" + kind.toString() + ">";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
new file mode 100644
index 0000000..c7e3dfa
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
@@ -0,0 +1,491 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+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.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.server.core.uri.Parser;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriParseTreeVisitor;
+import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
+import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ConstantImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.EnumerationImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MethodCallImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.TypeLiteralImpl;
+
+public class FilterValidator implements Validator {
+ private Edm edm;
+
+ private Validator invokedByValidator;
+ private FilterOptionImpl filter;
+
+ private Expression curExpression;
+ private Expression rootExpression;
+
+ private OrderByOptionImpl orderBy;
+
+ private UriParserException exception;
+
+ // --- Setup ---
+ public FilterValidator setUriResourcePathValidator(final UriResourceValidator uriResourcePathValidator) {
+ invokedByValidator = uriResourcePathValidator;
+ return this;
+ }
+
+ public FilterValidator setUriValidator(final UriValidator uriValidator) {
+ invokedByValidator = uriValidator;
+ return this;
+ }
+
+ public FilterValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public FilterValidator setFilter(final FilterOptionImpl filter) {
+ this.filter = filter;
+
+ if (filter.getExpression() == null) {
+ fail("FilterValidator: no filter found");
+ }
+ setExpression(filter.getExpression());
+ return this;
+ }
+
+ public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
+ this.orderBy = orderBy;
+
+ return this;
+ }
+
+ public FilterValidator setExpression(final Expression expression) {
+ rootExpression = curExpression = expression;
+ return this;
+ }
+
+ // --- Execution ---
+
+ public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
+ String uri = "ESAllPrim?$orderby=" + orderBy.trim();
+ return runUriOrderBy(uri);
+ }
+
+ public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
+ String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
+ return runUriOrderBy(uri);
+ }
+
+ public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
+ String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
+ return runUriOrderByEx(uri);
+ }
+
+ public FilterValidator runOnETTwoKeyNav(final String filter) throws UriParserException {
+ // TODO change to ESTwoKeyNav
+ String uri = "SINav?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
+ // TODO change to ESTwoKeyNav
+ String uri = "SINav?$filter=" + filter.trim();
+ return runUriEx(uri);
+ }
+
+ public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
+ String uri = "ESAllPrim(1)?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
+ String uri = "ESKeyNav(1)?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnETKeyNavEx(final String filter) throws UriParserException {
+ String uri = "ESKeyNav(1)?$filter=" + filter.trim();
+ return runUriEx(uri);
+ }
+
+ public FilterValidator runOnCTTwoPrim(final String filter) throws UriParserException {
+ String uri = "SINav/PropertyComplexTwoPrim?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnString(final String filter) throws UriParserException {
+ String uri = "SINav/PropertyString?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnInt32(final String filter) throws UriParserException {
+ String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
+ String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnDuration(final String filter) throws UriParserException {
+ String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
+ String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runESabc(final String filter) throws UriParserException {
+ String uri = "ESabc?$filter=" + filter.trim();
+ return runUri(uri);
+ }
+
+ public FilterValidator runUri(final String uri) throws UriParserException {
+ Parser parser = new Parser();
+ UriInfo uriInfo = null;
+
+ uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("Filtervalidator can only be used on resourcePaths");
+ }
+
+ setFilter((FilterOptionImpl) uriInfo.getFilterOption());
+ curExpression = filter.getExpression();
+ return this;
+ }
+
+ public FilterValidator runUriEx(final String uri) {
+ Parser parser = new Parser();
+ UriInfo uriInfo = null;
+
+ try {
+ uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+ } catch (UriParserException e) {
+ this.exception = e;
+ return this;
+ }
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("Filtervalidator can only be used on resourcePaths");
+ }
+
+ setFilter((FilterOptionImpl) uriInfo.getFilterOption());
+ curExpression = filter.getExpression();
+ return this;
+ }
+
+ public FilterValidator runUriOrderBy(final String uri) throws UriParserException {
+ Parser parser = new Parser();
+ UriInfo uriInfo = null;
+
+ uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("Filtervalidator can only be used on resourcePaths");
+ }
+
+ setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+ return this;
+ }
+
+ public FilterValidator runUriOrderByEx(final String uri) {
+ Parser parser = new Parser();
+ UriInfo uriInfo = null;
+
+ try {
+ uriInfo = parser.parseUri(uri, new UriParseTreeVisitor(edm));
+ } catch (UriParserException e) {
+ this.exception = e;
+ return this;
+ }
+
+ if (uriInfo.getKind() != UriInfoKind.resource) {
+ fail("Filtervalidator can only be used on resourcePaths");
+ }
+
+ setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
+ return this;
+ }
+
+
+ // --- Navigation ---
+
+ public Validator goUp() {
+ return invokedByValidator;
+ }
+
+ public UriResourceValidator goPath() {
+ if (!(curExpression instanceof MemberImpl)) {
+ fail("Current expression not a member");
+ }
+
+ MemberImpl member = (MemberImpl) curExpression;
+ UriResourceValidator uriValidator = new UriResourceValidator();
+ uriValidator.setEdm(edm);
+ uriValidator.setUriInfoImplPath((UriInfoImpl) member.getPath());
+ uriValidator.setUpValidator(this);
+ return uriValidator;
+ }
+
+ public FilterValidator goParameter(final int parameterIndex) {
+ if (curExpression instanceof MethodCallImpl) {
+ MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+
+ curExpression = methodCall.getParameters().get(parameterIndex);
+ } else {
+ fail("Current expression not a methodCall");
+ }
+ return this;
+ }
+
+ // --- Validation ---
+
+ /**
+ * Validates the serialized filterTree against a given filterString
+ * The given expected filterString is compressed before to allow better readable code in the unit tests
+ * @param toBeCompr
+ * @return
+ */
+ public FilterValidator isCompr(final String toBeCompr) {
+ return is(compress(toBeCompr));
+ }
+
+ public FilterValidator is(final String expectedFilterAsString) {
+ try {
+ String actualFilterAsText = FilterTreeToText.Serialize((FilterOptionImpl) filter);
+ assertEquals(expectedFilterAsString, actualFilterAsText);
+ } catch (ExceptionVisitExpression e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
+ } catch (ODataApplicationException e) {
+ fail("Exception occured while converting the filterTree into text" + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ return this;
+ }
+
+ // --- Helper ---
+
+ private String compress(final String expected) {
+ String ret = expected.replaceAll("\\s+", " ");
+ ret = ret.replaceAll("< ", "<");
+ ret = ret.replaceAll(" >", ">");
+ return ret;
+ }
+
+ public FilterValidator isType(final FullQualifiedName fullName) {
+ EdmType actualType = null;
+
+ if (curExpression instanceof MemberImpl) {
+ Member member = (Member) curExpression;
+ actualType = member.getType();
+ } else if (curExpression instanceof TypeLiteralImpl) {
+ TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
+ actualType = typeLiteral.getType();
+ }
+
+ if (actualType == null) {
+ fail("Current expression not typed");
+ }
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ assertEquals(fullName, actualName);
+ return this;
+ }
+
+ public FilterValidator left() {
+ if (!(curExpression instanceof BinaryImpl)) {
+ fail("Current expression not a binary operator");
+ }
+
+ curExpression = ((BinaryImpl) curExpression).getLeftOperand();
+
+ return this;
+ }
+
+ public FilterValidator root() {
+ if (filter != null) {
+ curExpression = filter.getExpression();
+ } else {
+ curExpression = rootExpression;
+ }
+
+ return this;
+ }
+
+ public FilterValidator right() {
+ if (!(curExpression instanceof BinaryImpl)) {
+ fail("Current expression is not a binary operator");
+ }
+
+ curExpression = ((BinaryImpl) curExpression).getRightOperand();
+
+ return this;
+
+ }
+
+ public FilterValidator isLiteral(final String literalText) {
+ if (!(curExpression instanceof LiteralImpl)) {
+ fail("Current expression is not a literal");
+ }
+
+ String actualLiteralText = ((LiteralImpl) curExpression).getText();
+ assertEquals(literalText, actualLiteralText);
+
+ return this;
+ }
+
+ public FilterValidator isMethod(final SupportedMethodCalls methodKind, final int parameterCount) {
+ if (!(curExpression instanceof MethodCallImpl)) {
+ fail("Current expression is not a methodCall");
+ }
+
+ MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+ assertEquals(methodKind, methodCall.getMethod());
+ assertEquals(parameterCount, methodCall.getParameters().size());
+
+ return this;
+ }
+
+
+ public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
+ throws ExceptionVisitExpression, ODataApplicationException {
+
+ if (!(curExpression instanceof MethodCallImpl)) {
+ fail("Current expression is not a method");
+ }
+
+ MethodCallImpl methodCall = (MethodCallImpl) curExpression;
+
+ Expression parameter = methodCall.getParameters().get(parameterIndex);
+ String actualParameterText = FilterTreeToText.Serialize(parameter);
+ assertEquals(parameterText, actualParameterText);
+
+ return this;
+ }
+
+ public FilterValidator isBinary(final SupportedBinaryOperators binaryOperator) {
+ if (!(curExpression instanceof BinaryImpl)) {
+ fail("Current expression is not a binary operator");
+ }
+
+ BinaryImpl binary = (BinaryImpl) curExpression;
+ assertEquals(binaryOperator, binary.getOperator());
+
+ return this;
+ }
+
+ public FilterValidator isTypedLiteral(FullQualifiedName fullName) {
+ if (!(curExpression instanceof TypeLiteralImpl)) {
+ fail("Current expression not a typeLiteral");
+ }
+
+ this.isType(fullName);
+
+ return this;
+ }
+
+ public FilterValidator isMember() {
+ if (!(curExpression instanceof MemberImpl)) {
+ fail("Current expression not a member");
+ }
+
+ return this;
+ }
+
+ public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
+ if (!(curExpression instanceof EnumerationImpl)) {
+ fail("Current expression not a enumeration");
+ }
+
+ EnumerationImpl enumeration = (EnumerationImpl) curExpression;
+
+ FullQualifiedName actualName =
+ new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
+
+ // check name
+ assertEquals(nameenstring.toString(), actualName.toString());
+
+ // check values
+ int i = 0;
+ for (String item : enumValues) {
+ assertEquals(item, enumeration.getValues().get(i));
+ i++;
+ }
+
+ return this;
+ }
+
+ public FilterValidator isConstant(SupportedConstants kind) {
+ if (!(curExpression instanceof ConstantImpl)) {
+ fail("Current expression not a constant");
+ }
+
+ assertEquals(kind, ((ConstantImpl) curExpression).getKind());
+
+ return this;
+ }
+
+ public FilterValidator isSortOrder(int index, boolean descending) {
+ assertEquals(descending, orderBy.getOrders().get(index).isDescending());
+ return this;
+ }
+
+ public FilterValidator goOrder(int index) {
+ curExpression = orderBy.getOrders().get(index).getExpression();
+ return this;
+ }
+
+ public FilterValidator isExSyntax(long errorID) {
+ assertEquals(UriParserSyntaxException.class, exception.getClass());
+ return this;
+ }
+
+ public FilterValidator isExSemantic(long errorID) {
+ assertEquals(UriParserSemanticException.class, exception.getClass());
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
new file mode 100644
index 0000000..4f143ca
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.misc.Nullable;
+import org.antlr.v4.runtime.misc.Utils;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.RuleNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.antlr.v4.runtime.tree.Tree;
+
+public class ParseTreeToText {
+
+ public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
+ return toStringTree(contextTree, Arrays.asList(ruleNames));
+ }
+
+ private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
+
+ if (t.getChildCount() == 0) {
+ return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+ }
+
+ StringBuilder buf = new StringBuilder();
+ String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
+ buf.append(s);
+ buf.append("(");
+
+ for (int i = 0; i < t.getChildCount(); i++) {
+ if (i > 0) {
+ buf.append(' ');
+ }
+ buf.append(toStringTree(t.getChild(i), ruleNames));
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
+ if (ruleNames != null) {
+ if (t instanceof RuleNode) {
+ int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
+ return ruleNames.get(ruleIndex);
+ } else if (t instanceof ErrorNode) {
+ return t.toString();
+ } else if (t instanceof TerminalNode) {
+ Token symbol = ((TerminalNode) t).getSymbol();
+ if (symbol != null) {
+ String s = symbol.getText();
+ return s;
+ }
+ }
+ }
+ // no recog for rule names
+ Object payload = t.getPayload();
+ if (payload instanceof Token) {
+ return ((Token) payload).getText();
+ }
+ return t.getPayload().toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
new file mode 100644
index 0000000..d2bf687
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import org.antlr.v4.runtime.DefaultErrorStrategy;
+import org.apache.olingo.odata4.server.core.uri.Parser;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+
+public class ParserTest extends Parser {
+ TestErrorLogger errorCollector1;
+ TestErrorLogger errorCollector2;
+
+ public ParserTest() {
+ errorCollector1 = new TestErrorLogger("Stage 1", 1);
+ errorCollector2 = new TestErrorLogger("Stage 2", 1);
+ }
+
+ @Override
+ protected void addStage2ErrorStategy(UriParserParser parser) {
+ // Don't throw an at first syntax error, so the error listener will be called
+ parser.setErrorHandler(new DefaultErrorStrategy());
+ }
+
+ @Override
+ protected void addStage1ErrorListener(UriParserParser parser) {
+ // Log error to console
+ parser.removeErrorListeners();
+ parser.addErrorListener(errorCollector1);
+ }
+
+ @Override
+ protected void addStage2ErrorListener(UriParserParser parser) {
+ // Log error to console
+ parser.removeErrorListeners();
+ parser.addErrorListener(errorCollector2);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
new file mode 100644
index 0000000..49c6d4f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.ParserRuleContext;
+import org.antlr.v4.runtime.atn.PredictionMode;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+
+// TODO extend to test also exception which can occure while paring
+public class ParserValidator {
+
+ private String input = null;
+ private ParserRuleContext root;
+
+ int logLevel = 0;
+ private int lexerLogLevel = 0;
+
+ boolean allowFullContext;
+ boolean allowContextSensitifity;
+ boolean allowAmbiguity;
+
+ List<Exception> exceptions = new ArrayList<Exception>();
+ private Exception curException = null;
+
+ // --- Setup ---
+
+ public ParserValidator log(final int logLevel) {
+ this.logLevel = logLevel;
+ return this;
+ }
+
+ public ParserValidator lexerLog(final int logLevel) {
+ lexerLogLevel = logLevel;
+ return this;
+ }
+
+ /**
+ * TODO verify
+ * Used in fast LL Parsing:
+ * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
+ * required
+ * @return
+ */
+ public ParserValidator aFC() {
+ allowFullContext = true;
+ return this;
+ }
+
+ /**
+ *
+ * TODO verify
+ * Used in fast LL Parsing:
+ * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
+ * and indicate that there is a context sensitivity ( which may not be an error).
+ * @return
+ */
+ public ParserValidator aCS() {
+ allowContextSensitifity = true;
+ return this;
+ }
+
+ /**
+ * TODO verify
+ * Used in fast LL Parsing:
+ * Allows ambiguities
+ * @return
+ */
+ public ParserValidator aAM() {
+ allowAmbiguity = true;
+ return this;
+ }
+
+ // --- Execution ---
+
+ public ParserValidator run(final String uri) {
+ input = uri;
+
+ // just run a short lexer step. E.g. to print the tokens
+ if (lexerLogLevel > 0) {
+ (new TokenValidator()).log(lexerLogLevel).run(input);
+ }
+
+ root = parseInput(uri);
+
+ // if LOG > 0 - Write serialized tree
+ if (logLevel > 0) {
+ if (root != null) {
+ System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
+ } else {
+ System.out.println("root == null");
+ }
+ }
+
+ // reset for next test
+ allowFullContext = false;
+ allowContextSensitifity = false;
+ allowAmbiguity = false;
+ logLevel = 0;
+
+ return this;
+ }
+
+ // --- Navigation ---
+
+ public ParserValidator exFirst() {
+ try {
+ // curWeakException = exceptions.get(0);
+ } catch (IndexOutOfBoundsException ex) {
+ // curWeakException = null;
+ }
+ return this;
+
+ }
+
+ public ParserValidator exLast() {
+ // curWeakException = exceptions.get(exceptions.size() - 1);
+ return this;
+ }
+
+ public ParserValidator exAt(final int index) {
+ try {
+ // curWeakException = exceptions.get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ // curWeakException = null;
+ }
+ return this;
+ }
+
+ // --- Validation ---
+
+ public ParserValidator isText(final String expected) {
+
+ assertEquals(null, curException);
+ assertEquals(0, exceptions.size());
+
+ String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
+
+ assertEquals(expected, actualTreeAsText);
+ return this;
+ }
+
+ public ParserValidator isExeptionType(final Class<?> exClass) {
+ assertEquals(exClass, curException.getClass());
+ return this;
+ }
+
+ // --- Helper ---
+
+ private OdataRelativeUriEOFContext parseInput(final String input) {
+ UriParserParser parser = null;
+ UriLexerWithTrace lexer = null;
+ OdataRelativeUriEOFContext ret = null;
+
+ // Use 2 stage approach to improve performance
+ // see https://github.com/antlr/antlr4/issues/192
+ // TODO verify this
+
+ // stage= 1
+ try {
+ curException = null;
+ exceptions.clear();
+
+ // create parser
+ lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+ parser = new UriParserParser(new CommonTokenStream(lexer));
+
+ // write always a error message in case of syntax errors
+ // parser.addErrorListener(new TestErrorHandler<Object>());
+ // check error message if whether they are allowed or not
+ // parser.addErrorListener(new ErrorCollector());
+
+ // bail out of parser at first syntax error. --> proceed in catch block with step 2
+ parser.setErrorHandler(new BailErrorStrategy());
+
+ // user the faster SLL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+
+ // parse
+ if (logLevel > 0) {
+ System.out.println("Step 1");
+ System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
+ }
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (Exception exception) {
+ curException = exception;
+ try {
+ // clear status
+ curException = null;
+ exceptions.clear();
+
+ // create parser
+ lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+ parser = new UriParserParser(new CommonTokenStream(lexer));
+
+ // write always a error message in case of syntax errors
+ // parser.addErrorListener(new ErrorCollector(this));
+ // check error message if whether they are allowed or not
+ // parser.addErrorListener(new ErrorCollector(this));
+
+ // Used default error strategy
+ parser.setErrorHandler(new DefaultErrorStrategy());
+
+ // User the slower SLL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+
+ // parse
+ if (logLevel > 1) {
+ System.out.println("Step 2");
+ System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
+ }
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (Exception exception1) {
+ curException = exception1;
+ // exceptionOnStage = 2;
+ }
+ }
+
+ return ret;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
new file mode 100644
index 0000000..877b06d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.List;
+
+import org.antlr.v4.runtime.ANTLRErrorListener;
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.antlr.v4.runtime.atn.ATNConfigSet;
+import org.antlr.v4.runtime.dfa.DFA;
+
+class TestErrorLogger implements ANTLRErrorListener {
+
+ private String prefix;
+ private int logLevel = 0;
+
+ public TestErrorLogger(String prefix, int logLevel) {
+ this.prefix = prefix;
+ this.logLevel = logLevel;
+ }
+
+ @Override
+ public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
+ final int charPositionInLine,
+ final String msg, final RecognitionException e) {
+
+ // Collect the exception
+ if (logLevel > 0) {
+ System.out.println("\n" + prefix + " -- SyntaxError");
+ trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
+ }
+
+ }
+
+ @Override
+ public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
+ final boolean exact,
+ final BitSet ambigAlts, final ATNConfigSet configs) {
+
+ /*
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("reportAmbiguity: ");
+ * System.out.println(" ambigAlts: " + ambigAlts);
+ * System.out.println(" configs: " + configs);
+ * System.out.println(" input: " + recognizer.getTokenStream().getText(Interval.of(startIndex, stopIndex)));
+ * }
+ */
+ /*
+ * if (!tokenValidator.allowAmbiguity) {
+ * printStack(recognizer);
+ * fail("reportAmbiguity");
+ * }
+ */
+ }
+
+ @Override
+ public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
+ final int stopIndex,
+ final BitSet conflictingAlts, final ATNConfigSet configs) {
+ /*
+ * // The grammar should be written in order to avoid attempting a full context parse because its negative
+ * // impact on the performance, so trace and stop here
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("allowed AttemptingFullContext");
+ * }
+ *
+ * if (!tokenValidator.allowFullContext) {
+ * printStack(recognizer);
+ * fail("reportAttemptingFullContext");
+ * }
+ */
+ }
+
+ @Override
+ public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
+ final int stopIndex, final int prediction,
+ final ATNConfigSet configs) {
+ /*
+ * if (tokenValidator.logLevel > 0) {
+ * System.out.println("allowed ContextSensitivity");
+ * }
+ *
+ * if (!tokenValidator.allowContextSensitifity) {
+ * printStack(recognizer);
+ * fail("reportContextSensitivity");
+ * }
+ */
+ }
+
+ /*
+ * private void printStack(final Parser recognizer) {
+ * List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+ * Collections.reverse(stack);
+ *
+ * System.out.println(" Rule stack: " + stack);
+ * }
+ */
+ private void printStack(final Recognizer<?, ?> recognizer) {
+ List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
+ Collections.reverse(stack);
+ System.out.println(" rule stack: " + stack);
+ }
+
+ public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
+ final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
+
+ System.out.println("Error message: " + msg);
+ // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
+
+ printStack(recognizer);
+
+ if (e != null && e.getOffendingToken() != null) {
+
+ // String lexerTokenName = TestSuiteLexer.tokenNames[e.getOffendingToken().getType()];
+ String lexerTokenName = "";
+ try {
+ // TODO check how the Lexer is accessed in the new package structure
+ // lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+ } catch (ArrayIndexOutOfBoundsException es) {
+ lexerTokenName = "token error";
+ }
+ System.out.println(" line " + line + ":" + charPositionInLine + " at " +
+ offendingSymbol + "/" + lexerTokenName + ": " + msg);
+ } else {
+ System.out.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
+ }
+ }
+
+ public static int getDecisionRule(Recognizer<?, ?> recognizer, int decision) {
+ if (recognizer == null || decision < 0) {
+ return -1;
+ }
+
+ if (decision >= recognizer.getATN().decisionToState.size()) {
+ return -1;
+ }
+
+ return recognizer.getATN().decisionToState.get(decision).ruleIndex;
+}
+
+public static String getRuleDisplayName(Recognizer<?, ?> recognizer, int ruleIndex) {
+ if (recognizer == null || ruleIndex < 0) {
+ return Integer.toString(ruleIndex);
+ }
+
+ String[] ruleNames = recognizer.getRuleNames();
+ if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
+ return Integer.toString(ruleIndex);
+ }
+
+ return ruleNames[ruleIndex];
+}
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
new file mode 100644
index 0000000..5961421
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+
+//TODO extend to test also exception which can occure while paring
+public class TokenValidator {
+
+ private String input = null;
+
+ private List<? extends Token> tokens = null;
+ private Token curToken = null;
+ private Exception curException = null;
+
+ private int startMode;
+ private int logLevel = 0;
+
+ // --- Setup ---
+
+ public TokenValidator log(final int logLevel) {
+ this.logLevel = logLevel;
+ return this;
+ }
+
+ // --- Execution ---
+
+ public TokenValidator run(final String uri) {
+ input = uri;
+
+ tokens = parseInput(uri);
+ if (logLevel > 0) {
+ showTokens();
+ }
+
+ first();
+ exFirst();
+ logLevel = 0;
+
+ return this;
+ }
+
+ // --- Navigation ---
+
+ // navigate within the tokenlist
+ public TokenValidator first() {
+ try {
+ curToken = tokens.get(0);
+ } catch (IndexOutOfBoundsException ex) {
+ curToken = null;
+ }
+ return this;
+ }
+
+ public TokenValidator last() {
+ curToken = tokens.get(tokens.size() - 1);
+ return this;
+ }
+
+ public TokenValidator at(final int index) {
+ try {
+ curToken = tokens.get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ curToken = null;
+ }
+ return this;
+ }
+
+ public TokenValidator exLast() {
+ // curException = exceptions.get(exceptions.size() - 1);
+ return this;
+ }
+
+ // navigate within the exception list
+ public TokenValidator exFirst() {
+ try {
+ // curException = exceptions.get(0);
+ } catch (IndexOutOfBoundsException ex) {
+ curException = null;
+ }
+ return this;
+
+ }
+
+ public TokenValidator exAt(final int index) {
+ try {
+ // curException = exceptions.get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ curException = null;
+ }
+ return this;
+ }
+
+ // --- Validation ---
+
+ public TokenValidator isText(final String expected) {
+ assertEquals(expected, curToken.getText());
+ return this;
+ }
+
+ public TokenValidator isAllText(final String expected) {
+ String actual = "";
+
+ for (Token curToken : tokens) {
+ actual += curToken.getText();
+ }
+ assertEquals(expected, actual);
+ return this;
+ }
+
+ public TokenValidator isAllInput() {
+ String actual = "";
+
+ for (Token curToken : tokens) {
+ actual += curToken.getText();
+ }
+ assertEquals(input, actual);
+ return this;
+ }
+
+ public TokenValidator isInput() {
+ assertEquals(input, curToken.getText());
+ return this;
+ }
+
+ public TokenValidator isType(final int expected) {
+ assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+ return this;
+ }
+
+ public TokenValidator isExType(final Class<?> exClass) {
+ assertEquals(exClass, curException.getClass());
+ return this;
+ }
+
+ public void globalMode(final int mode) {
+ startMode = mode;
+ }
+
+ // --- Helper ---
+
+ private List<? extends Token> parseInput(final String input) {
+ ANTLRInputStream inputStream = new ANTLRInputStream(input);
+
+ UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
+ // lexer.addErrorListener(new ErrorCollector(this));
+ return lexer.getAllTokens();
+ }
+
+ public TokenValidator showTokens() {
+ boolean first = true;
+ System.out.println("input: " + input);
+ String nL = "\n";
+ String out = "[" + nL;
+ for (Token token : tokens) {
+ if (!first) {
+ out += ",";
+ first = false;
+ }
+ int index = token.getType();
+ if (index != -1) {
+ out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
+ } else {
+ out += "\"" + token.getText() + "\"" + " " + index + nL;
+ }
+ }
+ out += ']';
+ System.out.println("tokens: " + out);
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
new file mode 100644
index 0000000..91622ca
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.server.core.testutil;
+
+import org.antlr.v4.runtime.ANTLRInputStream;
+import org.antlr.v4.runtime.Token;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+
+public class UriLexerWithTrace extends UriLexer {
+ int logLevel = 0;
+
+ public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel) {
+ super(antlrInputStream);
+ this.logLevel = logLevel;
+ }
+
+ public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel, final int mode) {
+ super(antlrInputStream);
+ super.mode(mode);
+ this.logLevel = logLevel;
+ }
+
+ @Override
+ public void emit(final Token token) {
+ if (logLevel > 1) {
+ String out = String.format("%1$-" + 20 + "s", token.getText());
+
+ int tokenType = token.getType();
+ if (tokenType == -1) {
+ out += "-1/EOF";
+ } else {
+ out += UriLexer.tokenNames[tokenType];
+ }
+ System.out.println("Lexer.emit(...):" + out);
+ }
+
+ super.emit(token);
+ }
+
+ @Override
+ public void pushMode(final int m) {
+
+ String out = UriLexer.modeNames[_mode] + "-->";
+
+ super.pushMode(m);
+
+ out += UriLexer.modeNames[_mode];
+
+ if (logLevel > 1) {
+ System.out.println(out + " ");
+ }
+ }
+
+ @Override
+ public int popMode() {
+
+ String out = UriLexer.modeNames[_mode] + "-->";
+
+ int m = super.popMode();
+
+ out += UriLexer.modeNames[_mode];
+
+ if (logLevel > 1) {
+ System.out.println(out + " ");
+ }
+
+ return m;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
new file mode 100644
index 0000000..b33edfe
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
@@ -0,0 +1,562 @@
+/*******************************************************************************
+ * 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.server.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.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.server.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.server.core.uri.UriParseTreeVisitor;
+import org.apache.olingo.odata4.server.core.uri.UriParserException;
+import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl;
+import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceValidator implements Validator {
+ private Edm edm;
+ private Validator invokedBy;
+ private UriInfo uriInfo = null;
+
+ private UriResourceImpl uriPathInfo = null;
+ private int uriResourceIndex;
+
+ // --- Setup ---
+
+ public UriResourceValidator setUpValidator(final Validator uriValidator) {
+ invokedBy = uriValidator;
+ return this;
+ }
+
+ public UriResourceValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public UriResourceValidator setUriInfoImplPath(final UriInfoImpl uriInfoPath) {
+ uriInfo = uriInfoPath;
+ last();
+ return this;
+ }
+
+ // --- Execution ---
+
+ public UriResourceValidator run(final String uri) {
+ ParserTest testParser = new ParserTest();
+ UriInfoImpl uriInfoTmp = null;
+ uriPathInfo = null;
+ try {
+ uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, new UriParseTreeVisitor(edm));
+ } catch (UriParserException e) {
+ fail("Exception occured while parsing the URI: " + uri + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ if (uriInfoTmp.getKind() != UriInfoKind.resource) {
+ fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
+ }
+ uriInfo = uriInfoTmp;
+
+ first();
+ return this;
+ }
+
+ // --- Navigation ---
+
+ public UriValidator goUpUriValidator() {
+ return (UriValidator) invokedBy;
+ }
+
+ public ExpandValidator goUpExpandValidator() {
+ return (ExpandValidator) invokedBy;
+ }
+
+ public FilterValidator goUpFilterValidator() {
+ return (FilterValidator) invokedBy;
+ }
+
+ public FilterValidator goLambdaExpression() {
+ if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+ FilterValidator val = new FilterValidator();
+ val.setEdm(edm);
+ val.setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
+ return (val);
+ } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+ FilterValidator val = new FilterValidator();
+ val.setEdm(edm);
+ val.setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
+ return (val);
+ } else {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+ return null;
+ }
+
+ public UriResourceValidator isLambdaVar(final String var) {
+ String actualVar = null;
+ if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
+ actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLamdaVariable();
+ } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
+ actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
+ } else {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ assertEquals(var, actualVar);
+ return this;
+ }
+
+ public UriResourceValidator goSelectItemPath(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
+
+ return new UriResourceValidator()
+ .setUpValidator(this)
+ .setEdm(edm)
+ .setUriInfoImplPath(uriInfo1);
+
+ }
+
+ public ExpandValidator goExpand() {
+ ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
+ if (expand == null) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ return new ExpandValidator().setGoUpValidator(this).setExpand(expand);
+ }
+
+ public UriResourceValidator first() {
+ uriResourceIndex = 0;
+ uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
+ return this;
+ }
+
+ public UriResourceValidator last() {
+ uriResourceIndex = 0;
+
+ try {
+ uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
+ uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enough segments");
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator n() {
+ uriResourceIndex++;
+
+ try {
+ uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enough segments");
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator at(final int index) {
+ uriResourceIndex = index;
+ try {
+ uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enough segments");
+ }
+ return this;
+ }
+
+ // --- Validation ---
+
+ public UriResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
+
+ if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
+ uriPathInfo.getKind() != UriResourceKind.singleton &&
+ uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ EdmType actualType = null;
+ if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
+ actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
+ } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
+ actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
+ }
+
+ if (actualType == null) {
+ fail("type information not set");
+ }
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+ assertEquals(expectedType.toString(), actualName.toString());
+ return this;
+ }
+
+ public UriResourceValidator isType(final FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+ UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+
+ EdmType actualType = uriPathInfoTyped.getType();
+ if (actualType == null) {
+ fail("type information not set");
+ }
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+ assertEquals(type.toString(), actualName.toString());
+
+ return this;
+ }
+
+ public UriResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
+ isType(type);
+ assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+
+ // input parameter type may be null in order to assert that the singleTypeFilter is not set
+ EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
+ if (type == null) {
+ assertEquals(type, actualType);
+ } else {
+ assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
+ if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+ UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
+
+ // input parameter type may be null in order to assert that the collectionTypeFilter is not set
+ EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
+ if (expectedType == null) {
+ assertEquals(expectedType, actualType);
+ } else {
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ assertEquals(expectedType.toString(), actualName.toString());
+ }
+
+ return this;
+ }
+
+ // other functions
+ public UriResourceValidator checkCustomParameter(final int index, final String name, final String value) {
+ if (uriInfo == null) {
+ fail("hasQueryParameter: uriInfo == null");
+ }
+
+ List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+ if (list.size() <= index) {
+ fail("not enough queryParameters");
+ }
+
+ CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+ assertEquals(name, option.getName());
+ assertEquals(value, option.getText());
+ return this;
+ }
+
+ // TODO remove
+ public UriResourceValidator isCollection(final boolean isCollection) {
+ if (!(uriPathInfo instanceof UriResourcePartTyped)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+ UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
+
+ EdmType type = uriPathInfoTyped.getType();
+ if (type == null) {
+ fail("isCollection: type == null");
+ }
+ assertEquals(isCollection, uriPathInfoTyped.isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isFilterString(final String expectedFilterTreeAsString) {
+
+ ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
+ try {
+ String filterTreeAsString = filterTree.accept(new FilterTreeToText());
+ assertEquals(expectedFilterTreeAsString, filterTreeAsString);
+ } catch (ExceptionVisitExpression e) {
+ fail("isFilterString: Exception " + e.getMessage() + " occured");
+ } catch (ODataApplicationException e) {
+ fail("isFilterString: Exception " + e.getMessage() + " occured");
+ }
+
+ return this;
+ }
+
+
+ public UriResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
+ if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(refencedProperty, keyPredicates.get(index).getRefencedProperty());
+ return this;
+
+ }
+ public UriResourceValidator isKeyPredicate(final int index, final String name, final String text) {
+ if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(text, keyPredicates.get(index).getText());
+ return this;
+
+ }
+
+ public UriResourceValidator isParameter(final int index, final String name, final String text) {
+ if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getParameters();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(text, keyPredicates.get(index).getText());
+ return this;
+
+ }
+
+ public UriResourceValidator isParameterAlias(final int index, final String name, final String alias) {
+ if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getParameters();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(alias, keyPredicates.get(index).getAlias());
+ return this;
+
+ }
+
+
+ public UriResourceValidator isKind(final UriInfoKind kind) {
+ assertEquals(kind, uriInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isPrimitiveProperty(final String name,
+ final FullQualifiedName type, boolean isCollection) {
+ if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
+
+ EdmElement property = uriPathInfoProp.getProperty();
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ assertEquals(isCollection, property.isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isComplexProperty(final String name, final FullQualifiedName type, boolean isCollection) {
+ if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
+
+ EdmElement property = uriPathInfoProp.getProperty();
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ assertEquals(isCollection, property.isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isNavProperty(final String name, final FullQualifiedName type, boolean isCollection) {
+ if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
+ fail("invalid resource kind: " + uriPathInfo.getKind().toString());
+ }
+
+ UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
+
+ EdmElement property = uriPathInfoProp.getProperty();
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ assertEquals(isCollection, uriPathInfoProp.isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
+ assertNotNull(uriPathInfo);
+ assertEquals(infoType, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isAction(final String name) {
+ assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
+ return this;
+ }
+
+ public UriResourceValidator isFunction(final String name) {
+ assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
+ return this;
+ }
+
+ public UriResourceValidator isFunctionImport(final String name) {
+ assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
+ return this;
+ }
+
+ public UriResourceValidator isEntitySet(final String name) {
+ assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
+ return this;
+ }
+
+ public UriResourceValidator isComplex(final String name) {
+ assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
+ return this;
+ }
+
+ public UriResourceValidator isSingleton(final String name) {
+ assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
+ return this;
+ }
+
+ public UriResourceValidator isValue() {
+ assertEquals(UriResourceKind.value, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isCount() {
+ assertEquals(UriResourceKind.count, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isRef() {
+ assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isActionImport(final String actionName) {
+ assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+ assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
+ return this;
+ }
+
+ public UriResourceValidator isIt() {
+ assertEquals(UriResourceKind.it, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isTopText(final String topText) {
+ assertEquals(topText, uriInfo.getTopOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isFormatText(final String formatText) {
+ assertEquals(formatText, uriInfo.getFormatOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isInlineCountText(final String inlineCountText) {
+ assertEquals(inlineCountText, uriInfo.getInlineCountOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isSkipText(final String skipText) {
+ assertEquals(skipText, uriInfo.getSkipOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isSkipTokenText(final String skipTokenText) {
+ assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
+ return this;
+ }
+
+ public UriResourceValidator isSelectItemStar(final int index) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(true, item.isStar());
+ return this;
+ }
+
+ public UriResourceValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+ SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
+
+ SelectItem item = select.getSelectItems().get(index);
+ assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
+ return this;
+ }
+
+}
[08/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
deleted file mode 100644
index 1781e96..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
+++ /dev/null
@@ -1,1141 +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.antlr;
-
-// TODO after adding the external API to the URI processing class this unit test require a mayor rework
-
-import java.util.Arrays;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-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.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriResourceValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriValidator;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.junit.Test;
-
-public class TestUriParserImpl {
- Edm edm = null;
- private final String PropertyBoolean = "PropertyBoolean=true";
- private final String PropertyByte = "PropertyByte=1";
-
- private final String PropertyDate = "PropertyDate=2013-09-25";
- private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
- private final String PropertyDecimal = "PropertyDecimal=12";
- private final String PropertyDuration = "PropertyDuration=duration'P10DT5H34M21.123456789012S'";
- private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
- private final String PropertyInt16 = "PropertyInt16=1";
- private final String PropertyInt32 = "PropertyInt32=12";
- private final String PropertyInt64 = "PropertyInt64=64";
- private final String PropertySByte = "PropertySByte=1";
- private final String PropertyString = "PropertyString='ABC'";
- 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;
-
- UriValidator testUri = null;
- UriResourceValidator testRes = null;
- FilterValidator testFilter = null;
-
- public TestUriParserImpl() {
- edm = new EdmProviderImpl(new EdmTechTestProvider());
- testUri = new UriValidator().setEdm(edm);
- testRes = new UriResourceValidator().setEdm(edm);
- testFilter = new FilterValidator().setEdm(edm);
- }
-
- @Test
- public void testBoundFunctionImport_VarParameters() {
-
- // no input
- testRes.run("ESKeyNav(1)/com.sap.odata.test1.BFCETKeyNavRTETKeyNav()")
- .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1).isUriPathInfoKind(UriResourceKind.function);
-
- // one input
- testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')")
- .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1).isUriPathInfoKind(UriResourceKind.function)
- .isParameter(0, "ParameterString", "'ABC'");
-
- // two input
- testRes.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.function)
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'");
- }
-
- @Test
- public void testFunctionBound_varReturnType() {
-
- String esTwoKeyNav = "ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')";
-
- // returning primitive
- testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameString)
- .isCollection(false);
-
- // returning collection of primitive
- testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameString)
- .isCollection(true);
-
- // returning single complex
- testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isCollection(false);
-
- // returning collection of complex
- testRes.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameCTTwoPrim)
- .isCollection(true);
-
- // returning single entity
- testRes.run(
- esTwoKeyNav + "/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false);
-
- // returning collection of entity (aka entitySet)
- testRes.run(esTwoKeyNav + "/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .isCollection(true);
- }
-
- @Test
- public void runActionImport_VarReturnType() {
-
- testRes.run("AIRTPrimParam").isKind(UriInfoKind.resource)
- .first()
- .isActionImport("AIRTPrimParam")
- .isAction("UARTPrimParam")
- .isType(EdmTechProvider.nameString, false);
-
- testRes.run("AIRTPrimCollParam").isKind(UriInfoKind.resource)
- .first()
- .isActionImport("AIRTPrimCollParam")
- .isAction("UARTPrimCollParam")
- .isType(EdmTechProvider.nameString, true);
-
- testRes.run("AIRTCompParam").isKind(UriInfoKind.resource)
- .first()
- .isActionImport("AIRTCompParam")
- .isAction("UARTCompParam")
- .isType(EdmTechProvider.nameCTTwoPrim, false);
-
- testRes.run("AIRTCompCollParam").isKind(UriInfoKind.resource)
- .first()
- .isActionImport("AIRTCompCollParam")
- .isAction("UARTCompCollParam")
- .isType(EdmTechProvider.nameCTTwoPrim, true);
-
- testRes.run("AIRTETParam").isKind(UriInfoKind.resource)
- .first()
- .isActionImport("AIRTETParam")
- .isAction("UARTETParam")
- .isType(EdmTechProvider.nameETTwoKeyTwoPrim, false);
-
- // TODO add error test
- // testUri.run("AIRTPrimParam/invalidElement").isKind(UriInfoKind.resource).goPath().
- // isUriPathInfoKind(UriResourceKind.action);
- // testUri.run("InvalidAction");
- }
-
- @Test
- public void runCount() {
-
- // count entity set
- testRes.run("ESAllPrim/$count")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETAllPrim)
- .isCollection(true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.count);
-
- // count on collection of complex
- testRes.run("ESKeyNav(1)/CollPropertyComplex/$count")
- .at(0)
- .isType(EdmTechProvider.nameETKeyNav)
- .at(1)
- .isType(EdmTechProvider.nameCTPrimComp, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.count);
-
- // count on collection of primitive
- testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
- .at(1)
- .isType(EdmTechProvider.nameString, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runCrossJoin() {
- testUri.run("$crossjoin(ESAllKey)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
-
- testUri.run("$crossjoin(ESAllKey,ESTwoPrim)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
- }
-
- @Test
- public void testEntity() {
-
- // simple entity set
- testUri.run("$entity?$id=ESAllPrim").isKind(UriInfoKind.entityId)
- .isKind(UriInfoKind.entityId)
- .isIdText("ESAllPrim");
-
- // simple entity set; $format before $id
- testUri.run("$entity?$format=xml&$id=ETAllPrim").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isIdText("ETAllPrim");
-
- testUri.run("$entity?$format=xml&abc=123&$id=ESAllKey").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isCustomParameter(0, "abc", "123")
- .isIdText("ESAllKey");
-
- // simple entity set; $format after $id
- testUri.run("$entity?$id=ETAllPrim&$format=xml").isKind(UriInfoKind.entityId)
- .isIdText("ETAllPrim")
- .isFormatText("xml");
-
- // simple entity set; $format and custom parameter after $id
- testUri.run("$entity?$id=ETAllPrim&$format=xml&abc=123").isKind(UriInfoKind.entityId)
- .isIdText("ETAllPrim")
- .isFormatText("xml")
- .isCustomParameter(0, "abc", "123");
-
- // simple entity set; $format before $id and custom parameter after $id
- testUri.run("$entity?$format=xml&$id=ETAllPrim&abc=123").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isIdText("ETAllPrim")
- .isCustomParameter(0, "abc", "123");
-
- // simple entity set; with qualifiedentityTypeName
- testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$id=ESBase")
- .isEntityType(EdmTechProvider.nameETTwoPrim)
- .isIdText("ESBase");
-
- // simple entity set; with qualifiedentityTypeName; with filter
- testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?$filter=PropertyInt16 eq 123&$id=ESAllKey")
- .isIdText("ESAllKey")
- .goFilter().is("<<PropertyInt16> eq <123>>");
-
- // simple entity set; with qualifiedentityTypeName;
- testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim")
- .isEntityType(EdmTechProvider.nameETBase)
- .isKind(UriInfoKind.entityId)
- .isIdText("ESTwoPrim");
-
- // simple entity set; with qualifiedentityTypeName; with format
- testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$format=atom")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EdmTechProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isFormatText("atom");
-
- // simple entity set; with qualifiedentityTypeName; with select
- testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$select=*")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EdmTechProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isSelectItemStar(0);
-
- // simple entity set; with qualifiedentityTypeName; with expand
- testUri.run("$entity/com.sap.odata.test1.ETBase?$id=ESTwoPrim&$expand=*")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EdmTechProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isExpandText("*")
- .goExpand().first().isSegmentStar(0);
-
- // simple entity set; with qualifiedentityTypeName; with 2xformat(before and after), expand, filter
- testUri.run("$entity/com.sap.odata.test1.ETTwoPrim?"
- + "$format=xml&$expand=*&abc=123&$id=ESBase&xyz=987&$filter=PropertyInt16 eq 123&$format=atom&$select=*")
- .isFormatText("atom")
- .isCustomParameter(0, "abc", "123")
- .isIdText("ESBase")
- .isCustomParameter(1, "xyz", "987")
- .isSelectItemStar(0);
- }
-
- @Test
- public void testEntitySet() {
-
- // plain entity set
- testRes.run("ESAllPrim")
- .isEntitySet("ESAllPrim")
- .isType(EdmTechProvider.nameETAllPrim);
-
- // with one key; simple key notation
- testRes.run("ESAllPrim(1)")
- .isEntitySet("ESAllPrim")
- .isType(EdmTechProvider.nameETAllPrim)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with one key; name value key notation
- testRes.run("ESAllPrim(PropertyInt16=1)")
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with two keys
- testRes.run("ESTwoKeyTwoPrim(PropertyInt16=1, PropertyString='ABC')")
- .isEntitySet("ESTwoKeyTwoPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'");
-
- // with all keys
- testRes.run("ESAllKey(" + allKeys + ")")
- .isEntitySet("ESAllKey")
- .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");
- }
-
- @Test
- public void testEntitySet_NavigationPropperty() {
-
- // plain entity set ...
-
- // with navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // with navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .at(2)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property -> navigation property -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .isType(EdmTechProvider.nameETKeyNav);
-
- // with navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
- .at(0)
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/PropertyString").at(0)
- .at(0)
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property(key) -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
-
- // with navigation property(key) -> navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .isType(EdmTechProvider.nameETKeyNav)
- .at(3)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property(key) -> navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EdmTechProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(3)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- }
-
- @Test
- public void testEntitySet_Property() {
-
- // plain entity set ...
-
- // with property
- testRes.run("ESAllPrim(1)/PropertyString")
- .at(0)
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with complex property
- testRes.run("ESCompAllPrim(1)/PropertyComplex")
- .at(0)
- .isEntitySet("ESCompAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false);
-
- // with two properties
- testRes.run("ESCompAllPrim(1)/PropertyComplex/PropertyString")
- .at(0)
- .isEntitySet("ESCompAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false)
- .at(2)
- .isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
- }
-
- @Test
- public void testEntitySet_TypeFilter() {
-
- // filter
- testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .isCollection(true);
-
- // filter before key predicate
- testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .at(0)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isCollection(false);
-
- // filter before key predicate; property of sub type
- testRes.run("ESTwoPrim/com.sap.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isType(EdmTechProvider.nameString)
- .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false);
-
- // filter after key predicate
- testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(null)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isCollection(false);
-
- // filter after key predicate; property of sub type
- testRes.run("ESTwoPrim(PropertyInt16=1)/com.sap.odata.test1.ETBase/AdditionalPropertyString_5")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EdmTechProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(null)
- .isTypeFilterOnEntry(EdmTechProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isPrimitiveProperty("AdditionalPropertyString_5", EdmTechProvider.nameString, false)
- .isType(EdmTechProvider.nameString);
-
- }
-
- @Test
- public void testFilterComplexMixedPriority() throws UriParserException {
- testFilter.runESabc("a or c and e ").isCompr("< <a> or < <c> and <e> >>");
- testFilter.runESabc("a or c and e eq f").isCompr("< <a> or < <c> and <<e> eq <f>>>>");
- testFilter.runESabc("a or c eq d and e ").isCompr("< <a> or <<<c> eq <d>> and <e> >>");
- testFilter.runESabc("a or c eq d and e eq f").isCompr("< <a> or <<<c> eq <d>> and <<e> eq <f>>>>");
- testFilter.runESabc("a eq b or c and e ").isCompr("<<<a> eq <b>> or < <c> and <e> >>");
- testFilter.runESabc("a eq b or c and e eq f").isCompr("<<<a> eq <b>> or < <c> and <<e> eq <f>>>>");
- testFilter.runESabc("a eq b or c eq d and e ").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <e> >>");
- testFilter.runESabc("a eq b or c eq d and e eq f").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <<e> eq <f>>>>");
- }
-
- @Test
- public void testFilterSimpleSameBinaryBinaryBinaryPriority() throws UriParserException {
-
- testFilter.runESabc("1 add 2 add 3 add 4").isCompr("<<< <1> add <2>> add <3>> add <4>>");
- testFilter.runESabc("1 add 2 add 3 div 4").isCompr("<< <1> add <2>> add <<3> div <4>>>");
- testFilter.runESabc("1 add 2 div 3 add 4").isCompr("<< <1> add <<2> div <3>>> add <4>>");
- testFilter.runESabc("1 add 2 div 3 div 4").isCompr("< <1> add <<<2> div <3>> div <4>>>");
- testFilter.runESabc("1 div 2 add 3 add 4").isCompr("<<< <1> div <2>> add <3>> add <4>>");
- testFilter.runESabc("1 div 2 add 3 div 4").isCompr("<< <1> div <2>> add <<3> div <4>>>");
- testFilter.runESabc("1 div 2 div 3 add 4").isCompr("<<< <1> div <2>> div <3>> add <4>>");
- testFilter.runESabc("1 div 2 div 3 div 4").isCompr("<<< <1> div <2>> div <3>> div <4>>");
-
- }
-
- @Test
- public void testFunctionImport_VarParameters() {
-
- // no input
- testRes.run("FINRTInt16()")
- .isFunctionImport("FINRTInt16")
- .isFunction("UFNRTInt16")
- .isType(EdmTechProvider.nameString);
-
- // one input
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav);
-
- // two input
- testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTStringTwoParam")
- .isFunction("UFCRTStringTwoParam")
- .isType(EdmTechProvider.nameString);
- }
-
- @Test
- public void testFunctionImport_VarRetruning() {
- // returning primitive
- testRes.run("FINRTInt16()")
- .isFunctionImport("FINRTInt16")
- .isFunction("UFNRTInt16")
- .isType(EdmTechProvider.nameString, false);
-
- // returning collection of primitive
- testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTCollStringTwoParam")
- .isFunction("UFCRTCollStringTwoParam")
- .isType(EdmTechProvider.nameString, true);
-
- // returning single complex
- testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTCTAllPrimTwoParam")
- .isFunction("UFCRTCTAllPrimTwoParam")
- .isType(EdmTechProvider.nameCTAllPrim, false);
-
- // returning collection of complex
- testRes.run("FICRTCollCTTwoPrim()")
- .isFunctionImport("FICRTCollCTTwoPrim")
- .isFunction("UFCRTCollCTTwoPrim")
- .isType(EdmTechProvider.nameCTTwoPrim, true);
-
- // returning single entity
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav, false);
-
- // returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav, true);
- }
-
- @Test
- public void testFunctionImportChain() {
-
- // test chain; returning single complex
- testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTCTAllPrimTwoParam")
- .isFunction("UFCRTCTAllPrimTwoParam")
- .isType(EdmTechProvider.nameCTAllPrim, false)
- .isParameter(0, "ParameterString", "'ABC'")
- .isParameter(1, "ParameterInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- // test chains; returning single entity
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- // test chains; returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
- .at(0)
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'");
-
- // test chains; returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EdmTechProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- }
-
- @Test
- public void testMetaData() {
-
- // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
- // On the producer side this feature is currently not supported, so the context fragment
- // part is only available as text.
-
- testUri.run("$metadata")
- .isKind(UriInfoKind.metadata);
-
- testUri.run("$metadata?$format=atom")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom");
-
- // with context (client usage)
-
- testUri.run("$metadata#$ref")
- .isKind(UriInfoKind.metadata)
- .isFragmentText("$ref");
-
- testUri.run("$metadata?$format=atom#$ref")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("$ref");
-
- testUri.run("$metadata?$format=atom#Collection($ref)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection($ref)");
-
- testUri.run("$metadata?$format=atom#Collection(Edm.EntityType)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection(Edm.EntityType)");
-
- testUri.run("$metadata?$format=atom#Collection(Edm.ComplexType)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection(Edm.ComplexType)");
-
- testUri.run("$metadata?$format=atom#SINav")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav");
-
- testUri.run("$metadata?$format=atom#SINav/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavOne");
-
- testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavMany(1)");
-
- testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#com.sap.odata.test1.ETAllKey")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("com.sap.odata.test1.ETAllKey");
-
- testUri.run("$metadata?$format=atom#ESTwoPrim/$deletedEntity")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$deletedEntity");
-
- testUri.run("$metadata?$format=atom#ESTwoPrim/$link")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$link");
-
- testUri.run("$metadata?$format=atom#ESTwoPrim/$deletedLink")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$deletedLink");
-
- testUri.run("$metadata?$format=atom#ESKeyNav")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run(
- "$metadata?$format=atom#ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/com.sap.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata?$format=atom#ESKeyNav(PropertyInt16,PropertyString)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav(PropertyInt16,PropertyString)");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/$entity")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/$entity");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/$delta")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/$delta");
-
- testUri.run("$metadata?$format=atom#ESKeyNav/(PropertyInt16,PropertyString)/$delta")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/(PropertyInt16,PropertyString)/$delta");
-
- }
-
- @Test
- public void testRef() {
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
- }
-
- @Test
- public void testSingleton() {
- // plain singleton
- testRes.run("SINav")
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void testNavigationProperty() {
-
- // plain entity set ...
-
- // with navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false);
-
- // with navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property -> navigation property -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav, false)
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
-
- // with navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'");
-
- // with navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property(key) -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false);
-
- // with navigation property(key) -> navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavMany(1)")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavOne/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false)
- .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
-
- // with navigation property(key) -> navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavMany(1)/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(3).isPrimitiveProperty("PropertyString", EdmTechProvider.nameString, false);
- }
-
- @Test
- public void testSingleton_Property() {
-
- // plain singleton ...
-
- // with property
- testRes.run("SINav/PropertyInt16")
- .at(0)
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .at(1)
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- // with complex property
- testRes.run("SINav/PropertyComplex")
- .at(0)
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .at(1)
- .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false);
-
- // with two properties
- testRes.run("SINav/PropertyComplex/PropertyInt16")
- .at(0)
- .isSingleton("SINav")
- .isType(EdmTechProvider.nameETTwoKeyNav)
- .at(1)
- .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTPrimComp, false)
- .at(2)
- .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false);
-
- }
-
- @Test
- public void testValue() {
- testUri.run("ESAllPrim(1)/PropertyString/$value");
- }
-
- @Test
- public void testMemberStartingWithCast() {
- // on EntityType entry
- // TODO inform OTTO
- testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?"
- + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .goFilter().root().isMember().goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isType(EdmTechTestProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EdmTechTestProvider.nameETBaseTwoKeyNav)
- .at(1).isType(EdmTechTestProvider.nameDate);
-
- // on EntityType collection
- testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .goFilter().root().isMember().goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isType(EdmTechTestProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav)
- .at(1).isType(EdmTechTestProvider.nameDate);
-
- testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
- + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
- .goFilter().root().isMember().goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isType(EdmTechTestProvider.nameCTTwoPrim, false)
- .isTypeFilterOnEntry(EdmTechTestProvider.nameCTBase)
- .at(1).isType(EdmTechTestProvider.nameString);
-
-// on Complex collection
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?"
- + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString")
- .goFilter().root().isMember().goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isType(EdmTechTestProvider.nameCTTwoPrim, true)
- .isTypeFilterOnCollection(EdmTechTestProvider.nameCTBase)
- .at(1).isType(EdmTechTestProvider.nameString);
-
- }
-
- @Test
- public void testComplexTypeCastFollowingAsCollection() {
- // TODO inform OTTO
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/com.sap.odata.test1.CTBase");
-
- }
-
- @Test
- public void testLambda() {
- testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/all( l : true )")
- .goFilter().is("<CollPropertyComplex/<ALL;<true>>>");
-
- testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( l : true )")
- .goFilter().is("<CollPropertyComplex/<ANY;<true>>>");
- testUri.run("ESTwoKeyNav?$filter=CollPropertyComplex/any( )")
- .goFilter().is("<CollPropertyComplex/<ANY;>>");
-
- testUri.run("ESTwoKeyNav?$filter=all( l : true )")
- .goFilter().is("<<ALL;<true>>>");
- testUri.run("ESTwoKeyNav?$filter=any( l : true )")
- .goFilter().is("<<ANY;<true>>>");
- testUri.run("ESTwoKeyNav?$filter=any( )")
- .goFilter().is("<<ANY;>>");
- }
-
- @Test
- public void testCustomQueryOption() {
- testUri.run("ESTwoKeyNav?custom")
- .isCustomParameter(0, "custom", null);
- testUri.run("ESTwoKeyNav?custom=ABC")
- .isCustomParameter(0, "custom", "ABC");
- }
-
- @Test
- public void testGeo() throws UriParserException {
- // TODO sync
- testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
- .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
- .isMethod(SupportedMethodCalls.GEODISTANCE, 2);
- testFilter.runOnETAllPrim("geo.length(PropertySByte)")
- .is("<geo.length(<PropertySByte>)>")
- .isMethod(SupportedMethodCalls.GEOLENGTH, 1);
- testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
- .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
- .isMethod(SupportedMethodCalls.GEOINTERSECTS, 2);
- }
-
- @Test
- public void testSelect() {
- testUri.run("ESTwoKeyNav?$select=*")
- .isSelectItemStar(0);
-
- testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.*")
- .isSelectItemAllOp(0, new FullQualifiedName("com.sap.odata.test1", "*"));
-
- testUri.run("ESTwoKeyNav?$select=PropertyString")
- .goSelectItemPath(0).isPrimitiveProperty("PropertyString", EdmTechTestProvider.nameString, false);
-
- testUri.run("ESTwoKeyNav?$select=PropertyComplex")
- .goSelectItemPath(0).isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false);
-
- testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyInt16")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
- .n()
- .isPrimitiveProperty("PropertyInt16", EdmTechTestProvider.nameInt16, false);
-
- testUri.run("ESTwoKeyNav?$select=PropertyComplex/PropertyComplex")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTPrimComp, false)
- .n()
- .isComplexProperty("PropertyComplex", EdmTechTestProvider.nameCTAllPrim, false);
-
- testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav")
- .goSelectItemPath(0)
- .first()
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isTypeFilterOnCollection(EdmTechTestProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav")
- .goSelectItemPath(0)
- .first()
- .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
-
- testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyComplexNav", EdmTechTestProvider.nameCTBasePrimCompNav, false)
- .n()
- .isTypeFilterOnCollection(EdmTechTestProvider.nameCTTwoBasePrimCompNav);
- ;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
deleted file mode 100644
index 3ab5110..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionTest.java
+++ /dev/null
@@ -1,307 +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.queryoption;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.AliasImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
-import org.junit.Test;
-
-//TOOD add getKind check to all
-public class QueryOptionTest {
-
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testAliasQueryOption() {
- AliasQueryOptionImpl option = new AliasQueryOptionImpl();
-
- ExpressionImpl expression = new LiteralImpl();
-
- option.setAliasValue(expression);
- assertEquals(expression, option.getValue());
- }
-
- @Test
- public void testExandItemImpl() {
- ExpandItemImpl option = new ExpandItemImpl();
-
- // input options
- ExpandOptionImpl expand = new ExpandOptionImpl();
- FilterOptionImpl filter = new FilterOptionImpl();
- InlineCountOptionImpl inlinecount = new InlineCountOptionImpl();
- OrderByOptionImpl orderby = new OrderByOptionImpl();
- SearchOptionImpl search = new SearchOptionImpl();
- SelectOptionImpl select = new SelectOptionImpl();
- SkipOptionImpl skip = new SkipOptionImpl();
- TopOptionImpl top = new TopOptionImpl();
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- option.setSystemQueryOption(expand);
- option.setSystemQueryOption(filter);
- option.setSystemQueryOption(inlinecount);
- option.setSystemQueryOption(orderby);
- option.setSystemQueryOption(search);
- option.setSystemQueryOption(select);
- option.setSystemQueryOption(skip);
- option.setSystemQueryOption(top);
- option.setSystemQueryOption(levels);
-
- assertEquals(expand, option.getExpandOption());
- assertEquals(filter, option.getFilterOption());
- assertEquals(inlinecount, option.getInlineCountOption());
- assertEquals(orderby, option.getOrderByOption());
- assertEquals(search, option.getSearchOption());
- assertEquals(select, option.getSelectOption());
- assertEquals(skip, option.getSkipOption());
- assertEquals(top, option.getTopOption());
- assertEquals(levels, option.getLevelsOption());
-
- // just for completeness
- option = new ExpandItemImpl();
- option.setSystemQueryOption(new IdOptionImpl());
-
- option = new ExpandItemImpl();
- List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
- list.add(expand);
- list.add(filter);
- option.setSystemQueryOptions(list);
- assertEquals(expand, option.getExpandOption());
- assertEquals(filter, option.getFilterOption());
-
- option = new ExpandItemImpl();
- assertEquals(false, option.isRef());
- option.setIsRef(true);
- assertEquals(true, option.isRef());
-
- option = new ExpandItemImpl();
- assertEquals(false, option.isStar());
- option.setIsStar(true);
- assertEquals(true, option.isStar());
-
- option = new ExpandItemImpl();
- UriInfoResource resource = new UriInfoImpl().asUriInfoResource();
- option.setResourceInfo(resource);
- assertEquals(resource, option.getResourceInfo());
-
- }
-
- @Test
- public void testExpandOptionImpl() {
- ExpandOptionImpl option = new ExpandOptionImpl();
- assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
-
- ExpandItemImpl item1 = new ExpandItemImpl();
- ExpandItemImpl item2 = new ExpandItemImpl();
- option.addExpandItem(item1);
- option.addExpandItem(item2);
- assertEquals(item1, option.getExpandItems().get(0));
- assertEquals(item2, option.getExpandItems().get(1));
- }
-
- @Test
- public void testFilterOptionImpl() {
- FilterOptionImpl option = new FilterOptionImpl();
- assertEquals(SupportedQueryOptions.FILTER, option.getKind());
-
- AliasImpl expression = new AliasImpl();
-
- option.setExpression(expression);
- assertEquals(expression, option.getExpression());
- }
-
- @Test
- public void testFormatOptionImpl() {
- FormatOptionImpl option = new FormatOptionImpl();
- assertEquals(SupportedQueryOptions.FORMAT, option.getKind());
-
- option.setFormat("A");
-
- assertEquals("A", option.getFormat());
- }
-
- @Test
- public void testIdOptionImpl() {
- IdOptionImpl option = new IdOptionImpl();
- assertEquals(SupportedQueryOptions.ID, option.getKind());
-
- option.setValue("A");
-
- assertEquals("A", option.getValue());
- }
-
- @Test
- public void testInlineCountImpl() {
- InlineCountOptionImpl option = new InlineCountOptionImpl();
- assertEquals(SupportedQueryOptions.INLINECOUNT, option.getKind());
-
- assertEquals(false, option.getValue());
- option.setValue(true);
- assertEquals(true, option.getValue());
- }
-
- @Test
- public void testLevelsExpandOptionImpl() {
- LevelsOptionImpl option = new LevelsOptionImpl();
- assertEquals(SupportedQueryOptions.LEVELS, option.getKind());
-
- assertEquals(0, option.getLevel());
- option.setLevel(1);
- assertEquals(1, option.getLevel());
-
- option = new LevelsOptionImpl();
- option.setMax();
- assertEquals(true, option.isMax());
- }
-
- @Test
- public void testOrderByItemImpl() {
- OrderByItemImpl option = new OrderByItemImpl();
-
- AliasImpl expression = new AliasImpl();
- option.setExpression(expression);
- assertEquals(expression, option.getExpression());
-
- assertEquals(false, option.isDescending());
- option.setDescending(true);
- assertEquals(true, option.isDescending());
- }
-
- @Test
- public void testOrderByOptionImpl() {
- OrderByOptionImpl option = new OrderByOptionImpl();
-
- OrderByItemImpl order0 = new OrderByItemImpl();
- OrderByItemImpl order1 = new OrderByItemImpl();
- option.addOrder(order0);
- option.addOrder(order1);
-
- assertEquals(order0, option.getOrders().get(0));
- assertEquals(order1, option.getOrders().get(1));
- }
-
- @Test
- public void testQueryOptionImpl() {
- QueryOptionImpl option = new AliasQueryOptionImpl();
-
- option.setName("A");
- option.setText("B");
- assertEquals("A", option.getName());
- assertEquals("B", option.getText());
- }
-
- @Test
- public void testSearchOptionImpl() {
- SearchOptionImpl option = new SearchOptionImpl();
- assertEquals(SupportedQueryOptions.SEARCH, option.getKind());
- // TODO $search not supported yet
- }
-
- @Test
- public void testSelectItemImpl() {
- SelectItemImpl option = new SelectItemImpl();
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
-
- // no typed collection else case ( e.g. if not path is added)
- option = new SelectItemImpl();
-
- option = new SelectItemImpl();
- assertEquals(false, option.isStar());
- option.setStar(true);
- assertEquals(true, option.isStar());
-
- option = new SelectItemImpl();
- assertEquals(false, option.isAllOperationsInSchema());
- FullQualifiedName fqName = new FullQualifiedName("Namespace", "Name");
- option.addAllOperationsInSchema(fqName);
- assertEquals(true, option.isAllOperationsInSchema());
- assertEquals(fqName, option.getAllOperationsInSchemaNameSpace());
-
- }
-
- @Test
- public void testSelectOptionImpl() {
- SelectOptionImpl option = new SelectOptionImpl();
- assertEquals(SupportedQueryOptions.SELECT, option.getKind());
-
- SelectItemImpl item0 = new SelectItemImpl();
- SelectItemImpl item1 = new SelectItemImpl();
-
- ArrayList<SelectItemImpl> list = new ArrayList<SelectItemImpl>();
- list.add(item0);
- list.add(item1);
- option.setSelectItems(list);
-
- assertEquals(item0, option.getSelectItems().get(0));
- assertEquals(item1, option.getSelectItems().get(1));
-
- }
-
- @Test
- public void testSkipOptionImpl() {
- SkipOptionImpl option = new SkipOptionImpl();
- assertEquals(SupportedQueryOptions.SKIP, option.getKind());
-
- option.setValue("A");
- assertEquals("A", option.getValue());
- }
-
- @Test
- public void testSkipTokenOptionImpl() {
- SkipTokenOptionImpl option = new SkipTokenOptionImpl();
- assertEquals(SupportedQueryOptions.SKIPTOKEN, option.getKind());
-
- option.setValue("A");
- assertEquals("A", option.getValue());
- }
-
- @Test
- public void testSystemQueryOptionImpl() {
- SystemQueryOptionImpl option = new SystemQueryOptionImpl();
-
- option.setKind(SupportedQueryOptions.EXPAND);
- assertEquals(SupportedQueryOptions.EXPAND, option.getKind());
-
- assertEquals("$expand", option.getName());
- }
-
- @Test
- public void testTopOptionImpl() {
- TopOptionImpl option = new TopOptionImpl();
- assertEquals(SupportedQueryOptions.TOP, option.getKind());
-
- option.setValue("A");
- assertEquals("A", option.getValue());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
deleted file mode 100644
index c3e8e2d..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
+++ /dev/null
@@ -1,282 +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.queryoption.expression;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Arrays;
-
-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.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-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.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.testutil.FilterTreeToText;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
-import org.junit.Test;
-
-public class ExpressionTest {
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testSupportedOperators() {
- assertEquals(SupportedUnaryOperators.MINUS, SupportedUnaryOperators.get("-") );
- assertEquals(null, SupportedUnaryOperators.get("XXX") );
-
- assertEquals(SupportedBinaryOperators.MOD, SupportedBinaryOperators.get("mod") );
- assertEquals(null, SupportedBinaryOperators.get("XXX") );
-
- assertEquals(SupportedMethodCalls.CONCAT, SupportedMethodCalls.get("concat") );
- assertEquals(null, SupportedMethodCalls.get("XXX") );
-
- assertEquals(SupportedConstants.TRUE, SupportedConstants.get("true") );
- assertEquals(null, SupportedConstants.get("XXX") );
- }
-
- @Test
- public void testAliasExpression() throws ExceptionVisitExpression, ODataApplicationException {
- AliasImpl expression = new AliasImpl();
-
- expression.setParameter("Test");
-
- assertEquals("Test", expression.getParameterName());
-
- String output = expression.accept(new FilterTreeToText());
- assertEquals("<Test>", output);
-
- }
-
- @Test
- public void testBinaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
- BinaryImpl expression = new BinaryImpl();
-
- ExpressionImpl expressionLeft = new LiteralImpl().setText("A");
- ExpressionImpl expressionRight = new LiteralImpl().setText("B");
-
- expression.setLeftOperand(expressionLeft);
- expression.setRightOperand(expressionRight);
- expression.setOperator(SupportedBinaryOperators.SUB);
-
- assertEquals(expressionLeft, expression.getLeftOperand());
- assertEquals(expressionRight, expression.getRightOperand());
- assertEquals(SupportedBinaryOperators.SUB, expression.getOperator());
-
- String output = expression.accept(new FilterTreeToText());
- assertEquals("<<A> sub <B>>", output);
- }
-
- @Test
- public void testConstantExpression() throws ExceptionVisitExpression, ODataApplicationException {
- ConstantImpl expression = new ConstantImpl();
- EdmType type = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- assertNotNull(type);
- expression.setType(type);
- assertEquals(type, expression.getType());
-
- expression.setKind(SupportedConstants.FALSE);
- assertEquals(SupportedConstants.FALSE, expression.getKind());
- assertEquals(true, expression.isFalse());
- assertEquals(false, expression.isTrue());
- assertEquals(false, expression.isNull());
- assertEquals("<false>", expression.accept(new FilterTreeToText()));
-
- expression.setKind(SupportedConstants.TRUE);
- assertEquals(SupportedConstants.TRUE, expression.getKind());
- assertEquals(false, expression.isFalse());
- assertEquals(true, expression.isTrue());
- assertEquals(false, expression.isNull());
- assertEquals("<true>", expression.accept(new FilterTreeToText()));
-
- expression.setKind(SupportedConstants.NULL);
- assertEquals(SupportedConstants.NULL, expression.getKind());
- assertEquals(false, expression.isFalse());
- assertEquals(false, expression.isTrue());
- assertEquals(true, expression.isNull());
- assertEquals("<null>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testEnumerationExpression() throws ExceptionVisitExpression, ODataApplicationException {
- EnumerationImpl expression = new EnumerationImpl();
- EdmEnumType type = (EdmEnumType) edm.getEnumType(EdmTechProvider.nameENString);
- assertNotNull(type);
- expression.setType(type);
-
- assertEquals(type, expression.getType());
-
- expression.addValue("A");
- expression.addValue("B");
- assertEquals("A", expression.getValues().get(0));
- assertEquals("B", expression.getValues().get(1));
- assertEquals("<com.sap.odata.test1.ENString<A,B>>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testLambdaRefExpression() throws ExceptionVisitExpression, ODataApplicationException {
- LambdaRefImpl expression = new LambdaRefImpl();
- expression.setVariableText("A");
- assertEquals("A", expression.getVariableName());
-
- assertEquals("<A>", expression.accept(new FilterTreeToText()));
-
- }
-
- @Test
- public void testLiteralExpresion() throws ExceptionVisitExpression, ODataApplicationException {
- LiteralImpl expression = new LiteralImpl();
- expression.setText("A");
- assertEquals("A", expression.getText());
-
- assertEquals("<A>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testMemberExpression() throws ExceptionVisitExpression, ODataApplicationException {
- MemberImpl expression = new MemberImpl();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
-
- // UriResourceImplTyped
- UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
- UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action)).asUriInfoResource();
- expression.setPath(uriInfo);
- assertEquals(action.getReturnType().getType(), expression.getType());
-
- // check accept and path
- assertEquals(uriInfo, expression.getPath());
- assertEquals("<UARTPrimParam>", expression.accept(new FilterTreeToText()));
-
- // UriResourceImplTyped check collection = false case
- assertEquals(false, expression.isCollection());
-
- // UriResourceImplTyped check collection = true case
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null);
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action))
- .asUriInfoResource());
- assertEquals(true, expression.isCollection());
-
- // UriResourceImplTyped with filter
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
- .asUriInfoResource());
- assertEquals(entityType, expression.getType());
-
- // UriResourceImplKeyPred
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function))
- .asUriInfoResource());
- assertEquals(function.getReturnType().getType(), expression.getType());
-
- // UriResourceImplKeyPred typeFilter on entry
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
- Arrays.asList(("ParameterInt16")));
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
- .asUriInfoResource());
- assertEquals(entityBaseType, expression.getType());
-
- // UriResourceImplKeyPred typeFilter on entry
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
- Arrays.asList(("ParameterInt16")));
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
- .asUriInfoResource());
- assertEquals(entityBaseType, expression.getType());
-
- // no typed
- resource = new UriInfoImpl().setKind(UriInfoKind.resource);
- entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
- Arrays.asList(("ParameterInt16")));
- expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all));
- assertEquals(null, expression.getType());
-
- // no typed collection else case
- assertEquals(false, expression.isCollection());
- }
-
- @Test
- public void testMethodCallExpression() throws ExceptionVisitExpression, ODataApplicationException {
- MethodCallImpl expression = new MethodCallImpl();
- expression.setMethod(SupportedMethodCalls.CONCAT);
-
- ExpressionImpl p0 = new LiteralImpl().setText("A");
- ExpressionImpl p1 = new LiteralImpl().setText("B");
- expression.addParameter(p0);
- expression.addParameter(p1);
-
- assertEquals(SupportedMethodCalls.CONCAT, expression.getMethod());
- assertEquals("<concat(<A>,<B>)>", expression.accept(new FilterTreeToText()));
-
- assertEquals(p0, expression.getParameters().get(0));
- assertEquals(p1, expression.getParameters().get(1));
- }
-
- @Test
- public void testTypeLiteralExpression() throws ExceptionVisitExpression, ODataApplicationException {
- TypeLiteralImpl expression = new TypeLiteralImpl();
- EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- expression.setType(entityBaseType);
-
- assertEquals(entityBaseType, expression.getType());
- assertEquals("<com.sap.odata.test1.ETBaseTwoKeyNav>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testUnaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
- UnaryImpl expression = new UnaryImpl();
- expression.setOperator(SupportedUnaryOperators.MINUS);
-
- ExpressionImpl operand = new LiteralImpl().setText("A");
- expression.setOperand(operand);
-
- assertEquals(SupportedUnaryOperators.MINUS, expression.getOperator());
- assertEquals(operand, expression.getOperand());
-
- assertEquals("<- <A>>", expression.accept(new FilterTreeToText()));
- }
-
-
-}
[25/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
deleted file mode 100644
index 1a79f87..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceLambdaRef.java
+++ /dev/null
@@ -1,26 +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;
-
-
-public interface UriResourceLambdaRef extends UriResourcePartTyped {
-
- public String getVariableText();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
deleted file mode 100644
index 5a8a89d..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceNavigation.java
+++ /dev/null
@@ -1,36 +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.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-
-public interface UriResourceNavigation extends UriResourcePartTyped {
-
- List<UriParameter> getKeyPredicates();
-
- EdmNavigationProperty getProperty();
-
- EdmType getTypeFilterOnCollection();
-
- EdmType getTypeFilterOnEntry();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
deleted file mode 100644
index 524c309..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePartTyped.java
+++ /dev/null
@@ -1,32 +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.EdmType;
-
-public interface UriResourcePartTyped extends UriResource {
-
- EdmType getType();
-
- boolean isCollection();
-
- String toString(boolean includeFilters);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePrimitiveProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePrimitiveProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePrimitiveProperty.java
deleted file mode 100644
index 9383a78..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourcePrimitiveProperty.java
+++ /dev/null
@@ -1,23 +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;
-
-public interface UriResourcePrimitiveProperty extends UriResourceProperty {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
deleted file mode 100644
index 5ff0fca..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceProperty.java
+++ /dev/null
@@ -1,27 +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;
-
-public interface UriResourceProperty extends UriResourcePartTyped {
-
- EdmProperty getProperty();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
deleted file mode 100644
index 525e7de..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRef.java
+++ /dev/null
@@ -1,23 +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;
-
-public interface UriResourceRef extends UriResource {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRoot.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRoot.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRoot.java
deleted file mode 100644
index 5c4d73e..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceRoot.java
+++ /dev/null
@@ -1,27 +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;
-
-/**
- * Class indicating the $root reference. $root may be used within filter to
- * refer to the current OData service
- */
-public interface UriResourceRoot extends UriResource {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
deleted file mode 100644
index 2f888db..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
+++ /dev/null
@@ -1,32 +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.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-
-public interface UriResourceSingleton extends UriResourcePartTyped {
-
- EdmSingleton getSingleton();
-
- EdmEntityType getEntityType();
-
- EdmEntityType getEntityTypeFilter();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceStartingTypeFilter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceStartingTypeFilter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceStartingTypeFilter.java
deleted file mode 100644
index 9f3bef0..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceStartingTypeFilter.java
+++ /dev/null
@@ -1,29 +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.EdmType;
-
-public interface UriResourceStartingTypeFilter extends UriResourcePartTyped {
-
- EdmType getTypeFilterOnCollection();
-
- EdmType getTypeFilterOnEntry();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
deleted file mode 100644
index 71449b5..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceValue.java
+++ /dev/null
@@ -1,23 +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;
-
-public interface UriResourceValue extends UriResource {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionNode.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionNode.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionNode.java
deleted file mode 100644
index 31f541d..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionNode.java
+++ /dev/null
@@ -1,76 +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.optiontree;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.InlineCountOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-
-/**
- * Contains the merged $expand and $select options
- */
-public interface OptionNode {
-
- /**
- * Contains the list of non navigation properties which should serialized at this expand level.
- */
- List<UriResourceProperty> getPropertyChainList();
-
- List<OptionProperty> getExpandetNavigationProperties();
-
- /**
- * Contains the filter which should be applied to this expand level.
- */
- FilterOption getFilter();
-
- /**
- * Contains the search information which should be applied to this expand level.
- */
- SearchOption getSearch();
-
- /**
- * Contains the orderBy information which should be applied to this expand level.
- */
- OrderByOption getOrderBy();
-
- /**
- * Contains the information about how many output entities should be skipped at this
- * expand level.
- */
- SkipOption getSkip();
-
- /**
- * Contains the information about how many output items should be serialized at this
- * expand level.
- */
- TopOption getTop();
-
- /**
- * Contains the information whether the number of output items should be serialized
- * at this expand level
- */
- InlineCountOption getInlineCount();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionProperty.java
deleted file mode 100644
index bc9c8e2..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/optiontree/OptionProperty.java
+++ /dev/null
@@ -1,27 +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.optiontree;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-
-public interface OptionProperty {
- EdmNavigationProperty getNavigationProperty();
-
- OptionNode getOptionNode();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
deleted file mode 100644
index 33901b0..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/AliasQueryOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-
-public interface AliasQueryOption extends QueryOption {
-
- public Expression getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/CustomQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/CustomQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/CustomQueryOption.java
deleted file mode 100644
index cbc395b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/CustomQueryOption.java
+++ /dev/null
@@ -1,23 +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.queryoption;
-
-public interface CustomQueryOption extends QueryOption {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
deleted file mode 100644
index 4e9f332..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExceptionVisitExpand.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public class ExceptionVisitExpand extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
deleted file mode 100644
index 10693b4..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandItem.java
+++ /dev/null
@@ -1,49 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-
-public interface ExpandItem {
-
- LevelsExpandOption getLevelsOption();
-
- FilterOption getFilterOption();
-
- SearchOption getSearchOption();
-
- OrderByOption getOrderByOption();
-
- SkipOption getSkipOption();
-
- TopOption getTopOption();
-
- InlineCountOption getInlineCountOption();
-
- SelectOption getSelectOption();
-
- ExpandOption getExpandOption();
-
- UriInfoResource getResourceInfo();
-
- boolean isStar();
-
- boolean isRef();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
deleted file mode 100644
index ccfb394..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/ExpandOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-import java.util.List;
-
-public interface ExpandOption extends SystemQueryOption {
-
- List<ExpandItem> getExpandItems();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
deleted file mode 100644
index 98b260b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FilterOption.java
+++ /dev/null
@@ -1,26 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-
-public interface FilterOption extends SystemQueryOption {
-
- Expression getExpression();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
deleted file mode 100644
index 367ab13..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/FormatOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface FormatOption extends SystemQueryOption {
-
- // TODO Select best representation for format
- String getFormat();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
deleted file mode 100644
index 1c23355..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/IdOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface IdOption extends SystemQueryOption {
-
- String getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
deleted file mode 100644
index 7e9c75b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/InlineCountOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface InlineCountOption extends SystemQueryOption {
-
- boolean getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelsExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelsExpandOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelsExpandOption.java
deleted file mode 100644
index d28d5b1..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/LevelsExpandOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-public interface LevelsExpandOption {
-
- boolean isMax();
-
- int getLevel();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
deleted file mode 100644
index d5aae45..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByItem.java
+++ /dev/null
@@ -1,34 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-
-public interface OrderByItem {
-
- /**
- * Returns the sort order of the orderBy item
- * @return if false (default) the sort order is ascending, if true the sort order is descending
- */
- boolean isDescending();
-
- Expression getExpression();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
deleted file mode 100644
index 609306f..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/OrderByOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-import java.util.List;
-
-public interface OrderByOption extends SystemQueryOption {
-
- List<OrderByItem> getOrders();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
deleted file mode 100644
index e1e70d4..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/QueryOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-public interface QueryOption {
-
- public String getName();
-
- public String getText();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
deleted file mode 100644
index a3b2e5b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SearchOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.search.SearchExpression;
-
-public interface SearchOption extends SystemQueryOption {
-
- SearchExpression getSearchExpression();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
deleted file mode 100644
index 53dd691..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectItem.java
+++ /dev/null
@@ -1,34 +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.queryoption;
-
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-
-public interface SelectItem {
-
- boolean isStar();
-
- boolean isAllOperationsInSchema();
-
- FullQualifiedName getAllOperationsInSchemaNameSpace();
-
- UriInfoResource getResourceInfo();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
deleted file mode 100644
index 7b301fa..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SelectOption.java
+++ /dev/null
@@ -1,27 +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.queryoption;
-
-import java.util.List;
-
-public interface SelectOption extends SystemQueryOption {
-
- List<SelectItem> getSelectItems();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
deleted file mode 100644
index e9a64e3..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface SkipOption extends SystemQueryOption {
-
- String getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
deleted file mode 100644
index 94b898a..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SkipTokenOption.java
+++ /dev/null
@@ -1,26 +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.queryoption;
-
-public interface SkipTokenOption extends SystemQueryOption {
-
- String getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.java
deleted file mode 100644
index 9b9c134..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SupportedQueryOptions.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.queryoption;
-
-public enum SupportedQueryOptions {
- FILTER("$filter"),
- FORMAT("$format"),
- EXPAND("$expand"),
- ID("$id"),
- INLINECOUNT("$inlinecount"),
- ORDERBY("$orderby"),
- SEARCH("$search"),
- SELECT("$select"),
- SKIP("$skip"),
- SKIPTOKEN("$skiptoken"),
- TOP("$top"),
- LEVELS("$level");
-
- String syntax;
-
- private SupportedQueryOptions(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
deleted file mode 100644
index 8abafbd..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/SystemQueryOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface SystemQueryOption extends QueryOption {
-
- SupportedQueryOptions getKind();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
deleted file mode 100644
index acaf463..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/TopOption.java
+++ /dev/null
@@ -1,25 +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.queryoption;
-
-public interface TopOption extends SystemQueryOption {
-
- String getValue();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
deleted file mode 100644
index e7f41af..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
+++ /dev/null
@@ -1,25 +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.queryoption.expression;
-
-public interface AliasExpression extends Expression {
-
- public String getParameterName();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
deleted file mode 100644
index bd4d159..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/BinaryExpression.java
+++ /dev/null
@@ -1,29 +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.queryoption.expression;
-
-public interface BinaryExpression extends Expression {
-
- public SupportedBinaryOperators getOperator();
-
- public Expression getLeftOperand();
-
- public Expression getRightOperand();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Constant.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Constant.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Constant.java
deleted file mode 100644
index 0961be6..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Constant.java
+++ /dev/null
@@ -1,35 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-
-public interface Constant extends Expression {
-
- public boolean isNull();
-
- public boolean isTrue();
-
- public boolean isFalse();
-
- public SupportedConstants getKind();
-
- public EdmType getType();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
deleted file mode 100644
index d870c56..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
+++ /dev/null
@@ -1,30 +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.queryoption.expression;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-
-public interface Enumeration extends Expression {
-
- public List<String> getValues();
- public EdmEnumType getType();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
deleted file mode 100644
index f722ec0..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExceptionVisitExpression.java
+++ /dev/null
@@ -1,25 +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.queryoption.expression;
-
-public class ExceptionVisitExpression extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
deleted file mode 100644
index 5a1b8b1..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Expression.java
+++ /dev/null
@@ -1,23 +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.queryoption.expression;
-
-public interface Expression extends VisitableExression {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
deleted file mode 100644
index ea3bc3e..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/ExpressionVisitor.java
+++ /dev/null
@@ -1,56 +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.queryoption.expression;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-
-public interface ExpressionVisitor<T> {
-
- T visitBinaryOperator(SupportedBinaryOperators operator, T left, T right)
- throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitUnaryOperator(SupportedUnaryOperators operator, T operand)
- throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitMethodCall(SupportedMethodCalls methodCall, List<T> parameters)
- throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitLambdaExpression(String functionText,String variableText, Expression expression)
- throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitLiteral(String literal) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitMember(UriInfoResource member) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitAlias(String referenceName) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitTypeLiteral(EdmType type) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitLambdaReference(String variableText) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitEnum(EdmEnumType type, List<String> enumValues) throws ExceptionVisitExpression, ODataApplicationException;
-
- T visitConstant(SupportedConstants kind) throws ExceptionVisitExpression, ODataApplicationException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
deleted file mode 100644
index 67a18b6..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/LambdaRef.java
+++ /dev/null
@@ -1,25 +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.queryoption.expression;
-
-public interface LambdaRef extends Expression {
-
- public String getVariableName();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
deleted file mode 100644
index 1d9a76c..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Literal.java
+++ /dev/null
@@ -1,25 +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.queryoption.expression;
-
-public interface Literal extends Expression {
-
- public String getText();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
deleted file mode 100644
index a15d422..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Member.java
+++ /dev/null
@@ -1,32 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-
-public interface Member extends Expression {
-
- public UriInfoResource getPath();
-
- public EdmType getType();
-
- public boolean isCollection();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
deleted file mode 100644
index 31dfe9b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/MethodCall.java
+++ /dev/null
@@ -1,29 +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.queryoption.expression;
-
-import java.util.List;
-
-public interface MethodCall extends Expression {
-
- public SupportedMethodCalls getMethod();
-
- public List<Expression> getParameters();
-
-}
[14/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
deleted file mode 100644
index a337171..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
+++ /dev/null
@@ -1,1975 +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.testutil;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.provider.Action;
-import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.AliasInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainerInfo;
-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.FullQualifiedName;
-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.NavigationPropertyBinding;
-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.Target;
-import org.apache.olingo.odata4.commons.api.exception.ODataException;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-
-public class EdmTechProvider extends EdmProvider {
-
- public static final String nameSpace = "com.sap.odata.test1";
-
- public static final FullQualifiedName nameBAESAllPrimRTETAllPrim =
- new FullQualifiedName(nameSpace, "BAESAllPrimRTETAllPrim");
-
- public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BAESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(nameSpace, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(nameSpace, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(nameSpace, "BAETTwoKeyNavRTETTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
- new FullQualifiedName(nameSpace, "BFCCollCTPrimCompRTESAllPrim");
-
- public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCCollStringRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNavParam =
- new FullQualifiedName(nameSpace, "BFCCTPrimCompRTESTwoKeyNavParam");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
- new FullQualifiedName(nameSpace, "BFCCTPrimCompRTETTwoKeyNavParam");
-
- public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
- new FullQualifiedName(nameSpace, "BFCESAllPrimRTCTAllPrim");
-
- public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
- new FullQualifiedName(nameSpace, "BFCESBaseTwoKeyNavRTESBaseTwoKey");
-
- public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav =
- new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNav");
-
- public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
- new FullQualifiedName(nameSpace, "BFCESKeyNavRTETKeyNavParam");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollCTTwoPrim");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCollString");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTCTTwoPrim");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTString =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTString");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTStringParam");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCESTwoKeyNavRTTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
- new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESBaseTwoKey");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
- new FullQualifiedName(nameSpace, "BFCETKeyNavRTETKeyNav");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
- new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTCTTwoPrim");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCETTwoKeyNavRTETTwoKeyNav");
-
- public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCSINavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFCStringRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(nameSpace, "BFESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBinary = EdmPrimitiveTypeKind.Binary.getFullQualifiedName();
- public static final FullQualifiedName nameBoolean = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
- public static final FullQualifiedName nameByte = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
- public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container");
- public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(nameSpace, "CTAllPrim");
- public static final FullQualifiedName nameCTBase = new FullQualifiedName(nameSpace, "CTBase");
- public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(nameSpace, "CTBasePrimCompNav");
- 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");
- public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(nameSpace, "CTCompNav");
-
- public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(nameSpace, "CTMixPrimCollComp");
- public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(nameSpace, "CTNavFiveProp");
- public static final FullQualifiedName nameCTPrim = new FullQualifiedName(nameSpace, "CTPrim");
- public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(nameSpace, "CTPrimComp");
- public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(nameSpace, "CTPrimEnum");
- public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(nameSpace, "CTTwoBase");
- public static final FullQualifiedName nameCTTwoBasePrimCompNav =
- new FullQualifiedName(nameSpace, "CTTwoBasePrimCompNav");
- 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");
- public static final FullQualifiedName nameETAllKey = new FullQualifiedName(nameSpace, "ETAllKey");
- public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(nameSpace, "ETAllNullable");
- public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(nameSpace, "ETAllPrim");
- public static final FullQualifiedName nameETBase = new FullQualifiedName(nameSpace, "ETBase");
- public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(nameSpace, "ETBaseTwoKeyNav");
- public static final FullQualifiedName nameETBaseTwoKeyTwoPrim =
- new FullQualifiedName(nameSpace, "ETBaseTwoKeyTwoPrim");
- public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(nameSpace, "ETCollAllPrim");
- public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(nameSpace, "ETCompAllPrim");
- public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(nameSpace, "ETCompCollAllPrim");
- public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(nameSpace, "ETCompCollComp");
- public static final FullQualifiedName nameETCompComp = new FullQualifiedName(nameSpace, "ETCompComp");
- public static final FullQualifiedName nameETCompMixPrimCollComp =
- new FullQualifiedName(nameSpace, "ETCompMixPrimCollComp");
- public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(nameSpace, "ETFourKeyAlias");
- public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(nameSpace, "ETKeyNav");
- public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(nameSpace, "ETKeyPrimNav");
- public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(nameSpace, "ETKeyTwoKeyComp");
- public static final FullQualifiedName nameETMedia = new FullQualifiedName(nameSpace, "ETMedia");
- public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(nameSpace, "ETMixPrimCollComp");
- public static final FullQualifiedName nameETServerSidePaging =
- new FullQualifiedName(nameSpace, "ETServerSidePaging");
- public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(nameSpace, "ETTwoBase");
- public static final FullQualifiedName nameETTwoBaseTwoKeyNav =
- new FullQualifiedName(nameSpace, "ETTwoBaseTwoKeyNav");
- public 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 nameGuid = 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();
- public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(nameSpace, "UARTCompCollParam");
- public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(nameSpace, "UARTCompParam");
- public static final FullQualifiedName nameUARTETCollAllPrimParam =
- new FullQualifiedName(nameSpace, "UARTETCollAllPrimParam");
-
- public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
- public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
- public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
- public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
- new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim");
- public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam =
- new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrimParam");
- public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(nameSpace, "UFCRTCollString");
- public static final FullQualifiedName nameUFCRTCollStringTwoParam =
- new FullQualifiedName(nameSpace, "UFCRTCollStringTwoParam");
- public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam =
- new FullQualifiedName(nameSpace, "UFCRTCTAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(nameSpace, "UFCRTCTTwoPrim");
- public static final FullQualifiedName nameUFCRTCTTwoPrimParam =
- new FullQualifiedName(nameSpace, "UFCRTCTTwoPrimParam");
- public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam =
- new FullQualifiedName(nameSpace, "UFCRTESMixPrimCollCompTwoParam");
- public static final FullQualifiedName nameUFCRTESTwoKeyNavParam =
- new FullQualifiedName(nameSpace, "UFCRTESTwoKeyNavParam");
- public static final FullQualifiedName nameUFCRTETAllPrimTwoParam =
- new FullQualifiedName(nameSpace, "UFCRTETAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(nameSpace, "UFCRTETKeyNav");
- public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(nameSpace, "UFCRTETMedia");
-
- public static final FullQualifiedName nameUFCRTETTwoKeyNavParam =
- new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParam");
-
- public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim =
- new FullQualifiedName(nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim");
-
- public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(nameSpace, "UFCRTString");
-
- public static final FullQualifiedName nameUFCRTStringTwoParam =
- new FullQualifiedName(nameSpace, "UFCRTStringTwoParam");
-
- public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam =
- new FullQualifiedName(nameSpace, "UFNRTESMixPrimCollCompTwoParam");
- public 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");
-
- NavigationProperty collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavOne")
- .setType(nameETTwoKeyNav);
-
- Property collPropertyBinary = new Property()
- .setName("CollPropertyBinary")
- .setType(nameBinary)
- .setCollection(true);
-
- Property collPropertyBoolean = new Property()
- .setName("CollPropertyBoolean")
- .setType(nameBoolean)
- .setCollection(true);
-
- Property collPropertyByte = new Property()
- .setName("CollPropertyByte")
- .setType(nameByte)
- .setCollection(true);
-
- 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(nameDate)
- .setCollection(true);
-
- Property collPropertyDateTimeOffset = new Property()
- .setName("CollPropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setCollection(true);
-
- Property collPropertyDecimal = new Property()
- .setName("CollPropertyDecimal")
- .setType(nameDecimal)
- .setCollection(true);
-
- Property collPropertyDouble = new Property()
- .setName("CollPropertyDouble")
- .setType(nameDouble)
- .setCollection(true);
-
- Property collPropertyDuration = new Property()
- .setName("CollPropertyDuration")
- .setType(nameDuration)
- .setCollection(true);
- Property collPropertyGuid = new Property()
- .setName("CollPropertyGuid")
- .setType(nameGuid)
- .setCollection(true);
- Property collPropertyInt16 = new Property()
- .setName("CollPropertyInt16")
- .setType(nameInt16)
- .setCollection(true);
- Property collPropertyInt32 = new Property()
- .setName("CollPropertyInt32")
- .setType(nameInt32)
- .setCollection(true);
- Property collPropertyInt64 = new Property()
- .setName("CollPropertyInt64")
- .setType(nameInt64)
- .setCollection(true);
-
- Property collPropertySByte = new Property()
- .setName("CollPropertySByte")
- .setType(nameSByte)
- .setCollection(true);
-
- Property collPropertySingle = new Property()
- .setName("CollPropertySingle")
- .setType(nameSingle)
- .setCollection(true);
- Property collPropertyString = new Property()
- .setName("CollPropertyString")
- .setType(nameString)
- .setCollection(true);
- Property collPropertyTimeOfDay = new Property()
- .setName("CollPropertyTimeOfDay")
- .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);
-
- /*
- * TODO add stream property
- * Property propertyStream = new Property()
- * .setName("PropertyStream")
- * .setType(EdmStream.getFullQualifiedName());
- */
- NavigationProperty navPropertyETKeyPrimNavOne = new NavigationProperty()
- .setName("NavPropertyETKeyPrimNavOne")
- .setType(nameETKeyPrimNav);
-
- NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavOne")
- .setType(nameETTwoKeyNav);
- 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);
- 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);
- 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);
- 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(nameGuid);
-
- Property propertyInt16 = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16);
-
- Property propertyInt16_NotNullable = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16);
- 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);
-
- 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);
-
- Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay")
- .setType(nameTimeOfDay);
-
- @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 List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- if (actionName.equals(nameUARTPrimParam)) {
- return Arrays.asList(
- new Action().setName("UARTPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
-
- .setReturnType(new ReturnType().setType(nameString))
- );
-
- } else if (actionName.equals(nameUARTPrimCollParam)) {
- return Arrays.asList(
- new Action().setName("UARTPrimCollParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
-
- .setReturnType(
- new ReturnType().setType(nameString).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTCompParam)) {
- return Arrays.asList(
- new Action().setName("UARTCompParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
-
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTCompCollParam)) {
- return Arrays.asList(
- new Action().setName("UARTCompCollParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
-
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTETParam)) {
- return Arrays.asList(
- new Action().setName("UARTCompCollParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTETCollAllPrimParam)) {
- return Arrays.asList(
- new Action().setName("UARTETCollAllPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
-
- .setReturnType(
- new ReturnType().setType(nameETCollAllPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav))
- ,
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETKeyNav").setType(nameETKeyNav)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
- return Arrays.asList(
- new Action().setName("BAESAllPrimRTETAllPrim")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterESAllPrim").setType(nameETAllPrim).setCollection(true)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETAllPrim))
- );
-
- } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAESTwoKeyNavRTESTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(nameETTwoKeyNav).setCollection(true)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(nameETBaseTwoKeyNav)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(nameETTwoBaseTwoKeyNav)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(nameETBaseTwoKeyNav))
- );
- }
-
- return null;
- }
-
- @Override
- public List<AliasInfo> getAliasInfos() throws ODataException {
- return Arrays.asList(
- new AliasInfo().setAlias("Namespace1_Alias").setNamespace(nameSpace)
- );
- }
-
- @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 add steam property */));
-
- } 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 add collectionPropertyStream */));
-
- } else if (complexTypeName.equals(nameCTTwoPrim)) {
- return new ComplexType()
- .setName("CTTwoPrim")
- .setProperties(Arrays.asList(propertyInt16, propertyString));
-
- } else if (complexTypeName.equals(nameCTCompNav)) {
- return new ComplexType()
- .setName("CTCompNav")
- .setProperties(Arrays.asList(propertyInt16, propertyComplex_CTNavFiveProp));
-
- } 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")
- .setBaseType(nameCTTwoPrim)
- .setProperties(Arrays.asList(
- new Property()
- .setName("AdditionalPropString")
- .setType(new FullQualifiedName("Edm", "String"))));
-
- } else if (complexTypeName.equals(nameCTTwoBase)) {
- return new ComplexType()
- .setName("CTTwoBase")
- .setBaseType(nameCTBase)
- .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))
- .setNavigationProperties((Arrays.asList(
- collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
- collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- new NavigationProperty()
- .setName("NavPropertyETMediaOne")
- .setType(nameETMedia),
- new NavigationProperty()
- .setName("NavPropertyETMediaMany")
- .setType(nameETMedia).setCollection(true)
- )));
-
- } else if (complexTypeName.equals(nameCTBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTBasePrimCompNav")
- .setBaseType(nameCTPrimComp)
- .setNavigationProperties(Arrays.asList(
- collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav));
-
- } else if (complexTypeName.equals(nameCTPrimEnum)) {
- return new ComplexType()
- .setName("CTPrimEnum")
- .setProperties(Arrays.asList(propertyInt16, propertyEnumString_ENString));
-
- } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTTwoBasePrimCompNav")
- .setBaseType(nameCTBasePrimCompNav);
-
- }
-
- 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 == nameContainer) {
- if (name.equals("ESAllPrim")) {
- return new EntitySet()
- .setName("ESAllPrim")
- .setType(nameETAllPrim);
-
- } else if (name.equals("ESCollAllPrim")) {
- return new EntitySet()
- .setName("ESCollAllPrim")
- .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);
- } 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);
- } else if (name.equals("ESFourKeyAlias")) {
- return new EntitySet()
- .setName("ESFourKeyAlias")
- .setType(nameETFourKeyAlias);
- }
- }
-
- return null;
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
-
- if (entityTypeName.equals(nameETAllPrim)) {
- return new EntityType()
- .setName("ETAllPrim")
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyString,
- propertyBoolean, propertyByte, propertySByte,
- propertyInt32, propertyInt64,
- propertySingle, propertyDouble, propertyDecimal,
- propertyBinary, propertyDate, propertyDateTimeOffset,
- propertyDuration, propertyGuid,
- propertyTimeOfDay /* TODO add stream property */));
-
- } else if (entityTypeName.equals(nameETCollAllPrim)) {
- return new EntityType()
- .setName("ETCollAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable,
- collPropertyString, collPropertyBoolean,
- collPropertyByte, collPropertySByte,
- collPropertyInt16, collPropertyInt32, collPropertyInt64,
- collPropertySingle, collPropertyDouble, collPropertyDecimal,
- collPropertyBinary, collPropertyDate, collPropertyDateTimeOffset,
- collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream property */));
-
- } else if (entityTypeName.equals(nameETTwoPrim)) {
- return new EntityType()
- .setName("ETTwoPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyString));
-
- } else if (entityTypeName.equals(nameETMixPrimCollComp)) {
- return new EntityType()
- .setName("ETMixPrimCollComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, collPropertyString,
- propertyComplex_CTTwoPrim, collPropertyComplex_CTTwoPrim));
-
- } else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) {
- return new EntityType()
- .setName("ETTwoKeyTwoPrim")
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16"),
- new PropertyRef().setPropertyName("PropertyString")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyString));
-
- } else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) {
- return new EntityType()
- .setName("ETBaseTwoKeyTwoPrim")
- .setBaseType(nameETTwoKeyTwoPrim);
-
- } else if (entityTypeName.equals(nameETTwoBaseTwoKeyTwoPrim)) {
- return new EntityType()
- .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")
- .setBaseType(nameETBase)
- .setProperties(Arrays.asList(new Property()
- .setName("AdditionalPropertyString_6")
- .setType(nameString))
- );
-
- } else if (entityTypeName.equals(nameETAllKey)) {
- return new EntityType()
- .setName("ETAllKey")
- .setKey(Arrays.asList(
- 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")))
- .setProperties(Arrays.asList(
- propertyString, propertyBoolean,
- propertyByte, propertySByte,
- propertyInt16, propertyInt32, propertyInt64,
- propertyDecimal, propertyDate,
- propertySingle, propertyDouble, propertyDateTimeOffset,
- propertyDuration, propertyGuid,
- propertyTimeOfDay /* TODO add stream property */));
-
- } else if (entityTypeName.equals(nameETCompAllPrim)) {
- return new EntityType()
- .setName("ETCompAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTAllPrim));
-
- } else if (entityTypeName.equals(nameETCompCollAllPrim)) {
- return new EntityType()
- .setName("ETCompAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCollAllPrim));
-
- } else if (entityTypeName.equals(nameETCompComp)) {
- return new EntityType()
- .setName("ETCompComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompComp));
-
- } else if (entityTypeName.equals(nameETCompCollComp)) {
- return new EntityType()
- .setName("ETCompCollComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyComplex_CTCompCollComp));
-
- } else if (entityTypeName.equals(nameETMedia)) {
- return new EntityType()
- .setName("ETCompCollComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyInt16_NotNullable))
- .setHasStream(true);
-
- } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) {
- return new EntityType()
- .setName("ETKeyTwoKeyComp")
- .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")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp));
-
- } else if (entityTypeName.equals(nameETServerSidePaging)) {
- return new EntityType()
- .setName("ETKeyTwoKeyComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString));
-
- } else if (entityTypeName.equals(nameETAllNullable)) {
- return new EntityType()
- .setName("ETAllNullable")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey")))
- .setProperties(Arrays.asList(
- new Property()
- .setName("PropertyKey").setType(nameInt16),
- propertyInt16,
- propertyString, propertyBoolean,
- propertyByte, propertySByte,
- propertyInt32, propertyInt64,
- propertySingle, propertyDouble,
- propertyDecimal, propertyBinary, propertyDate,
- propertyDateTimeOffset,
- propertyDuration, propertyGuid, propertyTimeOfDay /* TODO add stream property */,
- collPropertyString, collPropertyBoolean,
- collPropertyByte, collPropertySByte,
- collPropertyInt16,
- collPropertyInt32, collPropertyInt64,
- collPropertySingle, collPropertyDouble,
- collPropertyDecimal, collPropertyBinary, collPropertyDate,
- collPropertyDateTimeOffset,
- collPropertyDuration, collPropertyGuid, collPropertyTimeOfDay /* TODO add stream property */));
-
- } else if (entityTypeName.equals(nameETKeyNav)) {
- return new EntityType()
- .setName("ETKeyNav")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyString_NotNullable, propertyComplex_CTNavFiveProp,
- propertyComplexAllPrim_CTAllPrim, propertyComplexTwoPrim_CTTwoPrim,
- collPropertyString, collPropertyInt16, collPropertyComplex_CTPrimComp,
- new Property()
- .setName("PropertyComplexComplex").setType(nameCTCompNav)
- ))
- .setNavigationProperties(Arrays.asList(
- navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
- navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia
- ));
- } else if (entityTypeName.equals(nameETKeyPrimNav)) {
- return new EntityType()
- .setName("ETKeyNav")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable, propertyString_NotNullable))
- .setNavigationProperties(Arrays.asList(
- navPropertyETTwoKeyNavOne_ETTwoKeyNav, collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- navPropertyETKeyNavOne_ETKeyNav, collectionNavPropertyETKeyNavMany_ETKeyNav,
- navPropertyETMediaOne_ETMedia, collectionNavPropertyETMediaMany_ETMedia
- ));
-
- } else if (entityTypeName.equals(nameETTwoKeyNav)) {
- return new EntityType()
- .setName("ETTwoKeyNav")
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16"),
- new PropertyRef().setPropertyName("PropertyString")))
- .setProperties(Arrays.asList(
- propertyInt16, propertyString, propertyComplex_CTPrimComp_NotNullable,
- new Property().setName("PropertyComplexNav").setType(nameCTBasePrimCompNav),
- propertyComplexEnum_CTPrimEnum_NotNullable,
- collPropertyComplex_CTPrimComp,
- new Property().setName("CollPropertyComplexNav").setType(nameCTNavFiveProp).setCollection(true),
- 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,
- navPropertyETTwoKeyNavOne_ETTwoKeyNav,
- collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav));
-
- } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
- return new EntityType()
- .setName("ETBaseTwoKeyNav")
- .setBaseType(nameETTwoKeyNav)
- .setProperties(Arrays.asList(propertyDate))
- .setNavigationProperties(Arrays.asList(
- new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNav")
- .setType(nameETBaseTwoKeyNav),
- new NavigationProperty()
- .setName("NavPropertyETTwoBaseTwoKeyNav")
- .setType(nameETTwoBaseTwoKeyNav)))
- .setHasStream(true);
-
- } else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) {
- return new EntityType()
- .setName("ETTwoBaseTwoKeyNav")
- .setBaseType(nameETBaseTwoKeyNav)
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(propertyGuid))
- .setNavigationProperties(Arrays.asList(
- new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNavOne")
- .setType(nameETBaseTwoKeyNav),
- new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNavMany")
- .setType(nameETBaseTwoKeyNav)
- .setCollection(true)
- ));
-
- } else if (entityTypeName.equals(nameETFourKeyAlias)) {
- return new EntityType()
- .setName("ETFourKeyAlias")
- .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")))
- .setProperties(Arrays.asList(propertyGuid, propertyComplex_CTTwoPrim, propertyComplexComplex_CTCompComp));
- }
-
- 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")));
- }
-
- 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 (name.equals("FINInvisibleRTInt16")) {
- return new FunctionImport()
- .setName("FINInvisibleRTInt16")
- .setFunction(nameUFNRTInt16);
-
- } else if (name.equals("FINInvisible2RTInt16")) {
- return new FunctionImport()
- .setName("FINInvisible2RTInt16")
- .setFunction(nameUFNRTInt16);
-
- } else if (name.equals("FICRTETKeyNav")) {
- return new FunctionImport()
- .setName("FICRTETKeyNav")
- .setFunction(nameUFCRTETKeyNav);
-
- } else if (name.equals("FICRTETTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTETTwoKeyNavParam")
- .setFunction(nameUFCRTETTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTStringTwoParam")
- .setFunction(nameUFCRTStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCollStringTwoParam")
- .setFunction(nameUFCRTCollStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTAllPrimTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCTAllPrimTwoParam")
- .setFunction(nameUFCRTCTAllPrimTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FICRTESMixPrimCollCompTwoParam")
- .setFunction(nameUFCRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FINRTESMixPrimCollCompTwoParam")
- .setFunction(nameUFNRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrim")
- .setFunction(nameUFCRTCollCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTETMedia")) {
- return new FunctionImport()
- .setName("FICRTETMedia")
- .setFunction(nameUFCRTETMedia)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrimParam")
- .setFunction(nameUFCRTCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrim")
- .setFunction(nameUFCRTCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollString")) {
- return new FunctionImport()
- .setName("FICRTCollString")
- .setFunction(nameUFCRTCollString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTString")) {
- return new FunctionImport()
- .setName("FICRTString")
- .setFunction(nameUFCRTString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTESTwoKeyNavParam")
- .setFunction(nameUFCRTESTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrimParam")
- .setFunction(nameUFCRTCollCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- }
- }
-
- return null;
- }
-
- @Override
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
-
- if (functionName.equals(nameUFNRTInt16)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTInt16")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(nameString))
- );
-
- } else if (functionName.equals(nameUFCRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETKeyNav")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETKeyNav))
- );
-
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETTwoKeyNavParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav)
- )
- );
-
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETTwoKeyNavParamCTTwoPrim")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterCTTwoPrim").setType(nameCTTwoPrim)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav)
- )
- );
-
- } else if (functionName.equals(nameUFCRTStringTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString)),
- new Function()
- .setName("UFCRTStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(nameString),
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString))
-
- );
-
- } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTESTwoKeyNavParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTString")
-
- .setComposable(true)
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString)
- )
- );
-
- } else if (functionName.equals(nameUFCRTCollStringTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTCollString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollString")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTAllPrimTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTAllPrim))
- );
-
- } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTTwoPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim))
- );
- } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollCTTwoPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTTwoPrim")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim))
- );
-
- } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTTwoPrim")
-
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTETMedia)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETMedia")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(nameETMedia))
- );
-
- } else if (functionName.equals(nameUFCRTString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTString")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(new ReturnType()
- .setType(nameString)
- )
- );
-
- } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollCTTwoPrim")
- .setComposable(true)
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTESMixPrimCollCompTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(false)
- .setReturnType(
- new ReturnType().setType(nameETMixPrimCollComp).setCollection(true))
- );
-
- } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETAllPrimTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETAllPrim))
- );
-
- } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTESMixPrimCollCompTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(nameString),
- new Parameter().setName("ParameterInt16").setType(nameInt16)
- ))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETMixPrimCollComp).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
-
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true),
- new Parameter().setName("ParameterString").setType(nameString).setCollection(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true)),
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true),
- new Parameter().setName("ParameterString").setType(nameString).setCollection(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function().setName("BFCStringRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameString)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav)
- )
- );
-
- } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)
- .setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESAllPrimRTCTAllPrim")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETAllPrim).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTAllPrim))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCTTwoPrim")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCollCTTwoPrim")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTString")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCollString")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCSINavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETBaseTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCollStringRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameString).setCollection(true)))
- .setComposable(true)
- .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameCTPrimComp)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESBaseTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameCTPrimComp)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETBaseTwoKeyNav).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCollCTPrimCompRTESAllPrim")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameCTPrimComp).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETAllPrim).setCollection(true))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav))
- );
-
- } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESKeyNavRTETKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETKeyNav))
- );
-
- } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETKeyNavRTETKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETKeyNav))
- );
- } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true)))
- .setComposable(true)
- .setReturnType(new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
-
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav))
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTCTTwoPrim")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim))
- );
- } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTStringParam")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETTwoKeyNav).setCollection(true),
- new Parameter().setName("ParameterComplex").setType(nameCTTwoPrim)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameString))
- );
-
- } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESKeyNavRTETKeyNavParam")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameETKeyNav).setCollection(true),
- new Parameter().setName("ParameterString").setType(nameString)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETKeyNav))
- );
- } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTETTwoKeyNavParam")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameCTPrimComp),
- new Parameter().setName("ParameterString").setType(nameString)))
- .setComposable(true)
- .setReturnType(new ReturnType()
- .setType(nameETTwoKeyNav)
- )
- );
- } else if (functionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameInt16).setCollection(true),
- new Parameter().setName("ParameterString").setType(nameString).setNullable(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameCTTwoPrim).setCollection(true))
- );
- } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESTwoKeyNavParam")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(nameCTPrimComp),
- new Parameter().setName("ParameterString").setType(nameString)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(nameETTwoKeyNav).setCollection(true))
- );
- }
-
- return null;
- }
-
- @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("SINav")
- .setType(nameETTwoKeyNav)
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding()
- .setPath("NavPropertyETTwoKeyNavMany")
- .setTarget(new Target().setTargetName("ESTwoKeyNav"))));
-
- } else if (name.equals("SIMedia")) {
- return new Singleton()
- .setName("SIMedia")
- .setType(nameETMedia);
- }
- }
- return null;
- };
-}
[10/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
deleted file mode 100644
index 720f5d6..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestLexer.java
+++ /dev/null
@@ -1,414 +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.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.log(1).run("ESTwoKeyNav?$filter=CollPropertyComplex/all( l :true)");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 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.IT);
- // 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("$");
- // 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(":@/?$'=");
-
- }
-
-}
[20/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
deleted file mode 100644
index a245bdc..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
+++ /dev/null
@@ -1,2181 +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.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Stack;
-
-import org.antlr.v4.runtime.misc.ParseCancellationException;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNodeImpl;
-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.EdmEnumType;
-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.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-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.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResource;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AliasAndValueContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AllExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAddContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAllContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAndContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAnyContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltBatchContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltComparismContext;
-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.AltEqualityContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltHasContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMultContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltOrContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AnyExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.BooleanNonCaseContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CastExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConstSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CrossjoinContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DateMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EnumLitContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandItemContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandRefOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IsofExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LevelsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MaxDateTimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MemberExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinDateTimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinuteMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MonthMethodCallExprContext;
-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.NamespaceContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataIdentifierContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OrderByContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OrderByItemContext;
-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.PrimitiveLiteralContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RootExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkipContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkiptokenContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TopContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.UnaryContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.AliasQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandItemImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelsOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByItemImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectItemImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipTokenOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SystemQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.TopOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ConstantImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.EnumerationImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MethodCallImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLiteralImpl;
-
-/**
- * UriVisitor
- *
- * Converts the URI parse tree from the generate URI parser into an internal representation
- * which maybe (TODO) given to the application.
- * While converting the tree is validated against the EDM.
- *
- * Attention:
- * <li> This UriVisitor is at some point more lax than the original ABNF:
- * <li> It is more tolerable against additional white spaces
- * - Whenever it is possible to move edm validation to the AST classes then
- * this should be done ( see visit {@link #visitSelectSegment} for example)
- *
- * Not supported
- * <li>Parsing the context of $metadata
- *
- * TODO
- * <li>clean up
- * <li>Overview testcases
- * <li>search
- * <li>percent decoding
- *
- */
-public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
- private Edm edm;
-
- private EdmEntityContainer edmEntityContainer;
-
- private class LambdaVariables {
- public boolean isCollection;
- public String name;
- public EdmType type;
- }
-
- /**
- * Hold all currently allowed lambda variables
- * As lambda functions can be nested there may be more than one allowed lambda variables at a time while parsing a
- * $filter or $orderby expressions.
- */
- private Stack<LambdaVariables> allowedLambdaVariables = new Stack<LambdaVariables>();
-
- private class TypeInformation {
- private boolean isCollection;
- private EdmType type;
-
- TypeInformation(final EdmType type, final boolean isCollection) {
- this.type = type;
- this.isCollection = isCollection;
- }
-
- public TypeInformation() {
- // TODO Auto-generated constructor stub
- }
- }
-
- /**
- * Used to stack type information for nested $expand, $filter query options and other cases.
- */
- private Stack<TypeInformation> contextTypes = new Stack<TypeInformation>();
-
- /**
- * Set within method {@link #visitExpandItem(ExpandPathContext ctx)} and {@link #visitExpandPathExtension(final
- * ExpandPathExtensionContext ctx)} to allow nodes
- * deeper in the expand tree at {@link #visitExpandPathExtension(ExpandPathExtensionContext ctx)} appending path
- * segments to the currently processed {@link ExpandItemImpl}.
- */
- private ExpandItemImpl contextExpandItemPath;
-
- /**
- * Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes
- * deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the
- * currently processed {@link SelectItemImpl}.
- */
- private SelectItemImpl contextSelectItem;
-
- /**
- * Stores the currently processed UriInfo objects. There is one URI Info object for the resource path
- * and one for each new first member access within $filter and $orderBy options.
- */
- private UriInfoImpl contextUriInfo;
-
- private boolean contextReadingFunctionParameters = false;
-
- // --- class ---
-
- public void init() {
- allowedLambdaVariables.clear();
- contextUriInfo = null;
- contextExpandItemPath = null;
- contextSelectItem = null;
- contextTypes.clear();
- contextUriInfo = null;
- }
-
- public UriInfoImpl getUriInfo() {
- return contextUriInfo;
- }
-
- public UriParseTreeVisitor(final Edm edm) {
- this.edm = edm;
- edmEntityContainer = edm.getEntityContainer(null);
- }
-
- /**
- * Simple percent decoding
- * @param encoded string
- * @return decoded string
- */
- String decode(String encoded) {
- try {
- return URLDecoder.decode(encoded, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw wrap(new UriParserSyntaxException("Error while decoding"));
- }
- }
-
- private FullQualifiedName getFullNameFromContext(final NamespaceContext vNS, final String odi) {
- String namespace = decode(vNS.getText());
- namespace = namespace.substring(0, namespace.length() - 1); // vNS contains a trailing point that has to be removed
- return new FullQualifiedName(namespace, odi);
- }
-
- private LambdaVariables getLambdaVar(final String odi) {
- for (LambdaVariables item : allowedLambdaVariables) {
- if (item.name.equals(odi)) {
- return item;
- }
- }
- return null;
- }
-
- private TypeInformation getTypeInformation(final UriResource lastResourcePart) {
-
- TypeInformation typeInformation = new TypeInformation();
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- typeInformation.type = lastPartWithKeys.getTypeFilterOnEntry();
- } else if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- typeInformation.type = lastPartWithKeys.getTypeFilterOnCollection();
- } else {
- typeInformation.type = lastPartWithKeys.getType();
- }
- typeInformation.isCollection = lastPartWithKeys.isCollection();
-
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
-
- if (lastPartTyped.getTypeFilter() != null) {
- typeInformation.type = lastPartTyped.getTypeFilter();
- } else {
- typeInformation.type = lastPartTyped.getType();
- }
-
- typeInformation.isCollection = lastPartTyped.isCollection();
- }
-
- return typeInformation;
- }
-
- public UriResourceTypedImpl readResourcePathSegment(final PathSegmentContext ctx) {
-
- boolean checkFirst = false;
- if (contextUriInfo.getLastResourcePart() == null ||
- contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
- checkFirst = true;
- }
-
- String odi = decode(ctx.vODI.getText());
-
- if (checkFirst && ctx.vNS == null) {
-
- // check EntitySet
- EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
- if (edmEntitySet != null) {
- UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl()
- .setEntitSet(edmEntitySet);
- contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check Singleton
- EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
- if (edmSingleton != null) {
- UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl()
- .setSingleton(edmSingleton);
- contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check ActionImport
- EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
- if (edmActionImport != null) {
- UriResourceActionImpl uriResource = new UriResourceActionImpl()
- .setActionImport(edmActionImport);
- contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check FunctionImport
- EdmFunctionImport edmFunctionImport = edmEntityContainer.getFunctionImport(odi);
- if (edmFunctionImport != null) {
-
- // read the URI parameters
- this.contextReadingFunctionParameters = true;
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- this.contextReadingFunctionParameters = false;
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
-
- UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl()
- .setFunctionImport(edmFunctionImport, parameters);
-
- // collect parameter names
- List<String> names = new ArrayList<String>();
- for (UriParameterImpl item : parameters) {
- names.add(item.getName());
- }
-
- // get function from function import
- EdmFunction function = edmFunctionImport.getFunction(names);
- if (function == null) {
- String tmp = "";
- for (String name : names) {
- tmp += (tmp.length() != 0 ? "," : "") + name;
- }
- throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
- + "' with parameters [" + tmp + "] not found"));
- }
-
- uriResource.setFunction(edmFunctionImport.getFunction(names));
- contextUriInfo.addResourcePart(uriResource);
- return null;
- }
- }
-
- TypeInformation source = null;
- UriResource lastResourcePart = contextUriInfo.getLastResourcePart();
-
- if (lastResourcePart == null) {
- if (contextTypes.size() == 0) {
- throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
- + "resource parts"));
- }
- source = contextTypes.peek();
- } else {
- source = getTypeInformation(lastResourcePart);
-
- if (source.type == null) {
- throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
- + "resource parts"));
- }
- }
-
- if (ctx.vNS == null) { // without namespace
-
- // first check for lambda variable because a newly add property should not shadow a long used lambda variable
- LambdaVariables lVar = getLambdaVar(odi);
- if (lVar != null) {
- UriResourceLambdaVarImpl lambdaResource = new UriResourceLambdaVarImpl();
- lambdaResource.setVariableText(lVar.name);
- lambdaResource.setType(lVar.type);
- lambdaResource.setCollection(lVar.isCollection);
- contextUriInfo.addResourcePart(lambdaResource);
- return null;
- }
-
- if (!(source.type instanceof EdmStructuralType)) {
- throw wrap(new UriParserSemanticException("Can not parse'" + odi
- + "'Previous path segment not a structural type."));
- }
-
- EdmStructuralType structType = (EdmStructuralType) source.type;
-
- EdmElement property = structType.getProperty(odi);
- if (property == null) {
- throw wrap(new UriParserSemanticException("Property '" + odi + "' not found in type '"
- + structType.getNamespace() + "." + structType.getName() + "'"));
- }
-
- if (property instanceof EdmProperty) {
- if (((EdmProperty) property).isPrimitive() == true) {
- // create simple property
- UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
- .setProperty((EdmProperty) property);
- contextUriInfo.addResourcePart(simpleResource);
- return null;
- } else {
- // create complex property
- UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl()
- .setProperty((EdmProperty) property);
- contextUriInfo.addResourcePart(complexResource);
- return null;
- }
- } else if (property instanceof EdmNavigationProperty) {
- // create navigation property
- UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
- .setNavigationProperty((EdmNavigationProperty) property);
- contextUriInfo.addResourcePart(navigationResource);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Unkown type for property '" + property + "'"));
- }
-
- } else { // with namespace
-
- FullQualifiedName fullFilterName = getFullNameFromContext(ctx.vNS, odi);
-
- // EdmType lastType = getLastType(lastTyped);
-
- if (source.type instanceof EdmEntityType) {
-
- EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
- if (filterEntityType != null) {
- // is entity type cast
- if (!(filterEntityType.compatibleTo(source.type))) {
- throw wrap(new UriParserSemanticException(
- "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString()));
- }
-
- if (lastResourcePart == null) {
- // this may be the case if a member expression within a filter starts with a typeCast
- UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(source.type)
- .setCollection(source.isCollection);
- if (source.isCollection) {
- uriResource.setCollectionTypeFilter(filterEntityType);
- } else {
- uriResource.setEntryTypeFilter(filterEntityType);
- }
- contextUriInfo.addResourcePart(uriResource);
- return null;
- } else {
-
- // check if last segment may contain key properties
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.isCollection() == false) {
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
- }
- lastPartWithKeys.setEntryTypeFilter(filterEntityType);
- return null;
- } else {
- if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
- }
- lastPartWithKeys.setCollectionTypeFilter(filterEntityType);
- return null;
- }
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
- if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
- getName(filterEntityType) + "' behind '" +
- getName(lastPartTyped.getTypeFilter()) + "'"));
- }
-
- lastPartTyped.setTypeFilter(filterEntityType);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterEntityType)
- + "' not typed"));
- }
- }
- }
-
- } else if (source.type instanceof EdmComplexType) {
-
- EdmComplexType filterComplexType = edm.getComplexType(fullFilterName);
-
- if (filterComplexType != null) {
-
- // is complex type cast
- if (!(filterComplexType.compatibleTo(source.type))) {
- throw wrap(new UriParserSemanticException(
- "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
- + getName(filterComplexType) + "'"));
- }
-
- // is simple complex type cast
- if (lastResourcePart == null) {
- // this may be the case if a member expression within a filter starts with a typeCast
- UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(source.type)
- .setCollection(source.isCollection);
-
- if (source.isCollection) {
- uriResource.setCollectionTypeFilter(filterComplexType);
- } else {
- uriResource.setEntryTypeFilter(filterComplexType);
- }
- contextUriInfo.addResourcePart(uriResource);
- return null;
- } else {
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- // e.g. in case of function returning complex data or a list of complex data
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.isCollection() == false) {
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'"));
- }
- lastPartWithKeys.setEntryTypeFilter(filterComplexType);
- return null;
- } else {
- if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'"));
- }
- lastPartWithKeys.setCollectionTypeFilter(filterComplexType);
- return null;
- }
-
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
- if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '" +
- getName(filterComplexType) + "' behind '" +
- getName(lastPartTyped.getTypeFilter()) + "'"));
- }
-
- lastPartTyped.setTypeFilter(filterComplexType);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterComplexType)
- + "' not typed"));
- }
- }
- }
- }
-
- FullQualifiedName fullBindingTypeName = new FullQualifiedName(source.type.getNamespace(), source.type.getName());
-
- // check for action
- EdmAction action = edm.getAction(fullFilterName, fullBindingTypeName, source.isCollection);
- if (action != null) {
- UriResourceActionImpl pathInfoAction = new UriResourceActionImpl();
- pathInfoAction.setAction(action);
- contextUriInfo.addResourcePart(pathInfoAction);
- return null;
- }
-
- // do a check for bound functions (which requires a parameter list)
- if (ctx.vlNVO.size() == 0) {
- throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
- + "'"));
- }
-
- this.contextReadingFunctionParameters = true;
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- this.contextReadingFunctionParameters = false;
-
- // get names of function parameters
- List<String> names = new ArrayList<String>();
- for (UriParameterImpl item : parameters) {
- names.add(item.getName());
- }
-
- EdmFunction function = edm.getFunction(fullFilterName, fullBindingTypeName, source.isCollection, names);
-
- if (function != null) {
- UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
- contextUriInfo.addResourcePart(pathInfoFunction);
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
- return null;
- }
-
- // check for unbound function in the $filter case ( where the previous resource segment is a $it)
- function = edm.getFunction(fullFilterName, null, null, names);
-
- if (function != null) {
- UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
- contextUriInfo.addResourcePart(pathInfoFunction);
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
- return null;
- }
-
- throw wrap(new UriParserSemanticException("Unknown resource path segment:" + fullFilterName.toString()));
- }
- }
-
- private String getName(EdmType type) {
- return type.getNamespace() + "." + type.getName();
- }
-
- @Override
- public Object visitAliasAndValue(final AliasAndValueContext ctx) {
- AliasQueryOptionImpl alias = new AliasQueryOptionImpl();
- alias.setName(decode(ctx.vODI.getText()));
- alias.setText(decode(ctx.vV.getText()));
- alias.setAliasValue((ExpressionImpl) ctx.vV.accept(this));
- return alias;
- }
-
- @Override
- public Object visitAllExpr(final AllExprContext ctx) {
- UriResourceLambdaAllImpl all = new UriResourceLambdaAllImpl();
-
- UriResource obj = contextUriInfo.getLastResourcePart();
- if (!(obj instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("any only allowed on typed path segments"));
- }
-
- LambdaVariables var = new LambdaVariables();
- var.name = decode(ctx.vLV.getText());
- var.type = getTypeInformation((UriResourceImpl) obj).type;
- var.isCollection = false;
-
- all.setLamdaVariable(decode(ctx.vLV.getText()));
- allowedLambdaVariables.push(var);
- all.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- allowedLambdaVariables.pop();
- return all;
- }
-
- @Override
- public ExpressionImpl visitAltAdd(final AltAddContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.ADD) {
- binary.setOperator(SupportedBinaryOperators.ADD);
- } else if (tokenIndex == UriLexer.SUB) {
- binary.setOperator(SupportedBinaryOperators.SUB);
- }
-
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
- return binary;
- }
-
- @Override
- public Object visitAltAll(final AltAllContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAll(ctx));
-
- return new MemberImpl()
- .setPath(uriInfoImplpath);
- }
-
- @Override
- public ExpressionImpl visitAltAnd(final AltAndContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(SupportedBinaryOperators.AND);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltAny(final AltAnyContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAny(ctx));
-
- return new MemberImpl()
- .setPath(uriInfoImplpath);
- }
-
- @Override
- public Object visitAltBatch(final AltBatchContext ctx) {
- contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.batch);
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltComparism(final AltComparismContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.GT) {
- binary.setOperator(SupportedBinaryOperators.GT);
- } else if (tokenIndex == UriLexer.GE) {
- binary.setOperator(SupportedBinaryOperators.GE);
- } else if (tokenIndex == UriLexer.LT) {
- binary.setOperator(SupportedBinaryOperators.LT);
- } else if (tokenIndex == UriLexer.LE) {
- binary.setOperator(SupportedBinaryOperators.LE);
- }
-
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
- return binary;
- }
-
- @Override
- public Object visitAltEntity(final AltEntityContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
-
- @SuppressWarnings("unchecked")
- List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
- uriInfo.setQueryOptions(list);
-
- contextUriInfo = uriInfo;
- return null;
- }
-
- @Override
- public Object visitAltEntityCast(final AltEntityCastContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
-
- String odi = decode(ctx.vODI.getText());
- FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
-
- EdmEntityType type = edm.getEntityType(fullName);
- if (type == null) {
- throw wrap(new UriParserSemanticException("Expected EntityTypeName"));
- }
- uriInfo.setEntityTypeCast(type);
-
- contextUriInfo = uriInfo;
- contextTypes.push(new TypeInformation(uriInfo.getEntityTypeCast(), true));
-
- @SuppressWarnings("unchecked")
- List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
- uriInfo.setQueryOptions(list);
-
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltEquality(final AltEqualityContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.EQ_ALPHA) {
- binary.setOperator(SupportedBinaryOperators.EQ);
- } else {
- binary.setOperator(SupportedBinaryOperators.NE);
- }
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltHas(final AltHasContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(SupportedBinaryOperators.HAS);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltMetadata(final AltMetadataContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.metadata);
-
- if (ctx.vF != null) {
- FormatOptionImpl format = (FormatOptionImpl) ctx.vF.accept(this);
- uriInfo.setSystemQueryOption(format);
- }
-
- if (ctx.vCF != null) {
- uriInfo.setFragment(decode(ctx.vCF.getText()));
- }
-
- contextUriInfo = uriInfo;
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltMult(final AltMultContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.MUL) {
- binary.setOperator(SupportedBinaryOperators.MUL);
- } else if (tokenIndex == UriLexer.DIV) {
- binary.setOperator(SupportedBinaryOperators.DIV);
- } else {
- binary.setOperator(SupportedBinaryOperators.MOD);
- }
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public ExpressionImpl visitAltOr(final AltOrContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(SupportedBinaryOperators.OR);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltResourcePath(final AltResourcePathContext ctx) {
- ctx.vRP.accept(this);
-
- if (ctx.vQO != null) {
- UriResource lastSegment = contextUriInfo.getLastResourcePart();
-
- if (lastSegment instanceof UriResourcePartTyped) {
- UriResourcePartTyped typed = (UriResourcePartTyped) lastSegment;
- contextTypes.push(new TypeInformation(getTypeInformation((UriResourceImpl) typed).type, typed.isCollection()));
- }
- @SuppressWarnings("unchecked")
- List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vQO.accept(this);
- contextUriInfo.setQueryOptions(list);
- }
- return null;
- }
-
- @Override
- public Object visitAnyExpr(final AnyExprContext ctx) {
- UriResourceLambdaAnyImpl any = new UriResourceLambdaAnyImpl();
- if (ctx.vLV != null) {
- // TODO
- UriResourceImpl lastResourcePart = (UriResourceImpl) contextUriInfo.getLastResourcePart();
- if (!(lastResourcePart instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("any only allowed on typed path segments"));
- }
-
- LambdaVariables var = new LambdaVariables();
- var.name = decode(ctx.vLV.getText());
- var.type = getTypeInformation(lastResourcePart).type;
- var.isCollection = false;
-
- any.setLamdaVariable(decode(ctx.vLV.getText()));
- allowedLambdaVariables.push(var);
- any.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- allowedLambdaVariables.pop();
- }
- return any;
- }
-
- @Override
- public Object visitBooleanNonCase(BooleanNonCaseContext ctx) {
- String text = decode(ctx.getText()).toLowerCase();
-
- if (text.equals("false")) {
- return new ConstantImpl().setKind(SupportedConstants.FALSE);
- }
- return new ConstantImpl().setKind(SupportedConstants.TRUE);
- }
-
- @Override
- public ExpressionImpl visitCastExpr(final CastExprContext ctx) {
- MethodCallImpl method = new MethodCallImpl();
- if (ctx.vE1 != null) {
- // is optional parameter
- ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
- method.addParameter(onExpression);
- }
-
- String namespace = decode(ctx.vNS.getText());
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, decode(ctx.vODI.getText()));
- EdmType type = getType(fullName);
- method.setMethod(SupportedMethodCalls.CAST);
- method.addParameter(new TypeLiteralImpl().setType(type));
- return method;
- }
-
- private EdmType getType(final FullQualifiedName fullName) {
- EdmType type = null;
-
- type = edm.getEntityType(fullName);
- if (type != null) {
- return type;
- }
-
- type = edm.getComplexType(fullName);
- if (type != null) {
- return type;
- }
-
- type = edm.getEnumType(fullName);
- if (type != null) {
- return type;
- }
-
- if (fullName.getNamespace().equals("Edm")) {
- EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
- type = typeKind.getEdmPrimitiveTypeInstance();
- if (type != null) {
- return type;
- }
- }
-
- return null;
-
- }
-
- @Override
- public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.CEILING)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.CONCAT)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitConstSegment(final ConstSegmentContext ctx) {
- UriInfoImpl uriInfoResource = contextUriInfo;
- UriResource pathInfo = uriInfoResource.getLastResourcePart();
-
- if (ctx.vV != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- if (!((UriResourcePartTyped) pathInfo).isCollection()) {
- contextUriInfo.addResourcePart(new UriResourceValueImpl());
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
- }
- return null;
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments"));
- }
-
- } else if (ctx.vC != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- if (((UriResourcePartTyped) pathInfo).isCollection()) {
- contextUriInfo.addResourcePart(new UriResourceCountImpl());
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on collection properties"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on typed properties"));
- }
- } else if (ctx.vR != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- EdmType type = ((UriResourcePartTyped) pathInfo).getType();
- if (type instanceof EdmEntityType) {
- contextUriInfo.addResourcePart(new UriResourceRefImpl());
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowd on endity types"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowed on typed properties"));
- }
-
- } else if (ctx.vAll != null) {
- contextUriInfo.addResourcePart((UriResourceLambdaAllImpl) ctx.vAll.accept(this));
- } else if (ctx.vAny != null) {
- contextUriInfo.addResourcePart((UriResourceLambdaAnyImpl) ctx.vAny.accept(this));
- }
- return null;
- }
-
- @Override
- public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.CONTAINS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitCrossjoin(final CrossjoinContext ctx) {
- UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.crossjoin);
-
- for (OdataIdentifierContext obj : ctx.vlODI) {
- crossJoin.addEntitySetName(decode(obj.getText()));
- }
-
- contextUriInfo = crossJoin;
- return null;
- }
-
- @Override
- public Object visitCustomQueryOption(final CustomQueryOptionContext ctx) {
- CustomQueryOptionImpl queryOption = new CustomQueryOptionImpl();
- queryOption.setName(decode(ctx.getChild(0).getText()));
-
- // set value only if present
- if (ctx.getChildCount() > 1) {
- queryOption.setText(decode(ctx.getChild(2).getText()));
- }
-
- return queryOption;
- }
-
- @Override
- public Object visitDateMethodCallExpr(final DateMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.DATE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.DAY)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.GEODISTANCE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.ENDSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitEntityOptions(final EntityOptionsContext ctx) {
- List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
-
- for (EntityOptionContext entityOption : ctx.vlEOb) {
- queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
- }
-
- queryOptionList.add((QueryOptionImpl) ctx.vlEOm.accept(this));
-
- for (EntityOptionContext entityOption : ctx.vlEOa) {
- queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
- }
- return queryOptionList;
- }
-
- @Override
- public Object visitEntityOptionsCast(final EntityOptionsCastContext ctx) {
- List<QueryOptionImpl> queryOptionList = new ArrayList<QueryOptionImpl>();
- for (EntityOptionCastContext entityOption : ctx.vlEOb) {
- queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
- }
-
- queryOptionList.add((QueryOptionImpl) ctx.vlEOm.accept(this));
-
- for (EntityOptionCastContext entityOption : ctx.vlEOa) {
- queryOptionList.add((QueryOptionImpl) entityOption.accept(this));
- }
- return queryOptionList;
- }
-
- @Override
- public Object visitEnumLit(final EnumLitContext ctx) {
- EnumerationImpl enum1 = new EnumerationImpl();
-
- // get type
- String odi = decode(ctx.vODI.getText());
-
- FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
- EdmEnumType edmEnumType = edm.getEnumType(fullName);
-
- enum1.setType(edmEnumType);
-
- String valueString = decode(ctx.vValues.getText());
- valueString = valueString.substring(1, valueString.length() - 1);
-
- String[] values = valueString.split(",");
- for (String item : values) {
- enum1.addValue(item);
- }
-
- return enum1;
- }
-
- @Override
- public Object visitExpand(final ExpandContext ctx) {
- ExpandOptionImpl expand = new ExpandOptionImpl();
- expand.setText(decode(ctx.getChild(2).getText()));
- for (ExpandItemContext eI : ctx.vlEI) {
- expand.addExpandItem((ExpandItemImpl) eI.accept(this));
- }
-
- return expand;
- }
-
- @Override
- public Object visitExpandItem(final ExpandItemContext ctx) {
-
- ExpandItemImpl expandItem = null;
- if (ctx.vS != null) {
- expandItem = new ExpandItemImpl().setIsStar(true);
- if (ctx.vR != null) {
- expandItem.setIsRef(true);
- } else if (ctx.vM != null) {
- LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
- levels.setText(decode(ctx.vM.getText()));
- expandItem.setSystemQueryOption(levels);
- } else if (ctx.vL != null) {
- // TODO set value as integer
- LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
- levels.setText(decode(ctx.vL.getText()));
- expandItem.setSystemQueryOption(levels);
- }
-
- } else if (ctx.vEP != null) {
- expandItem = (ExpandItemImpl) ctx.vEP.accept(this);
-
- if (ctx.vEPE != null) {
- ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
- contextExpandItemPath = expandItem;
-
- @SuppressWarnings("unchecked")
- List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
- for (SystemQueryOptionImpl option : list) {
- expandItem.setSystemQueryOption(option);
- }
- contextExpandItemPath = contextExpandItemPathBU;
- }
- }
-
- return expandItem;
-
- }
-
- @Override
- public Object visitExpandPath(final ExpandPathContext ctx) {
- ExpandItemImpl expandItem = new ExpandItemImpl();
-
- // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
-
- contextUriInfo.getLastResourcePart();
-
- // save context
- ExpandItemImpl contextExpandItemPathBU = contextExpandItemPath;
- UriInfoImpl uriInfoResourceBU = contextUriInfo;
-
- // set tmp context
- contextExpandItemPath = expandItem;
- contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- // contextUriInfo.addPathInfo(pathInfoIT);
-
- super.visitExpandPath(ctx);
- expandItem.setResourceInfo(contextUriInfo);
-
- // reset context
- contextUriInfo = uriInfoResourceBU;
- contextExpandItemPath = contextExpandItemPathBU;
-
- return expandItem;
- }
-
- @Override
- public Object visitExpandPathExtension(final ExpandPathExtensionContext ctx) {
- List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
-
- EdmType targetType = null;
- boolean isColl = false;
- if (contextExpandItemPath == null) {
- // use the type of the last resource path segement
- UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) contextUriInfo.getLastResourcePart();
- targetType = getTypeInformation(lastSegment).type;
- isColl = lastSegment.isCollection();
- } else {
- if (contextExpandItemPath.getResourceInfo() == null) {
- // use the type of the last resource path segement
- UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) contextUriInfo.getLastResourcePart();
- targetType = getTypeInformation(lastSegment).type;
- isColl = lastSegment.isCollection();
- } else {
- // use the type of the last ''expand'' path segement
- UriInfoImpl info = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
- targetType = getTypeInformation((UriResourceImpl) info.getLastResourcePart()).type;
- isColl = ((UriResourcePartTyped) info.getLastResourcePart()).isCollection();
- }
- }
-
- contextTypes.push(new TypeInformation(targetType, isColl));
-
- if (ctx.vC != null) {
- UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
- resourcePath.addResourcePart(new UriResourceCountImpl());
-
- for (ExpandCountOptionContext s : ctx.vlEOC) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- } else if (ctx.vR != null) {
- UriInfoImpl resourcePath = (UriInfoImpl) contextExpandItemPath.getResourceInfo();
- resourcePath.addResourcePart(new UriResourceRefImpl());
-
- for (ExpandRefOptionContext s : ctx.vlEOR) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- } else {
- for (ExpandOptionContext s : ctx.vlEO) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- }
-
- contextTypes.pop();
- return list;
-
- }
-
- @Override
- public Object visitFilter(final FilterContext ctx) {
-
- FilterOptionImpl filter = new FilterOptionImpl().setExpression((ExpressionImpl) ctx.children.get(2).accept(this));
- return filter;
- }
-
- @Override
- public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.FLOOR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitFormat(final FormatContext ctx) {
- FormatOptionImpl format = new FormatOptionImpl();
-
- TerminalNodeImpl c2 = (TerminalNodeImpl) ctx.children.get(2);
- if (c2.symbol.getType() == UriLexer.ATOM) {
- format.setFormat("atom");
- } else if (c2.symbol.getType() == UriLexer.JSON) {
- format.setFormat("json");
- } else if (c2.symbol.getType() == UriLexer.XML) {
- format.setFormat("xml");
- } else if (c2.symbol.getType() == UriLexer.PCHARS) {
- if (ctx.getChildCount() == 2) {
- format.setFormat(decode(c2.getText()));
- } else {
- format.setFormat(decode(c2.getText()) + "/" + decode(ctx.children.get(4).getText()));
- }
- }
- String text = decode(ctx.children.get(2).getText());
- if (ctx.getChildCount() > 4) {
- text += decode(ctx.children.get(3).getText());
- text += decode(ctx.children.get(4).getText());
- }
-
- format.setText(text);
-
- return format;
- }
-
- @Override
- public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.FRACTIONALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.GEOLENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.HOUR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitId(final IdContext ctx) {
- IdOptionImpl id = new IdOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- return id.setValue(text).setText(text);
- }
-
- @Override
- public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.INDEXOF)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitInlinecount(final InlinecountContext ctx) {
- InlineCountOptionImpl inlineCount = new InlineCountOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- return inlineCount.setValue(text.equals("true") ? true : false).setText(text);
- }
-
- @Override
- public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.GEOINTERSECTS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public ExpressionImpl visitIsofExpr(final IsofExprContext ctx) {
- MethodCallImpl method = new MethodCallImpl();
- if (ctx.vE1 != null) {
- ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
- method.addParameter(onExpression);
- }
-
- /* TODO improve coding */
- String namespace = decode(ctx.vNS.getText());
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, decode(ctx.vODI.getText()));
- EdmType type = getType(fullName);
- method.setMethod(SupportedMethodCalls.ISOF);
- method.addParameter(new TypeLiteralImpl().setType(type));
-
- return method;
- }
-
- @Override
- public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.LENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitLevels(LevelsContext ctx) {
-
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- if (text.equals("max")) {
- levels.setMax();
- }
- levels.setText(text);
- // TODO set value as integer
-
- return levels;
-
- }
-
- @Override
- public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.MAXDATETIME);
- }
-
- @Override
- public Object visitMemberExpr(final MemberExprContext ctx) {
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- TypeInformation lastTypeInfo = contextTypes.peek();
-
- if (ctx.vIt != null || ctx.vIts != null) {
- UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- pathInfoIT.setType(lastTypeInfo.type);
- pathInfoIT.setCollection(lastTypeInfo.isCollection);
- uriInfoImplpath.addResourcePart(pathInfoIT);
- }
-
- if (ctx.vPs != null) {
- // save the context
- UriInfoImpl backupUriInfoPath = contextUriInfo;
-
- // set temporary uriInfoPath
- contextUriInfo = uriInfoImplpath;
-
- ctx.vPs.accept(this);
-
- // reset context
- contextUriInfo = backupUriInfoPath;
- }
-
- if (ctx.vALL != null) {
- uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vALL.accept(this));
- }
- if (ctx.vANY != null) {
- uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vANY.accept(this));
- }
-
- return new MemberImpl()
- .setPath(uriInfoImplpath);
- }
-
- @Override
- public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.MINDATETIME);
- }
-
- @Override
- public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.MINUTE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.MONTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitNameValueOptList(final NameValueOptListContext ctx) {
- if (ctx.vVO != null) {
-
- // is single key predicate without a name
- String valueText = decode(ctx.vVO.vV.getText());
- ExpressionImpl expression = null;
- try {
- expression = (ExpressionImpl) ctx.vVO.vV.accept(this);
- } catch (Exception ex) {
- throw wrap(new UriParserSemanticException("Invalid key value: " + valueText));
- }
-
- // get type of last resource part
- UriResource last = contextUriInfo.getLastResourcePart();
- if (!(last instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Paramterslist on untyped resource path segement not allowed"));
- }
- EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
-
- // get list of keys for lastType
- List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
-
- // if there is exactly one key defined in the EDM, then this key the the key written in the URI,
- // so fill the keylist with this key and return
- if (lastKeyPredicates.size() == 1) {
- String keyName = lastKeyPredicates.get(0);
- List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
- list.add(new UriParameterImpl().setName(keyName).setText(valueText).setExpression(expression));
- return list;
- }
-
- // There are more keys defined in the EDM, but only one is written in the URI. This is allowed only if
- // referential constrains are defined on this navigation property which can be used to will up all required
- // key.
-
- // for using referential constrains the last resource part must be a navigation property
- if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
- throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
- }
- UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
-
- // get the partner of the navigation property
- EdmNavigationProperty partner = lastNav.getProperty().getPartner();
- if (partner == null) {
- throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
- }
-
- // create the keylist
- List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
-
- // find the key not filled by referential constrains and collect the other keys filled by
- // referential constrains
- String missedKey = null;
- for (String item : lastKeyPredicates) {
- String property = partner.getReferencingPropertyName(item);
- if (property != null) {
- list.add(new UriParameterImpl().setName(item).setRefencedProperty(property));
- } else {
- if (missedKey == null) {
- missedKey = item;
- } else {
- // two of more keys are missing
- throw wrap(new UriParserSemanticException("Not enougth referntial contrains defined"));
- }
- }
- }
-
- // the missing key is the one which is defined in the URI
- list.add(new UriParameterImpl().setName(missedKey).setText(valueText).setExpression(expression));
-
- return list;
- } else if (ctx.vNVL != null) {
-
- List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
-
- for (ParseTree c : ctx.vNVL.vlNVP) {
- list.add((UriParameterImpl) c.accept(this));
- }
-
- if (contextReadingFunctionParameters) {
- return list;
- }
-
- UriResource last = contextUriInfo.getLastResourcePart();
- // if the last resource part is a function
- /*
- * if (last instanceof UriResourceFunctionImpl) {
- * UriResourceFunctionImpl function = (UriResourceFunctionImpl) last;
- * if (!function.isParameterListFilled()) {
- * return list;
- * }
- * }
- */
-
- // get type of last resource part
- if (!(last instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Parameterslist on untyped resource path segement not allowed"));
- }
- EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
-
- // get list of keys for lastType
- List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
-
- // check if all key are filled from the URI
- if (list.size() == lastKeyPredicates.size()) {
- return list;
- }
-
- // if not, check if the missing key predicates can be satisfied with help of the defined referential constrains
-
- // for using referential constrains the last resource part must be a navigation property
- if (!(contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
- throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
- }
- UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
-
- // get the partner of the navigation property
- EdmNavigationProperty partner = lastNav.getProperty().getPartner();
- if (partner == null) {
- throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
- }
-
- // fill missing keys from referential constrains
- for (String key : lastKeyPredicates) {
- boolean found = false;
- for (UriParameterImpl item : list) {
- if (item.getName().equals(key)) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- String property = partner.getReferencingPropertyName(key);
- if (property != null) {
- // store the key name as referenced property
- list.add(0, new UriParameterImpl().setName(key).setRefencedProperty(property));
- }
- }
- }
-
- // check again if all keyPredicate are filled from the URI
- if (list.size() == lastKeyPredicates.size()) {
- return list;
- }
-
- throw wrap(new UriParserSemanticException("Not enougth keyproperties defined"));
- }
- return new ArrayList<String>();
- }
-
- @Override
- public UriParameterImpl visitNameValuePair(final NameValuePairContext ctx) {
- UriParameterImpl uriParameter = new UriParameterImpl();
- uriParameter.setName(decode(ctx.vODI.getText()));
-
- if (ctx.vCOM != null) {
- uriParameter.setText(decode(ctx.vCOM.getText()));
- uriParameter.setExpression((ExpressionImpl) ctx.vCOM.accept(this));
- } else {
- uriParameter.setAlias(decode(ctx.vALI.getText()));
- }
-
- return uriParameter;
- }
-
- @Override
- public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.NOW);
- }
-
- @Override
- public Object visitNullrule(NullruleContext ctx) {
- return new ConstantImpl().setKind(SupportedConstants.NULL);
- }
-
- @Override
- public Object visitOdataRelativeUriEOF(final OdataRelativeUriEOFContext ctx) {
- contextUriInfo = null;
- super.visitOdataRelativeUriEOF(ctx);
- return contextUriInfo;
- }
-
- @Override
- public Object visitOrderBy(final OrderByContext ctx) {
-
- OrderByOptionImpl orderBy = new OrderByOptionImpl();
-
- for (OrderByItemContext item : ctx.vlOI) {
- OrderByItemImpl oItem = (OrderByItemImpl) item.accept(this);
- orderBy.addOrder(oItem);
- }
-
- return orderBy;
- }
-
- @Override
- public Object visitOrderByItem(OrderByItemContext ctx) {
- OrderByItemImpl oItem = new OrderByItemImpl();
- if (ctx.vD != null) {
- oItem.setDescending(true);
- }
-
- oItem.setExpression((ExpressionImpl) ctx.vC.accept(this));
- return oItem;
- }
-
- @Override
- public Object visitPathSegment(final PathSegmentContext ctx) {
- readResourcePathSegment(ctx);
- /*
- * if (contextUriInfo.getLastResourcePart() == null ||
- * contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
- *
- * } else {
- * readNextPathInfoSegment(ctx);
- * }
- */
- UriResourceImpl pathInfoSegment = (UriResourceImpl) contextUriInfo.getLastResourcePart();
-
- if (ctx.vlNVO.size() > 0) {
- // check for keyPredicates
- if (pathInfoSegment instanceof UriResourceWithKeysImpl) {
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- ((UriResourceWithKeysImpl) pathInfoSegment)
- .setKeyPredicates(list);
- } else {
- throw wrap(new UriParserSemanticException("Key properties not allowed"));
- // throw UriSemanticError.addKrepredicatesNotAllowed();
- }
- }
-
- return pathInfoSegment;
- }
-
- @Override
- public Object visitPathSegments(final PathSegmentsContext ctx) {
- // path segment
- for (PathSegmentContext it : ctx.vlPS) {
- it.accept(this);
- }
-
- // const segment
- if (ctx.vCS != null) {
- ctx.vCS.accept(this);
- }
- return null;
- }
-
- @Override
- public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
- ParseTree child1 = ctx.children.get(0);
-
- if (child1 instanceof EnumLitContext ||
- child1 instanceof BooleanNonCaseContext ||
- child1 instanceof NullruleContext) {
- return child1.accept(this);
- }
- return new LiteralImpl().setText(decode(ctx.getText()));
- }
-
- @Override
- public Object visitQueryOptions(final QueryOptionsContext ctx) {
-
- List<QueryOptionImpl> qpList = new ArrayList<QueryOptionImpl>();
- for (QueryOptionContext entityOption : ctx.vlQO) {
- qpList.add((QueryOptionImpl) entityOption.accept(this));
- }
-
- return qpList;
- }
-
- @Override
- public Object visitResourcePath(final ResourcePathContext ctx) {
- if (ctx.vAll != null) {
- contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
- } else if (ctx.vCJ != null) {
- ctx.vCJ.accept(this);
- } else if (ctx.vlPS != null) {
- UriInfoImpl uriInfoPath = new UriInfoImpl().setKind(UriInfoKind.resource);
- contextUriInfo = uriInfoPath;
- super.visitResourcePath(ctx); // visit all children of ctx
- }
- return contextUriInfo;
- }
-
- @Override
- public Object visitRootExpr(final RootExprContext ctx) {
-
- UriResource lastResource = contextUriInfo.getLastResourcePart();
-
- if (!(lastResource instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Resource path not typed"));
- }
-
- UriResourcePartTyped lastType = (UriResourcePartTyped) lastResource;
-
- UriResourceRootImpl pathInfoRoot = new UriResourceRootImpl();
- pathInfoRoot.setCollection(lastType.isCollection());
- pathInfoRoot.setType(getTypeInformation((UriResourceImpl) lastType).type);
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfoImplpath.addResourcePart(pathInfoRoot);
-
- if (ctx.vPs != null) {
- // store the context uriInfoPath
- UriInfoImpl backupUriInfoPath = contextUriInfo;
-
- // set temporary uriInfoPath to collect the path information of the memberExpression
- contextUriInfo = uriInfoImplpath;
-
- ctx.vPs.accept(this);
-
- contextUriInfo = backupUriInfoPath;
-
- }
- return new MemberImpl()
- .setPath(uriInfoImplpath);
-
- }
-
- @Override
- public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.ROUND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.SECOND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitSelect(final SelectContext ctx) {
- List<SelectItemImpl> selectItems = new ArrayList<SelectItemImpl>();
-
- for (SelectItemContext si : ctx.vlSI) {
- selectItems.add((SelectItemImpl) si.accept(this));
- }
-
- return new SelectOptionImpl().setSelectItems(selectItems).setText(decode(ctx.children.get(2).getText()));
- }
-
- @Override
- public Object visitSelectItem(final SelectItemContext ctx) {
- SelectItemImpl selectItem = new SelectItemImpl();
-
- contextSelectItem = selectItem;
- for (SelectSegmentContext si : ctx.vlSS) {
- si.accept(this);
- }
- contextSelectItem = null;
-
- return selectItem;
- }
-
- @Override
- public Object visitSelectSegment(final SelectSegmentContext ctx) {
-
- if (ctx.vS != null) {
- if (ctx.vNS != null) {
- String namespace = decode(ctx.vNS.getText());
- namespace = namespace.substring(0, namespace.length() - 1);
- FullQualifiedName fullName = new FullQualifiedName(namespace, "*");
- contextSelectItem.addAllOperationsInSchema(fullName);
- } else {
- contextSelectItem.setStar(true);
- }
- return null;
- }
-
- String odi = decode(decode(ctx.vODI.getText()));
- if (ctx.vNS == null) {
-
- EdmType prevType = null;
- if (contextSelectItem.getResourceInfo() == null) {
- prevType = contextTypes.peek().type;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
- UriResource last = uriInfo.getLastResourcePart();
- if (!(last instanceof UriResourceTypedImpl)) {
- throw wrap(new UriParserSemanticException("prev segement typed"));
- }
- prevType = getTypeInformation((UriResourceTypedImpl) last).type;
- }
-
- if (!(prevType instanceof EdmStructuralType)) {
- throw wrap(new UriParserSemanticException("Previous select item is not a structural type"));
- }
-
- EdmStructuralType structType = (EdmStructuralType) prevType;
- EdmElement element = structType.getProperty(odi);
- if (element == null) {
- throw wrap(new UriParserSemanticException("Previous select item has not property: " + odi));
- }
-
- // create new segment
- // SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
- // contextSelectItem.addSegment(newSegment);
- if (element instanceof EdmProperty) {
- EdmProperty property = (EdmProperty) element;
- if (property.isPrimitive()) {
-
- UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
- simple.setProperty(property);
-
- UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
- if (uriInfo == null) {
- uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(simple);
- contextSelectItem.setResourceInfo(uriInfo);
- } else {
- uriInfo.addResourcePart(simple);
- }
- return this;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
-
- UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
- complex.setProperty(property);
-
- if (uriInfo == null) {
- uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(complex);
- contextSelectItem.setResourceInfo(uriInfo);
- } else {
- uriInfo.addResourcePart(complex);
- }
- return this;
- }
- } else {
- throw wrap(new UriParserSemanticException("Only Simple and Complex properties within select allowed"));
- }
- } else {
- String namespace = decode(ctx.vNS.getText());
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
- // contextSelectItem.addQualifiedThing(fullName);
-
- if (contextSelectItem.getResourceInfo() == null) {
- EdmType prevType = contextTypes.peek().type;
-
- // check for complex type cast
- if (prevType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if ((ct.compatibleTo((EdmStructuralType) prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(ct);
-
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(resourcePart);
- contextSelectItem.setResourceInfo(uriInfo);
- return this;
- }
- }
- } else if (prevType instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (et != null) {
- if ((et.compatibleTo((EdmStructuralType) prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(et);
-
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(resourcePart);
- contextSelectItem.setResourceInfo(uriInfo);
- return this;
- }
- }
- } else {
- throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
- }
-
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
- UriResource last = uriInfo.getLastResourcePart();
- if (!(last instanceof UriResourceTypedImpl)) {
- throw wrap(new UriParserSemanticException("prev segement typed"));
- }
- EdmType prevType = getTypeInformation((UriResourceTypedImpl) last).type;
-
- if (prevType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if ((ct.compatibleTo((EdmStructuralType) prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(ct);
-
- uriInfo.addResourcePart(resourcePart);
- return this;
- }
- }
- } else if (prevType instanceof EdmEntityType) {
- throw wrap(new UriParserSemanticException("Error"));
- /*
- * EdmEntityType et = edm.getEntityType(fullName);
- * if (et != null) {
- * if ((et.compatibleTo((EdmStructuralType) prevType))) {
- * UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- * resourcePart.setEntryTypeFilter(et);
- *
- * uriInfo.addResourcePart(resourcePart);
- * return this;
- * }
- * }
- */
- } else {
- throw wrap(new UriParserSemanticException("prev segement must be comlex of entity type"));
- }
- }
-
- EdmType prevType = null;
- if (contextSelectItem.getResourceInfo() == null) {
- prevType = contextTypes.peek().type;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) contextSelectItem.getResourceInfo();
- UriResource last = uriInfo.getLastResourcePart();
- if (!(last instanceof UriResourceTypedImpl)) {
- throw wrap(new UriParserSemanticException("prev segement typed"));
- }
- prevType = getTypeInformation((UriResourceTypedImpl) last).type;
- }
-
- FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
-
- // check for action
- EdmAction action = edm.getAction(fullName, finalTypeName, null);
- // TODO verify that null ignores if it is a collection
-
- if (action != null) {
- UriResourceActionImpl uriAction = new UriResourceActionImpl();
- uriAction.setAction(action);
-
- UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
- resourcePath.addResourcePart(uriAction);
- }
-
- // check for function
- EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
- // TODO verify that null ignores if it is a collection
-
- if (function != null) {
- UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
- uriFunction.setFunction(function);
-
- UriInfoImpl resourcePath = (UriInfoImpl) contextSelectItem.getResourceInfo();
- resourcePath.addResourcePart(uriFunction);
- }
- }
- return null;
- }
-
- @Override
- public Object visitSkip(final SkipContext ctx) {
- SkipOptionImpl skiptoken = new SkipOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- return skiptoken.setValue(text).setText(text);
- }
-
- @Override
- public Object visitSkiptoken(final SkiptokenContext ctx) {
- SkipTokenOptionImpl skiptoken = new SkipTokenOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- return skiptoken.setValue(text).setText(text);
- }
-
- @Override
- public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.STARTSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public ExpressionImpl visitSubstringMethodCallExpr(final SubstringMethodCallExprContext ctx) {
- MethodCallImpl ret = new MethodCallImpl();
- ret.setMethod(SupportedMethodCalls.SUBSTRING);
- ret.addParameter((ExpressionImpl) ctx.vE1.accept(this));
- ret.addParameter((ExpressionImpl) ctx.vE2.accept(this));
-
- if (ctx.vE3 != null) {
- ret.addParameter((ExpressionImpl) ctx.vE3.accept(this));
- }
-
- return ret;
-
- }
-
- @Override
- public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TIME)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitTop(final TopContext ctx) {
- TopOptionImpl top = new TopOptionImpl();
-
- String text = decode(ctx.children.get(2).getText());
-
- return top.setValue(text).setText(text);
- }
-
- @Override
- public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TOLOWER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TOTALOFFSETMINUTES)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TOTALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TOUPPER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.TRIM)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitUnary(final UnaryContext ctx) {
- // TODO implement
- return super.visitUnary(ctx);
- }
-
- @Override
- public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
- return new MethodCallImpl()
- .setMethod(SupportedMethodCalls.YEAR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- private ParseCancellationException wrap(final UriParserException uriParserException) {
- return new ParseCancellationException(uriParserException);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
deleted file mode 100644
index e766d68..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserException.java
+++ /dev/null
@@ -1,36 +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;
-
-//TODO Check name of this exception when implementing proper error handling
-public class UriParserException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public UriParserException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public UriParserException(final String message) {
- super(message, null);
- }
-
-}
[16/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
new file mode 100644
index 0000000..ad3e820
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserSemanticException extends UriParserException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public UriParserSemanticException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UriParserSemanticException(final String message) {
+ super(message, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
new file mode 100644
index 0000000..3125557
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+public class UriParserSyntaxException extends UriParserException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public UriParserSyntaxException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UriParserSyntaxException(final String message) {
+ super(message, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
new file mode 100644
index 0000000..e4b1113
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+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.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceAction;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
+
+ protected EdmAction action;
+ protected EdmActionImport actionImport;
+
+ public UriResourceActionImpl() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmAction getAction() {
+ return action;
+ }
+
+ public UriResourceActionImpl setAction(final EdmAction action) {
+ this.action = action;
+ return this;
+ }
+
+ @Override
+ public EdmActionImport getActionImport() {
+ return actionImport;
+ }
+
+ public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
+ this.actionImport = actionImport;
+ setAction(actionImport.getAction());
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return action.getReturnType().isCollection();
+ }
+
+ @Override
+ public EdmType getType() {
+ return action.getReturnType().getType();
+ }
+
+ @Override
+ public String toString() {
+ if (actionImport != null) {
+ return actionImport.getName();
+ } else if (action != null) {
+ return action.getName();
+ }
+ return "";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
new file mode 100644
index 0000000..18f803f
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceComplexProperty;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
+
+ protected EdmProperty property;
+
+ public UriResourceComplexPropertyImpl() {
+ super(UriResourceKind.complexProperty);
+ }
+
+ @Override
+ public EdmProperty getProperty() {
+ return property;
+ }
+
+ public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
+ this.property = property;
+ return this;
+ }
+
+ @Override
+ public EdmComplexType getComplexType() {
+ return (EdmComplexType) getType();
+ }
+
+ @Override
+ public EdmComplexType getComplexTypeFilter() {
+ return (EdmComplexType) typeFilter;
+ }
+
+ @Override
+ public EdmType getType() {
+ return property.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return property.isCollection();
+ }
+
+ @Override
+ public String toString() {
+ return property.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
new file mode 100644
index 0000000..179d174
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceCount;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
+
+ public UriResourceCountImpl() {
+ super(UriResourceKind.count);
+ }
+
+ @Override
+ public String toString() {
+ return "$count";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
new file mode 100644
index 0000000..8c1617a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+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.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
+ protected EdmEntitySet edmEntitySet = null;
+
+ public UriResourceEntitySetImpl() {
+ super(UriResourceKind.entitySet);
+ }
+
+ @Override
+ public EdmEntitySet getEntitySet() {
+ return edmEntitySet;
+ }
+
+ public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
+ edmEntitySet = edmES;
+ return this;
+ }
+
+ @Override
+ public EdmEntityType getEntityType() {
+ return edmEntitySet.getEntityType();
+ }
+
+ @Override
+ public EdmType getType() {
+ return edmEntitySet.getEntityType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates == null) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return edmEntitySet.getName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
new file mode 100644
index 0000000..f1c35bc
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceFunction;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Function imports and BoundFunction in URI
+ */
+public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
+
+ protected List<UriParameterImpl> parameters;
+ protected EdmFunction function;
+ protected EdmFunctionImport functionImport;
+ private boolean isParameterListFilled = false;
+
+ public UriResourceFunctionImpl() {
+ super(UriResourceKind.function);
+ }
+
+ @Override
+ public List<UriParameter> getParameters() {
+ List<UriParameter> retList = new ArrayList<UriParameter>();
+ for (UriParameterImpl item : parameters) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
+ isParameterListFilled = true;
+ this.parameters = parameters;
+ return this;
+ }
+
+ @Override
+ public EdmFunction getFunction() {
+ return function;
+ }
+
+ public UriResourceFunctionImpl setFunction(final EdmFunction function) {
+ this.function = function;
+ return this;
+ }
+
+ @Override
+ public EdmFunctionImport getFunctionImport() {
+ return functionImport;
+ }
+
+ public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
+ final List<UriParameterImpl> parameters) {
+ functionImport = edmFI;
+
+ setParameters(parameters);
+
+ return this;
+ }
+
+ @Override
+ public EdmType getType() {
+ return function.getReturnType().getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null) {
+ return false;
+ }
+ return function.getReturnType().isCollection();
+ }
+
+ @Override
+ public String toString() {
+ if (functionImport != null) {
+ return functionImport.getName();
+ } else if (function != null) {
+ return function.getName();
+ }
+ return "";
+ }
+
+ public boolean isParameterListFilled() {
+ return isParameterListFilled;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java
new file mode 100644
index 0000000..c0b04c6
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public abstract class UriResourceImpl implements UriResource {
+ protected UriResourceKind kind;
+
+ public UriResourceImpl(final UriResourceKind kind) {
+ this.kind = kind;
+ }
+
+ @Override
+ public UriResourceKind getKind() {
+ return kind;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
new file mode 100644
index 0000000..baaf684
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceIt;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
+
+ private EdmType type;
+ private boolean isCollection;
+
+ public UriResourceItImpl() {
+ super(UriResourceKind.it);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public UriResourceItImpl setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null) {
+ return false;
+ }
+ return isCollection;
+ }
+
+ public UriResourceItImpl setCollection(final boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "$it";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
new file mode 100644
index 0000000..39ca238
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
+ protected EdmProperty property;
+ private String lamdaVariable;
+ private ExpressionImpl expression;
+
+ public UriResourceLambdaAllImpl() {
+ super(UriResourceKind.lambdaAll);
+ }
+
+ @Override
+ public EdmType getType() {
+ return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String getLamdaVariable() {
+ return lamdaVariable;
+ }
+
+ public UriResourceLambdaAllImpl setLamdaVariable(final String lamdaVariable) {
+ this.lamdaVariable = lamdaVariable;
+ return this;
+ };
+
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ };
+
+ @Override
+ public String toString() {
+ return "all";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
new file mode 100644
index 0000000..3a20c81
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAny;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
+ protected EdmProperty property;
+ private String lamdaVariable;
+ private ExpressionImpl expression;
+
+ public UriResourceLambdaAnyImpl() {
+ super(UriResourceKind.lambdaAny);
+ }
+
+ @Override
+ public EdmType getType() {
+ return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String getLamdaVariable() {
+ return lamdaVariable;
+ }
+
+ public UriResourceLambdaAnyImpl setLamdaVariable(final String lamdaVariable) {
+ this.lamdaVariable = lamdaVariable;
+ return this;
+ };
+
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "any";
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
new file mode 100644
index 0000000..e3154dc
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaRef;
+
+public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaRef {
+
+ private EdmType type;
+ private boolean isCollection;
+ private String variableText;
+
+ public UriResourceLambdaVarImpl() {
+ super(UriResourceKind.lambdaVariable);
+ }
+
+ @Override
+ public String getVariableText() {
+ return variableText;
+ }
+
+ public UriResourceLambdaVarImpl setVariableText(final String variableText) {
+ this.variableText = variableText;
+ return this;
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public UriResourceLambdaVarImpl setType(final EdmType type) {
+ this.type = type;
+ return this;
+
+ }
+
+ @Override
+ public boolean isCollection() {
+ return isCollection;
+ }
+
+ public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return variableText;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
new file mode 100644
index 0000000..637f09a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceNavigation;
+
+public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
+
+ protected EdmNavigationProperty navigationProperty;
+
+ public UriResourceNavigationPropertyImpl() {
+ super(UriResourceKind.navigationProperty);
+ }
+
+ @Override
+ public EdmNavigationProperty getProperty() {
+ return navigationProperty;
+ }
+
+ public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
+ navigationProperty = property;
+ return this;
+
+ }
+
+ @Override
+ public EdmType getType() {
+ return navigationProperty.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null) {
+ return false;
+ }
+ return navigationProperty.isCollection();
+ }
+
+ @Override
+ public String toString() {
+ return navigationProperty.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
new file mode 100644
index 0000000..3fd4139
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePrimitiveProperty;
+
+public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
+
+ EdmProperty property;
+
+ public UriResourcePrimitivePropertyImpl() {
+ super(UriResourceKind.primitiveProperty);
+ }
+
+ @Override
+ public EdmProperty getProperty() {
+ return property;
+ }
+
+ public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
+ this.property = property;
+ return this;
+ }
+
+ @Override
+ public EdmType getType() {
+ return property.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return property.isCollection();
+ }
+
+ @Override
+ public String toString() {
+ return property.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
new file mode 100644
index 0000000..17cf8f3
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceRef;
+
+public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
+
+ public UriResourceRefImpl() {
+ super(UriResourceKind.ref);
+
+ }
+
+ @Override
+ public String toString() {
+ return "$ref";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
new file mode 100644
index 0000000..1d5f55d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceRoot;
+
+public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
+
+ private EdmType type;
+ private boolean isCollection;
+
+ public UriResourceRootImpl() {
+ super(UriResourceKind.root);
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public UriResourceRootImpl setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null) {
+ return false;
+ }
+ return isCollection;
+ }
+
+ public UriResourceRootImpl setCollection(final boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return "$root";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
new file mode 100644
index 0000000..abb8964
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceSingleton;
+
+public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
+
+ private EdmSingleton singleton;
+
+ public UriResourceSingletonImpl() {
+ super(UriResourceKind.singleton);
+ }
+
+ @Override
+ public EdmSingleton getSingleton() {
+ return singleton;
+ }
+
+ public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
+
+ this.singleton = singleton;
+ return this;
+ }
+
+ @Override
+ public EdmEntityType getEntityTypeFilter() {
+ return (EdmEntityType) typeFilter;
+ }
+
+ @Override
+ public EdmType getType() {
+ return singleton.getEntityType();
+ }
+
+ @Override
+ public EdmEntityType getEntityType() {
+ return singleton.getEntityType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return singleton.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
new file mode 100644
index 0000000..4d635c9
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceStartingTypeFilter;
+
+public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl
+ implements UriResourceStartingTypeFilter {
+
+ private EdmType type;
+ private boolean isCollection;
+
+ public UriResourceStartingTypeFilterImpl() {
+ super(UriResourceKind.startingTypeFilter);
+ }
+
+ @Override
+ public UriResourceKind getKind() {
+ return kind;
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null) {
+ return false;
+ }
+ return isCollection;
+ }
+
+ public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return type.getNamespace() + "." + type.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
new file mode 100644
index 0000000..f718f75
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+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.provider.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+
+public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
+
+ protected EdmType typeFilter = null;
+
+ public UriResourceTypedImpl(final UriResourceKind kind) {
+ super(kind);
+ }
+
+ public EdmType getTypeFilter() {
+ return typeFilter;
+ }
+
+ public UriResourceTypedImpl setTypeFilter(final EdmStructuralType typeFilter) {
+ this.typeFilter = typeFilter;
+ return this;
+ }
+
+ @Override
+ public String toString(final boolean includeFilters) {
+ if (includeFilters) {
+ if (typeFilter != null) {
+ return toString() + "/" + getFQN(typeFilter).toString();
+ } else {
+ return toString();
+ }
+ }
+ return toString();
+ }
+
+ private FullQualifiedName getFQN(final EdmType type) {
+ return new FullQualifiedName(type.getNamespace(), type.getName());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
new file mode 100644
index 0000000..9544b98
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourceValue;
+
+public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
+
+ public UriResourceValueImpl() {
+ super(UriResourceKind.value);
+
+ }
+
+ @Override
+ public String toString() {
+ return "$value";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
new file mode 100644
index 0000000..a54f16a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
+
+public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
+
+ protected EdmType collectionTypeFilter = null;
+ protected List<UriParameterImpl> keyPredicates = null;
+ protected EdmType entryTypeFilter = null;
+
+ public UriResourceWithKeysImpl(final UriResourceKind kind) {
+ super(kind);
+ }
+
+ public EdmType getTypeFilterOnCollection() {
+ return collectionTypeFilter;
+ }
+
+ public EdmType getTypeFilterOnEntry() {
+ return entryTypeFilter;
+ }
+
+ public List<UriParameter> getKeyPredicates() {
+ List<UriParameter> retList = new ArrayList<UriParameter>();
+ for (UriParameterImpl item : keyPredicates) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
+ keyPredicates = list;
+ return this;
+ }
+
+ public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
+ this.entryTypeFilter = entryTypeFilter;
+ return this;
+ }
+
+ public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
+ this.collectionTypeFilter = collectionTypeFilter;
+ return this;
+ }
+
+ public String toString(final boolean includeFilters) {
+
+ if (includeFilters == true) {
+ String tmp = "";
+ if (collectionTypeFilter != null) {
+ tmp += getFQN(collectionTypeFilter).toString();
+ }
+
+ if (entryTypeFilter != null) {
+ if (tmp.length() == 0) {
+ tmp = getFQN(entryTypeFilter).toString();
+ } else {
+ tmp += "/()" + getFQN(entryTypeFilter).toString();
+ }
+ }
+ if (tmp.length() != 0) {
+ return toString() + "/" + tmp;
+ }
+ }
+
+ return toString();
+ }
+
+ private FullQualifiedName getFQN(final EdmType type) {
+ return new FullQualifiedName(type.getNamespace(), type.getName());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java
new file mode 100644
index 0000000..6158168
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.AliasQueryOption;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryOption {
+
+ private ExpressionImpl aliasValue;
+
+ @Override
+ public ExpressionImpl getValue() {
+ return aliasValue;
+ }
+
+ public AliasQueryOptionImpl setAliasValue(final ExpressionImpl aliasValue) {
+ this.aliasValue = aliasValue;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CustomQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CustomQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CustomQueryOptionImpl.java
new file mode 100644
index 0000000..07ad60a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CustomQueryOptionImpl.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+
+public class CustomQueryOptionImpl extends QueryOptionImpl implements CustomQueryOption {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
new file mode 100644
index 0000000..5d7ab42
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.LevelsExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+
+public class ExpandItemImpl implements ExpandItem {
+ private LevelsExpandOption levelsExpandOption;
+ private FilterOption filterOption;
+ private SearchOption searchOption;
+ private OrderByOption orderByOption;
+ private SkipOption skipOption;
+ private TopOption topOption;
+ private InlineCountOption inlineCountOption;
+ private SelectOption selectOption;
+ private ExpandOption expandOption;
+
+ private UriInfoResource resourceInfo;
+
+ private boolean isStar;
+
+ private boolean isRef;
+
+ public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) {
+
+ if (sysItem.getKind() == SupportedQueryOptions.EXPAND) {
+ expandOption = (ExpandOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.FILTER) {
+ filterOption = (FilterOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ inlineCountOption = (InlineCountOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.ORDERBY) {
+ orderByOption = (OrderByOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SEARCH) {
+ searchOption = (SearchOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SELECT) {
+ selectOption = (SelectOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.SKIP) {
+ skipOption = (SkipOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.TOP) {
+ topOption = (TopOptionImpl) sysItem;
+ } else if (sysItem.getKind() == SupportedQueryOptions.LEVELS) {
+ levelsExpandOption = (LevelsExpandOption) sysItem;
+ }
+ return this;
+ }
+
+ public ExpandItemImpl setSystemQueryOptions(final List<SystemQueryOptionImpl> list) {
+
+ for (SystemQueryOptionImpl item : list) {
+ setSystemQueryOption(item);
+ }
+ return this;
+ }
+
+ @Override
+ public LevelsExpandOption getLevelsOption() {
+ return levelsExpandOption;
+ }
+
+ @Override
+ public FilterOption getFilterOption() {
+ return filterOption;
+ }
+
+ @Override
+ public SearchOption getSearchOption() {
+ return searchOption;
+ }
+
+ @Override
+ public OrderByOption getOrderByOption() {
+ return orderByOption;
+ }
+
+ @Override
+ public SkipOption getSkipOption() {
+ return skipOption;
+ }
+
+ @Override
+ public TopOption getTopOption() {
+ return topOption;
+ }
+
+ @Override
+ public InlineCountOption getInlineCountOption() {
+ return inlineCountOption;
+ }
+
+ @Override
+ public SelectOption getSelectOption() {
+
+ return selectOption;
+ }
+
+ @Override
+ public ExpandOption getExpandOption() {
+ return expandOption;
+ }
+
+ public ExpandItemImpl setResourceInfo(final UriInfoResource resourceInfo) {
+ this.resourceInfo = resourceInfo;
+ return this;
+ }
+
+ @Override
+ public UriInfoResource getResourceInfo() {
+
+ return resourceInfo;
+ }
+
+ @Override
+ public boolean isStar() {
+ return isStar;
+ }
+
+ public ExpandItemImpl setIsStar(final boolean isStar) {
+ this.isStar = isStar;
+ return this;
+ }
+
+ @Override
+ public boolean isRef() {
+ return isRef;
+ }
+
+ public ExpandItemImpl setIsRef(final boolean isRef) {
+ this.isRef = isRef;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandOptionImpl.java
new file mode 100644
index 0000000..b3ac035
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandOptionImpl.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption {
+
+ List<ExpandItemImpl> expandItems = new ArrayList<ExpandItemImpl>();
+
+ public ExpandOptionImpl() {
+ setKind(SupportedQueryOptions.EXPAND);
+ }
+
+ public void addExpandItem(final ExpandItemImpl expandItem) {
+ expandItems.add(expandItem);
+ }
+
+ @Override
+ public List<ExpandItem> getExpandItems() {
+ List<ExpandItem> retList = new ArrayList<ExpandItem>();
+ for (ExpandItemImpl item : expandItems) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FilterOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FilterOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FilterOptionImpl.java
new file mode 100644
index 0000000..106ea52
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FilterOptionImpl.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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOption {
+
+ private ExpressionImpl expression;
+
+ public FilterOptionImpl() {
+ setKind(SupportedQueryOptions.FILTER);
+ }
+
+ public FilterOptionImpl setExpression(final ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ }
+
+ @Override
+ public ExpressionImpl getExpression() {
+ return expression;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FormatOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FormatOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FormatOptionImpl.java
new file mode 100644
index 0000000..67a1982
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/FormatOptionImpl.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class FormatOptionImpl extends SystemQueryOptionImpl implements FormatOption {
+ private String value;
+
+ public FormatOptionImpl() {
+ setKind(SupportedQueryOptions.FORMAT);
+ }
+
+ public FormatOptionImpl setFormat(final String value) {
+ this.value = value;
+ return this;
+ }
+
+ @Override
+ public String getFormat() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/IdOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/IdOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/IdOptionImpl.java
new file mode 100644
index 0000000..0789bfd
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/IdOptionImpl.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class IdOptionImpl extends SystemQueryOptionImpl implements IdOption {
+ private String value;
+
+ public IdOptionImpl() {
+ setKind(SupportedQueryOptions.ID);
+ }
+
+ public IdOptionImpl setValue(final String value) {
+ this.value = value;
+ return this;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/InlineCountOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/InlineCountOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/InlineCountOptionImpl.java
new file mode 100644
index 0000000..a274c0a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/InlineCountOptionImpl.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class InlineCountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption {
+
+ private boolean count;
+
+ public InlineCountOptionImpl() {
+ setKind(SupportedQueryOptions.INLINECOUNT);
+ }
+
+ @Override
+ public boolean getValue() {
+ return count;
+ }
+
+ public InlineCountOptionImpl setValue(final boolean count) {
+ this.count = count;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/LevelsOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/LevelsOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/LevelsOptionImpl.java
new file mode 100644
index 0000000..538dc52
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/LevelsOptionImpl.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.LevelsExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class LevelsOptionImpl extends SystemQueryOptionImpl implements LevelsExpandOption {
+ private boolean isMax;
+ private int value;
+
+ public LevelsOptionImpl() {
+ setKind(SupportedQueryOptions.LEVELS);
+ }
+
+ public LevelsOptionImpl setLevel(final int value) {
+ this.value = value;
+ return this;
+ }
+
+ @Override
+ public boolean isMax() {
+ return isMax;
+ }
+
+ public LevelsOptionImpl setMax() {
+ isMax = true;
+ return this;
+
+ }
+
+ @Override
+ public int getLevel() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByItemImpl.java
new file mode 100644
index 0000000..da7ae63
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByItemImpl.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.server.core.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByItem;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class OrderByItemImpl implements OrderByItem {
+
+ private ExpressionImpl expression;
+ private boolean descending = false; // default sort order is ascending
+
+ @Override
+ public boolean isDescending() {
+ return descending;
+ }
+
+ public OrderByItem setDescending(final boolean descending) {
+ this.descending = descending;
+ return this;
+ }
+
+ @Override
+ public ExpressionImpl getExpression() {
+ return expression;
+ }
+
+ public OrderByItem setExpression(final ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
new file mode 100644
index 0000000..1f7cf07
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.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.server.core.uri.queryoption;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByItem;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+
+public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByOption {
+
+ private List<OrderByItemImpl> orders= new ArrayList<OrderByItemImpl>();
+
+ public OrderByOptionImpl() {
+ setKind(SupportedQueryOptions.ORDERBY);
+ }
+
+ @Override
+ public List<OrderByItem> getOrders() {
+ List<OrderByItem> retList = new ArrayList<OrderByItem>();
+ for (OrderByItemImpl item : orders) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ public OrderByOptionImpl addOrder(final OrderByItemImpl order) {
+ orders.add(order);
+ return this;
+ }
+
+}
[03/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
new file mode 100644
index 0000000..af01eb0
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * 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.server.core.uri.antlr;
+
+import org.antlr.v4.runtime.Lexer;
+import org.apache.olingo.odata4.server.core.testutil.TokenValidator;
+import org.apache.olingo.odata4.server.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.log(1).run("ESTwoKeyNav?$filter=CollPropertyComplex/all( l :true)");
+ }
+
+ // ;------------------------------------------------------------------------------
+ // ; 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.IT);
+ // 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("$");
+ // 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(":@/?$'=");
+
+ }
+
+}
[22/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
new file mode 100644
index 0000000..1a8e823
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.search;
+
+public interface SearchTerm extends SearchExpression {
+
+ String getSearchTerm();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
new file mode 100644
index 0000000..b2fd9ea
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.search;
+
+public interface SearchUnary {
+
+ SearchExpression getOperand();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
new file mode 100644
index 0000000..cc5c573
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.search;
+
+public enum SupportedSearchBinaryOperators {
+ // and/or
+ AND("and"), OR("or");
+
+ private String syntax;
+
+ private SupportedSearchBinaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedSearchBinaryOperators get(final String operator) {
+ for (SupportedSearchBinaryOperators op : SupportedSearchBinaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
new file mode 100644
index 0000000..a61e72d
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.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.server.api.uri.queryoption.search;
+
+public enum SupportedSearchUnaryOperators {
+ NOT("not");
+
+ private String syntax;
+
+ private SupportedSearchUnaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedSearchUnaryOperators get(final String operator) {
+ for (SupportedSearchUnaryOperators op : SupportedSearchUnaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/pom.xml b/odata4-lib/odata4-server-core/pom.xml
index e6ada36..58ca7ce 100644
--- a/odata4-lib/odata4-server-core/pom.xml
+++ b/odata4-lib/odata4-server-core/pom.xml
@@ -79,7 +79,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/odata4/producer/core/uri/antlr</libDirectory>
+ <libDirectory>src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr</libDirectory>
</configuration>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
deleted file mode 100644
index 33e7296..0000000
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
+++ /dev/null
@@ -1,405 +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_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); //
-FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
-
-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 : ';' | '%3b';
-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*;
-
-
-//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)
-TOP_I : '$top' -> type(TOP);
-SKIP_I : '$skip' -> type(SKIP);
-FILTER_I : '$filter' -> type(FILTER);
-ORDERBY_I: '$orderby' -> type(ORDERBY);
-SELECT_I: '$select' -> type(SELECT);
-EXPAND_I: '$expand' -> type(EXPAND);
-LEVELS_I: '$levels' -> type(LEVELS);
-MAX: 'max';
-
-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';
-HAS : 'has';
-
-ADD : 'add';
-SUB : 'sub';
-
-ANY_LAMDA : 'any';
-ALL_LAMDA : 'all';
-
-GT : 'gt';
-GE : 'ge';
-LT : 'lt';
-LE : 'le';
-ISOF : 'isof';
-
-EQ_ALPHA : 'eq';
-NE : 'ne';
-
-AND : 'and';
-OR : 'or';
-
-
-NOT : 'not';
-MINUS :'-';
-NANINFINITY : 'NaN' | '-INF' | 'INF';
-
-IT : '$it';
-ITSLASH : '$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';
-
-//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);
-
-AT_Q : '@' -> pushMode(DEFAULT_MODE);
-
-CUSTOMNAME : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_PCHAR;
-//;==============================================================================
-
-AMP_sqp : '&' -> type(AMP), popMode;
-
-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);
-FRAGMENT_sqp : '#' -> type(FRAGMENT), pushMode(MODE_FRAGMENT);
-
-//;==============================================================================
-mode MODE_FRAGMENT;
-// Read the remaining characters of a URI queryparameter up to an & or #
-// character.
-//;==============================================================================
-
-REST_F : ~('\r'|'\n')* -> type(REST), popMode;
-
-//;==============================================================================
-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/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
deleted file mode 100644
index 82d2d60..0000000
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
+++ /dev/null
@@ -1,518 +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
-//TODO add the new "ENTITYCAST"
-odataRelativeUri : BATCH # altBatch
- | ENTITY QM vEO=entityOptions # altEntity
- | ENTITY SLASH vNS=namespace vODI=odataIdentifier QM vEO=entityOptionsCast # altEntityCast
- | METADATA ( QM vF=format )? ( FRAGMENT vCF=contextFragment )? # altMetadata
- | vRP=resourcePath ( QM vQO=queryOptions )? # altResourcePath
- ;
-
-//;------------------------------------------------------------------------------
-//; 1. Resource Path
-//;------------------------------------------------------------------------------
-
-resourcePath : vAll=ALL
- | vCJ=crossjoin
- | vlPS=pathSegments
- ;
-crossjoin : CROSSJOIN OPEN WSP? vlODI+=odataIdentifier WSP? ( COMMA WSP? vlODI+=odataIdentifier WSP?)* CLOSE;
-
-pathSegments : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* vCS=constSegment?;
-
-pathSegment : vNS=namespace? vODI=odataIdentifier vlNVO+=nameValueOptList*;
-
-nameValueOptList : OPEN (vVO=valueOnly | vNVL=nameValueList)? CLOSE;
-valueOnly : vV=commonExpr ;
-nameValueList : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair WSP*)* ;
-nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
-
-constSegment : SLASH (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
-
-count : COUNT;
-ref : REF;
-value : VALUE;
-//;------------------------------------------------------------------------------
-//; 2. Query Options
-//;------------------------------------------------------------------------------
-
-queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;
-
-queryOption : systemQueryOption
- | AT_Q aliasAndValue
- | customQueryOption
- ;
-
-entityOptions : (vlEOb+=entityOption AMP )* vlEOm=id ( AMP vlEOa+=entityOption )*;
-entityOption : format
- | customQueryOption
- ;
-
-entityOptionsCast : (vlEOb+=entityOptionCast AMP )* vlEOm=id ( AMP vlEOa+=entityOptionCast )*;
-entityOptionCast : expand
- | format
- | select
- | filter
- | customQueryOption
- ;
-
-systemQueryOption : expand
- | filter
- | format
- | id
- | inlinecount
- | orderBy
- | search
- | select
- | skip
- | skiptoken
- | top
- ;
-
-id : ID EQ REST;
-skiptoken : SKIPTOKEN EQ REST;
-expand : EXPAND EQ vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
-
-expandItem : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX) CLOSE )?
- | vEP=expandPath vEPE=expandPathExtension?;
-
-
-expandPath : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
-//expandPath : expandPathSegment ( SLASH expandPathSegment )*;
-//expandPathSegment : vNS=namespace? vODI=odataIdentifier;
-
-expandPathExtension : OPEN vlEO+=expandOption ( SEMI vlEO+=expandOption )* CLOSE
- | SLASH vR=ref ( OPEN vlEOR+=expandRefOption ( SEMI vlEOR+=expandRefOption )* CLOSE )?
- | SLASH vC=count ( OPEN vlEOC+=expandCountOption ( SEMI vlEOC+=expandCountOption )* CLOSE )?
- ;
-expandCountOption : filter
- | search
- ;
-expandRefOption : expandCountOption
- | orderBy
- | skip
- | top
- | inlinecount
- ;
-expandOption : expandRefOption
- | select
- | expand
- | levels;
-
-levels : LEVELS EQ ( INT | MAX );
-
-filter : FILTER EQ commonExpr;
-
-orderBy : ORDERBY EQ WSP* vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
-orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
-
-//this is completly done in lexer grammer to avoid ambiguities with odataIdentifier and STRING
-skip : SKIP 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 vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
-selectItem : vlSS+=selectSegment ( SLASH vlSS+=selectSegment ) *;
-selectSegment : vNS=namespace? ( vODI=odataIdentifier | vS=STAR );
-
-aliasAndValue : vODI=ODATAIDENTIFIER EQ vV=parameterValue;
-parameterValue : //TODO json not supported arrayOrObject
- commonExpr
- ;
-
-
-
-customQueryOption : customName ( EQ customValue)?
- ;
-customName : CUSTOMNAME;
-customValue : REST;
-
-
-
-//;------------------------------------------------------------------------------
-//; 3. Context URL Fragments
-//;------------------------------------------------------------------------------
-//TODO add ps+=pathSegment (SLASH ps+=pathSegment)*
-contextFragment : REST;
-
-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
- | vE1=commonExpr (WSP HAS WSP) vE2=commonExpr #altHas
- | methodCallExpr #altMethod
- | ( unary WSP ) commonExpr #altUnary
- | anyExpr #altAny
- | allExpr #altAll
- | memberExpr #altMember
- | vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr #altMult
- | vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr #altAdd
- | vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP
- | WSP vO=LE WSP ) vE2=commonExpr #altComparism
- | vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr #altEquality
- | vE1=commonExpr (WSP AND WSP) vE2=commonExpr #altAnd
- | vE1=commonExpr (WSP OR WSP) vE2=commonExpr #altOr
- | rootExpr #altRoot //; $...
- | AT odataIdentifier #altAlias // @...
- | primitiveLiteral #altLiteral // ...
- ;
-
-unary : (MINUS| NOT) ;
-
-rootExpr : ROOT vPs=pathSegments;
-
-memberExpr : vIt=IT ( SLASH (vANY=anyExpr | vALL=allExpr))?
- | vIts=ITSLASH? vPs=pathSegments ( SLASH (vANY=anyExpr | vALL=allExpr))?;
-
-anyExpr : ANY_LAMDA OPEN WSP? ( vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? )? CLOSE;
-allExpr : ALL_LAMDA OPEN WSP? vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? CLOSE;
-
-methodCallExpr : indexOfMethodCallExpr
- | toLowerMethodCallExpr
- | toUpperMethodCallExpr
- | trimMethodCallExpr
- | substringMethodCallExpr
- | concatMethodCallExpr
- | lengthMethodCallExpr
- | yearMethodCallExpr
- | monthMethodCallExpr
- | dayMethodCallExpr
- | hourMethodCallExpr
- | minuteMethodCallExpr
- | secondMethodCallExpr
- | fractionalsecondsMethodCallExpr
- | totalsecondsMethodCallExpr
- | dateMethodCallExpr
- | timeMethodCallExpr
- | roundMethodCallExpr
- | floorMethodCallExpr
- | ceilingMethodCallExpr
- | geoDistanceMethodCallExpr
- | geoLengthMethodCallExpr
- | totalOffsetMinutesMethodCallExpr
- | minDateTimeMethodCallExpr
- | maxDateTimeMethodCallExpr
- | nowMethodCallExpr
- //from boolean
- | isofExpr
- | castExpr
- | endsWithMethodCallExpr
- | startsWithMethodCallExpr
- | containsMethodCallExpr
- | geoIntersectsMethodCallExpr
- ;
-
-
-containsMethodCallExpr : CONTAINS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-startsWithMethodCallExpr : STARTSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-endsWithMethodCallExpr : ENDSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-lengthMethodCallExpr : LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-indexOfMethodCallExpr : INDEXOF_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-substringMethodCallExpr : SUBSTRING_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? ( COMMA WSP? vE3=commonExpr WSP? )? CLOSE;
-toLowerMethodCallExpr : TOLOWER_WORD WSP? vE1=commonExpr WSP? CLOSE;
-toUpperMethodCallExpr : TOUPPER_WORD WSP? vE1=commonExpr WSP? CLOSE;
-trimMethodCallExpr : TRIM_WORD WSP? vE1=commonExpr WSP? CLOSE;
-concatMethodCallExpr : CONCAT_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-yearMethodCallExpr : YEAR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-monthMethodCallExpr : MONTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-dayMethodCallExpr : DAY_WORD WSP? vE1=commonExpr WSP? CLOSE;
-hourMethodCallExpr : HOUR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-minuteMethodCallExpr : MINUTE_WORD WSP? vE1=commonExpr WSP? CLOSE;
-secondMethodCallExpr : SECOND_WORD WSP? vE1=commonExpr WSP? CLOSE;
-fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
-totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
-dateMethodCallExpr : DATE_WORD WSP? vE1=commonExpr WSP? CLOSE;
-timeMethodCallExpr : TIME_WORD WSP? vE1=commonExpr WSP? CLOSE;
-totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? vE1=commonExpr WSP? CLOSE;
-
-minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
-maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
-nowMethodCallExpr : NOW_WORD WSP? CLOSE;
-
-roundMethodCallExpr : ROUND_WORD WSP? vE1=commonExpr WSP? CLOSE;
-floorMethodCallExpr : FLOOR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-ceilingMethodCallExpr : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
-
-geoDistanceMethodCallExpr : GEO_DISTANCE_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-geoIntersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-isofExpr : ISOF_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
-castExpr : CAST_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier 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
- WSP? COLON WSP?
- 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
- | enumLit
- | geographyCollection
- | geographyLineString
- | geographyMultilineString
- | geographyMultipoint
- | geographyMultipolygon
- | geographyPoint
- | geographyPolygon
- | geometryCollection
- | geometryLineString
- | geometryMultilineString
- | geometryMultipoint
- | geometryMultipolygon
- | geometryPoint
- | geometryPolygon
- ;
-
-
-nullrule : NULLVALUE;// (SQUOTE qualifiedtypename SQUOTE)?;
-booleanNonCase : BOOLEAN | TRUE | FALSE;
-string : STRING;
-
-enumLit : vNS=namespace vODI=odataIdentifier vValues=STRING;
-//enum : namespace odataIdentifier STRING;
-enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
-//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/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
new file mode 100644
index 0000000..33e7296
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * 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); //
+FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
+
+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 : ';' | '%3b';
+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*;
+
+
+//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)
+TOP_I : '$top' -> type(TOP);
+SKIP_I : '$skip' -> type(SKIP);
+FILTER_I : '$filter' -> type(FILTER);
+ORDERBY_I: '$orderby' -> type(ORDERBY);
+SELECT_I: '$select' -> type(SELECT);
+EXPAND_I: '$expand' -> type(EXPAND);
+LEVELS_I: '$levels' -> type(LEVELS);
+MAX: 'max';
+
+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';
+HAS : 'has';
+
+ADD : 'add';
+SUB : 'sub';
+
+ANY_LAMDA : 'any';
+ALL_LAMDA : 'all';
+
+GT : 'gt';
+GE : 'ge';
+LT : 'lt';
+LE : 'le';
+ISOF : 'isof';
+
+EQ_ALPHA : 'eq';
+NE : 'ne';
+
+AND : 'and';
+OR : 'or';
+
+
+NOT : 'not';
+MINUS :'-';
+NANINFINITY : 'NaN' | '-INF' | 'INF';
+
+IT : '$it';
+ITSLASH : '$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';
+
+//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);
+
+AT_Q : '@' -> pushMode(DEFAULT_MODE);
+
+CUSTOMNAME : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_PCHAR;
+//;==============================================================================
+
+AMP_sqp : '&' -> type(AMP), popMode;
+
+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);
+FRAGMENT_sqp : '#' -> type(FRAGMENT), pushMode(MODE_FRAGMENT);
+
+//;==============================================================================
+mode MODE_FRAGMENT;
+// Read the remaining characters of a URI queryparameter up to an & or #
+// character.
+//;==============================================================================
+
+REST_F : ~('\r'|'\n')* -> type(REST), popMode;
+
+//;==============================================================================
+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;
[23/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionNode.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionNode.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionNode.java
new file mode 100644
index 0000000..be4cbe8
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionNode.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.server.api.uri.optiontree;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.server.api.uri.UriResourceProperty;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+
+/**
+ * Contains the merged $expand and $select options
+ */
+public interface OptionNode {
+
+ /**
+ * Contains the list of non navigation properties which should serialized at this expand level.
+ */
+ List<UriResourceProperty> getPropertyChainList();
+
+ List<OptionProperty> getExpandetNavigationProperties();
+
+ /**
+ * Contains the filter which should be applied to this expand level.
+ */
+ FilterOption getFilter();
+
+ /**
+ * Contains the search information which should be applied to this expand level.
+ */
+ SearchOption getSearch();
+
+ /**
+ * Contains the orderBy information which should be applied to this expand level.
+ */
+ OrderByOption getOrderBy();
+
+ /**
+ * Contains the information about how many output entities should be skipped at this
+ * expand level.
+ */
+ SkipOption getSkip();
+
+ /**
+ * Contains the information about how many output items should be serialized at this
+ * expand level.
+ */
+ TopOption getTop();
+
+ /**
+ * Contains the information whether the number of output items should be serialized
+ * at this expand level
+ */
+ InlineCountOption getInlineCount();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionProperty.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionProperty.java
new file mode 100644
index 0000000..a37053c
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/optiontree/OptionProperty.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.server.api.uri.optiontree;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+
+public interface OptionProperty {
+ EdmNavigationProperty getNavigationProperty();
+
+ OptionNode getOptionNode();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/AliasQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/AliasQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/AliasQueryOption.java
new file mode 100644
index 0000000..ea1d5ff
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/AliasQueryOption.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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface AliasQueryOption extends QueryOption {
+
+ public Expression getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CustomQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CustomQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CustomQueryOption.java
new file mode 100644
index 0000000..ccd3c22
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CustomQueryOption.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface CustomQueryOption extends QueryOption {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExceptionVisitExpand.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExceptionVisitExpand.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExceptionVisitExpand.java
new file mode 100644
index 0000000..4240f9a
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExceptionVisitExpand.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public class ExceptionVisitExpand extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
new file mode 100644
index 0000000..f1f9590
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+
+public interface ExpandItem {
+
+ LevelsExpandOption getLevelsOption();
+
+ FilterOption getFilterOption();
+
+ SearchOption getSearchOption();
+
+ OrderByOption getOrderByOption();
+
+ SkipOption getSkipOption();
+
+ TopOption getTopOption();
+
+ InlineCountOption getInlineCountOption();
+
+ SelectOption getSelectOption();
+
+ ExpandOption getExpandOption();
+
+ UriInfoResource getResourceInfo();
+
+ boolean isStar();
+
+ boolean isRef();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandOption.java
new file mode 100644
index 0000000..216fdd1
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandOption.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.server.api.uri.queryoption;
+
+import java.util.List;
+
+public interface ExpandOption extends SystemQueryOption {
+
+ List<ExpandItem> getExpandItems();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FilterOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FilterOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FilterOption.java
new file mode 100644
index 0000000..ed76c5a
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FilterOption.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface FilterOption extends SystemQueryOption {
+
+ Expression getExpression();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
new file mode 100644
index 0000000..8e327c0
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/FormatOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface FormatOption extends SystemQueryOption {
+
+ // TODO Select best representation for format
+ String getFormat();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/IdOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/IdOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/IdOption.java
new file mode 100644
index 0000000..8369caa
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/IdOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface IdOption extends SystemQueryOption {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
new file mode 100644
index 0000000..00530dc
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface InlineCountOption extends SystemQueryOption {
+
+ boolean getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/LevelsExpandOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/LevelsExpandOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/LevelsExpandOption.java
new file mode 100644
index 0000000..f2f38c4
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/LevelsExpandOption.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.server.api.uri.queryoption;
+
+public interface LevelsExpandOption {
+
+ boolean isMax();
+
+ int getLevel();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByItem.java
new file mode 100644
index 0000000..9be1b67
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByItem.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ *
+ * 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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+
+public interface OrderByItem {
+
+ /**
+ * Returns the sort order of the orderBy item
+ * @return if false (default) the sort order is ascending, if true the sort order is descending
+ */
+ boolean isDescending();
+
+ Expression getExpression();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByOption.java
new file mode 100644
index 0000000..ea16a3e
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/OrderByOption.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.server.api.uri.queryoption;
+
+import java.util.List;
+
+public interface OrderByOption extends SystemQueryOption {
+
+ List<OrderByItem> getOrders();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/QueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/QueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/QueryOption.java
new file mode 100644
index 0000000..cb2afb5
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/QueryOption.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.server.api.uri.queryoption;
+
+public interface QueryOption {
+
+ public String getName();
+
+ public String getText();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SearchOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SearchOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SearchOption.java
new file mode 100644
index 0000000..8a3f970
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SearchOption.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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.server.api.uri.queryoption.search.SearchExpression;
+
+public interface SearchOption extends SystemQueryOption {
+
+ SearchExpression getSearchExpression();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
new file mode 100644
index 0000000..75f7566
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+
+public interface SelectItem {
+
+ boolean isStar();
+
+ boolean isAllOperationsInSchema();
+
+ FullQualifiedName getAllOperationsInSchemaNameSpace();
+
+ UriInfoResource getResourceInfo();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectOption.java
new file mode 100644
index 0000000..48c0943
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectOption.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.server.api.uri.queryoption;
+
+import java.util.List;
+
+public interface SelectOption extends SystemQueryOption {
+
+ List<SelectItem> getSelectItems();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipOption.java
new file mode 100644
index 0000000..e3e5599
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface SkipOption extends SystemQueryOption {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipTokenOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipTokenOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipTokenOption.java
new file mode 100644
index 0000000..46eeea8
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SkipTokenOption.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ *
+ * 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.server.api.uri.queryoption;
+
+public interface SkipTokenOption extends SystemQueryOption {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
new file mode 100644
index 0000000..047fb81
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SupportedQueryOptions.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public enum SupportedQueryOptions {
+ FILTER("$filter"),
+ FORMAT("$format"),
+ EXPAND("$expand"),
+ ID("$id"),
+ INLINECOUNT("$inlinecount"),
+ ORDERBY("$orderby"),
+ SEARCH("$search"),
+ SELECT("$select"),
+ SKIP("$skip"),
+ SKIPTOKEN("$skiptoken"),
+ TOP("$top"),
+ LEVELS("$level");
+
+ String syntax;
+
+ private SupportedQueryOptions(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SystemQueryOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SystemQueryOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SystemQueryOption.java
new file mode 100644
index 0000000..09edcf0
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SystemQueryOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface SystemQueryOption extends QueryOption {
+
+ SupportedQueryOptions getKind();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/TopOption.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/TopOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/TopOption.java
new file mode 100644
index 0000000..ec1ed59
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/TopOption.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption;
+
+public interface TopOption extends SystemQueryOption {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/AliasExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/AliasExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/AliasExpression.java
new file mode 100644
index 0000000..133a2c1
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/AliasExpression.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public interface AliasExpression extends Expression {
+
+ public String getParameterName();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/BinaryExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/BinaryExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/BinaryExpression.java
new file mode 100644
index 0000000..69bf7a6
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/BinaryExpression.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public interface BinaryExpression extends Expression {
+
+ public SupportedBinaryOperators getOperator();
+
+ public Expression getLeftOperand();
+
+ public Expression getRightOperand();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Constant.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Constant.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Constant.java
new file mode 100644
index 0000000..b136450
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Constant.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public interface Constant extends Expression {
+
+ public boolean isNull();
+
+ public boolean isTrue();
+
+ public boolean isFalse();
+
+ public SupportedConstants getKind();
+
+ public EdmType getType();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Enumeration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Enumeration.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Enumeration.java
new file mode 100644
index 0000000..126cb97
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Enumeration.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+
+public interface Enumeration extends Expression {
+
+ public List<String> getValues();
+ public EdmEnumType getType();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExceptionVisitExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExceptionVisitExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExceptionVisitExpression.java
new file mode 100644
index 0000000..0afed8c
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExceptionVisitExpression.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public class ExceptionVisitExpression extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Expression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Expression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Expression.java
new file mode 100644
index 0000000..2750115
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Expression.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public interface Expression extends VisitableExression {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExpressionVisitor.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExpressionVisitor.java
new file mode 100644
index 0000000..e85d2c2
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/ExpressionVisitor.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.server.api.uri.queryoption.expression;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+
+public interface ExpressionVisitor<T> {
+
+ T visitBinaryOperator(SupportedBinaryOperators operator, T left, T right)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitUnaryOperator(SupportedUnaryOperators operator, T operand)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitMethodCall(SupportedMethodCalls methodCall, List<T> parameters)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLambdaExpression(String functionText,String variableText, Expression expression)
+ throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLiteral(String literal) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitMember(UriInfoResource member) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitAlias(String referenceName) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitTypeLiteral(EdmType type) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitLambdaReference(String variableText) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitEnum(EdmEnumType type, List<String> enumValues) throws ExceptionVisitExpression, ODataApplicationException;
+
+ T visitConstant(SupportedConstants kind) throws ExceptionVisitExpression, ODataApplicationException;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/LambdaRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/LambdaRef.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/LambdaRef.java
new file mode 100644
index 0000000..9e6a071
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/LambdaRef.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public interface LambdaRef extends Expression {
+
+ public String getVariableName();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Literal.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Literal.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Literal.java
new file mode 100644
index 0000000..95cdffa
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Literal.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+public interface Literal extends Expression {
+
+ public String getText();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
new file mode 100644
index 0000000..e0d6d19
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+
+public interface Member extends Expression {
+
+ public UriInfoResource getPath();
+
+ public EdmType getType();
+
+ public boolean isCollection();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/MethodCall.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/MethodCall.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/MethodCall.java
new file mode 100644
index 0000000..75ef6f5
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/MethodCall.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.expression;
+
+import java.util.List;
+
+public interface MethodCall extends Expression {
+
+ public SupportedMethodCalls getMethod();
+
+ public List<Expression> getParameters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedBinaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedBinaryOperators.java
new file mode 100644
index 0000000..3e7ca77
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedBinaryOperators.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.server.api.uri.queryoption.expression;
+
+public enum SupportedBinaryOperators {
+
+ //enum
+ HAS("has"),
+ // multiplicative
+ MUL("mul"), DIV("div"), MOD("mod"),
+ // additive
+ ADD("add"), SUB("sub"),
+ // comparism
+ GT("gt"), GE("ge"), LT("lt"), LE("le"),
+ // equality
+ EQ("eq"), NE("ne"),
+ // and/or
+ AND("and"), OR("or");
+
+ private String syntax;
+
+ private SupportedBinaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ public static SupportedBinaryOperators get(final String operator) {
+ for (SupportedBinaryOperators op : SupportedBinaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedConstants.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedConstants.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedConstants.java
new file mode 100644
index 0000000..4e7b835
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedConstants.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.server.api.uri.queryoption.expression;
+
+public enum SupportedConstants {
+
+ TRUE("true"),
+ FALSE("false"),
+ NULL("null");
+
+ private String syntax;
+
+ private SupportedConstants(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ public static SupportedConstants get(final String operator) {
+ for (SupportedConstants op : SupportedConstants.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedMethodCalls.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedMethodCalls.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedMethodCalls.java
new file mode 100644
index 0000000..cf6d628
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedMethodCalls.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.server.api.uri.queryoption.expression;
+
+public enum SupportedMethodCalls {
+ CONTAINS("contains"), STARTSWITH("startswith"), ENDSWITH("endswith"), LENGTH("length"),
+ INDEXOF("indexof"), SUBSTRING("substring"), TOLOWER("tolower"), TOUPPER("toupper"), TRIM("trim"),
+ CONCAT("concat"),
+
+ YEAR("year"), MONTH("month"), DAY("day"), HOUR("hour"), MINUTE("minute"), SECOND("second"),
+ FRACTIONALSECONDS("fractionalseconds"), TOTALSECONDS("totalseconds"), DATE("date"), TIME("time"),
+ TOTALOFFSETMINUTES("totaloffsetminutes"), MINDATETIME("mindatetime"), MAXDATETIME("maxdatetime"), NOW("now"),
+
+ ROUND("round"), FLOOR("floor"),
+
+ CEILING("ceiling"), GEODISTANCE("geo.distance"), GEOLENGTH("geo.length"), GEOINTERSECTS("geo.intersects"),
+ CAST("cast"),
+ ISOF("isof");
+
+ private String syntax;
+
+ private SupportedMethodCalls(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedMethodCalls get(final String method) {
+ for (SupportedMethodCalls op : SupportedMethodCalls.values()) {
+ if (op.toString().equals(method )) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedUnaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedUnaryOperators.java
new file mode 100644
index 0000000..f0cbf55
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/SupportedUnaryOperators.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.server.api.uri.queryoption.expression;
+
+public enum SupportedUnaryOperators {
+ MINUS("-"), NOT("not");
+
+ private String syntax;
+
+ private SupportedUnaryOperators(final String syntax) {
+ this.syntax = syntax;
+ }
+
+ @Override
+ public String toString() {
+ return syntax;
+ }
+
+ public static SupportedUnaryOperators get(final String operator) {
+ for (SupportedUnaryOperators op : SupportedUnaryOperators.values()) {
+ if (op.toString().equals(operator)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/TypeLiteral.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/TypeLiteral.java
new file mode 100644
index 0000000..2dca987
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/TypeLiteral.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.server.api.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+
+public interface TypeLiteral extends Expression {
+
+ public EdmType getType();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/UnaryOperator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/UnaryOperator.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/UnaryOperator.java
new file mode 100644
index 0000000..513e2d8
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/UnaryOperator.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.server.api.uri.queryoption.expression;
+
+public interface UnaryOperator extends Expression {
+
+ public Expression getOperand();
+
+ public SupportedUnaryOperators getOperator();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/VisitableExression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/VisitableExression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/VisitableExression.java
new file mode 100644
index 0000000..c3dc108
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/VisitableExression.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.server.api.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+
+public interface VisitableExression {
+
+ /**
+ * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
+ * each expression used as node in an expression tree. The implementations should
+ * behave as follows:
+ * <li>Call accept on all sub nodes and store the returned Objects which are of the generic type T
+ * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored return objects
+ * to that instance
+ * <li>Return the object which should be passed to the processing algorithm of the parent expression node
+ * <br>
+ * <br>
+ * @param visitor
+ * Object (implementing {@link ExpressionVisitor}) whose methods are called during traversing a
+ * expression node of the expression tree.
+ * @return
+ * Object of type T which should be passed to the processing algorithm of the parent expression node
+ * @throws ExceptionVisitExpression
+ * Exception occurred the OData library while traversing the tree
+ * @throws ODataApplicationException
+ * Exception thrown by the application who implemented the visitor
+ */
+ <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchBinary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchBinary.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchBinary.java
new file mode 100644
index 0000000..1431f9f
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchBinary.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.search;
+
+public interface SearchBinary extends SearchExpression {
+
+ SupportedSearchBinaryOperators getOperator();
+
+ SearchExpression getLeftOperand();
+
+ SearchExpression getRightOperand();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchExpression.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchExpression.java
new file mode 100644
index 0000000..0290d81
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchExpression.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.server.api.uri.queryoption.search;
+
+public interface SearchExpression {
+
+}
[18/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
deleted file mode 100644
index b9b4b0d..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptionImpl.java
+++ /dev/null
@@ -1,47 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.QueryOption;
-
-public class QueryOptionImpl implements QueryOption {
- private String name;
- private String text;
-
- @Override
- public String getName() {
- return name;
- }
-
- public QueryOptionImpl setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public String getText() {
- return text;
- }
-
- public QueryOptionImpl setText(final String value) {
- text = value;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
deleted file mode 100644
index 088329e..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SearchOptionImpl.java
+++ /dev/null
@@ -1,41 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SearchOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.search.SearchExpression;
-
-/* TODO implement */
-public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOption {
-
- public SearchOptionImpl() {
- setKind(SupportedQueryOptions.SEARCH);
- }
-
- @Override
- public SearchExpression getSearchExpression() {
- // TODO $search not supported yet
- return null;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
deleted file mode 100644
index f48487a..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectItemImpl.java
+++ /dev/null
@@ -1,72 +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.queryoption;
-
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-
-public class SelectItemImpl implements SelectItem {
-
- private UriInfoResource path;
-
- private boolean isStar;
- private FullQualifiedName addOperationsInSchemaNameSpace;
-
- @Override
- public UriInfoResource getResourceInfo() {
-
- return path;
- }
-
- public SelectItemImpl setResourceInfo(UriInfoResource path) {
- this.path = path;
- return this;
- }
-
- @Override
- public boolean isStar() {
- return isStar;
- }
-
- public SelectItemImpl setStar(final boolean isStar) {
- this.isStar = isStar;
- return this;
- }
-
- @Override
- public boolean isAllOperationsInSchema() {
- if (addOperationsInSchemaNameSpace == null) {
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- public FullQualifiedName getAllOperationsInSchemaNameSpace() {
- return addOperationsInSchemaNameSpace;
- }
-
- public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
- this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
deleted file mode 100644
index 4298b75..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SelectOptionImpl.java
+++ /dev/null
@@ -1,50 +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.queryoption;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOption {
-
- private List<SelectItemImpl> selectItems;
-
- public SelectOptionImpl() {
- setKind(SupportedQueryOptions.SELECT);
- }
-
- public SelectOptionImpl setSelectItems(final List<SelectItemImpl> selectItems) {
- this.selectItems = selectItems;
- return this;
- }
-
- @Override
- public List<SelectItem> getSelectItems() {
- List<SelectItem> retList = new ArrayList<SelectItem>();
- for (SelectItemImpl item : selectItems) {
- retList.add(item);
- }
- return retList;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
deleted file mode 100644
index 9faacfa..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipOptionImpl.java
+++ /dev/null
@@ -1,42 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class SkipOptionImpl extends SystemQueryOptionImpl implements SkipOption {
- private String value;
-
- public SkipOptionImpl() {
- setKind(SupportedQueryOptions.SKIP);
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- public SkipOptionImpl setValue(final String value) {
- this.value = value;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
deleted file mode 100644
index 0011e37..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SkipTokenOptionImpl.java
+++ /dev/null
@@ -1,42 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-
-public class SkipTokenOptionImpl extends SystemQueryOptionImpl implements SkipTokenOption {
- private String skipTokenValue;
-
- public SkipTokenOptionImpl() {
- setKind(SupportedQueryOptions.SKIPTOKEN);
- }
-
- @Override
- public String getValue() {
- return skipTokenValue;
- }
-
- public SkipTokenOptionImpl setValue(final String skipTokenValue) {
- this.skipTokenValue = skipTokenValue;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
deleted file mode 100644
index 580cc89..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/SystemQueryOptionImpl.java
+++ /dev/null
@@ -1,42 +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.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOption;
-
-public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption {
-
- private SupportedQueryOptions kind;
-
- @Override
- public SupportedQueryOptions getKind() {
- return kind;
- }
-
- void setKind(final SupportedQueryOptions kind) {
- this.kind = kind;
- }
-
- @Override
- public String getName() {
- return kind.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.java
deleted file mode 100644
index 4cb3b50..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/TopOptionImpl.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.core.uri.queryoption;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.TopOption;
-
-/* TODO implement */
-public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
- private String value;
-
- public TopOptionImpl() {
- setKind(SupportedQueryOptions.TOP);
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- public TopOptionImpl setValue(final String value) {
- this.value = value;
- return this;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
deleted file mode 100644
index e6812ac..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
+++ /dev/null
@@ -1,44 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.AliasExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-
-public class AliasImpl extends ExpressionImpl implements AliasExpression {
-
- private String parameterName;
-
- @Override
- public String getParameterName() {
- return parameterName;
- }
-
- public void setParameter(final String ParameterName) {
- this.parameterName = ParameterName;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitAlias(parameterName);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
deleted file mode 100644
index 480abcb..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/BinaryImpl.java
+++ /dev/null
@@ -1,70 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.BinaryExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
-
-public class BinaryImpl extends ExpressionImpl implements BinaryExpression {
-
- private SupportedBinaryOperators operator;
- private ExpressionImpl left;
- private ExpressionImpl right;
-
- @Override
- public SupportedBinaryOperators getOperator() {
- return operator;
- }
-
- public BinaryExpression setOperator(final SupportedBinaryOperators operator) {
- this.operator = operator;
- return this;
- }
-
- @Override
- public Expression getLeftOperand() {
- return left;
- }
-
- public void setLeftOperand(final ExpressionImpl operand) {
- left = operand;
- }
-
- @Override
- public Expression getRightOperand() {
- return right;
- }
-
- public void setRightOperand(final ExpressionImpl operand) {
- right = operand;
-
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- T left = this.left.accept(visitor);
- T right = this.right.accept(visitor);
- return visitor.visitBinaryOperator(operator, left, right);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ConstantImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ConstantImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ConstantImpl.java
deleted file mode 100644
index cbfcc90..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ConstantImpl.java
+++ /dev/null
@@ -1,73 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Constant;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
-
-public class ConstantImpl extends ExpressionImpl implements Constant {
-
- EdmType type;
- SupportedConstants kind;
-
- @Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitConstant(kind);
- }
-
- @Override
- public boolean isNull() {
- return kind == SupportedConstants.NULL;
- }
-
- @Override
- public boolean isTrue() {
- return kind == SupportedConstants.TRUE;
- }
-
- @Override
- public boolean isFalse() {
- return kind == SupportedConstants.FALSE;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public ConstantImpl setType(EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public SupportedConstants getKind() {
- return kind;
- }
-
- public ConstantImpl setKind(SupportedConstants kind) {
- this.kind = kind;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
deleted file mode 100644
index 65baa6d..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
+++ /dev/null
@@ -1,60 +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.queryoption.expression;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Enumeration;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-
-public class EnumerationImpl extends ExpressionImpl implements Enumeration {
-
- private EdmEnumType type;
- private List<String> values = new ArrayList<String>();
-
- @Override
- public List<String> getValues() {
- return values;
- }
-
- public EnumerationImpl addValue(final String enumValue) {
- values.add(enumValue);
- return this;
- }
-
- @Override
- public EdmEnumType getType() {
- return type;
- }
-
- public EnumerationImpl setType(final EdmEnumType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitEnum(type, values);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
deleted file mode 100644
index 0854630..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionImpl.java
+++ /dev/null
@@ -1,25 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-
-public abstract class ExpressionImpl implements Expression {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
deleted file mode 100644
index 9911099..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
+++ /dev/null
@@ -1,46 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.LambdaRef;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class LambdaRefImpl extends ExpressionImpl implements LambdaRef, VisitableExression {
-
- private String variableText;
-
- @Override
- public String getVariableName() {
- return variableText;
- }
-
- public LambdaRefImpl setVariableText(final String text) {
- variableText = text;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitLambdaReference(variableText);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
deleted file mode 100644
index 0057bf0..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LiteralImpl.java
+++ /dev/null
@@ -1,46 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Literal;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class LiteralImpl extends ExpressionImpl implements Literal, VisitableExression {
-
- private String text;
-
- @Override
- public String getText() {
- return text;
- }
-
- public LiteralImpl setText(final String text) {
- this.text = text;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitLiteral(text);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
deleted file mode 100644
index ce43a30..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
+++ /dev/null
@@ -1,88 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceTypedImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceWithKeysImpl;
-
-public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
-
- private UriInfoResource path;
-
- @Override
- public UriInfoResource getPath() {
- return path;
- }
-
- public Member setPath(final UriInfoResource pathSegments) {
- path = pathSegments;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitMember(path);
- }
-
- @Override
- public EdmType getType() {
- UriInfoImpl uriInfo = (UriInfoImpl) path;
- UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
-
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastKeyPred = (UriResourceWithKeysImpl) lastResourcePart;
- if (lastKeyPred.getTypeFilterOnEntry() != null) {
- return lastKeyPred.getTypeFilterOnEntry();
- } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
- return lastKeyPred.getTypeFilterOnCollection();
- }
- return lastKeyPred.getType();
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
- EdmType type = lastTyped.getTypeFilter();
- if (type != null) {
- return type;
- }
- return lastTyped.getType();
- } else {
- return null;
- }
- }
-
- @Override
- public boolean isCollection() {
- UriInfoImpl uriInfo = (UriInfoImpl) path;
- UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
- if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
- return lastTyped.isCollection();
- }
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
deleted file mode 100644
index a9d4022..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MethodCallImpl.java
+++ /dev/null
@@ -1,70 +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.queryoption.expression;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.MethodCall;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class MethodCallImpl extends ExpressionImpl implements MethodCall, VisitableExression {
-
- private SupportedMethodCalls method;
- private List<ExpressionImpl> parameters = new ArrayList<ExpressionImpl>();
-
- @Override
- public SupportedMethodCalls getMethod() {
- return method;
- }
-
- public MethodCallImpl setMethod(final SupportedMethodCalls methodCalls) {
- method = methodCalls;
- return this;
- }
-
- @Override
- public List<Expression> getParameters() {
- List<Expression> list = new ArrayList<Expression>();
- for (ExpressionImpl item : parameters) {
- list.add(item);
- }
- return list;
- }
-
- public MethodCallImpl addParameter(final ExpressionImpl readCommonExpression) {
- parameters.add(readCommonExpression);
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- List<T> userParameters = new ArrayList<T>();
- for (ExpressionImpl parameter : parameters) {
- userParameters.add(parameter.accept(visitor));
- }
- return visitor.visitMethodCall(method, userParameters);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
deleted file mode 100644
index e0a43ce..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/TypeLiteralImpl.java
+++ /dev/null
@@ -1,47 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.TypeLiteral;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class TypeLiteralImpl extends ExpressionImpl implements TypeLiteral, VisitableExression {
-
- private EdmType type;
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public TypeLiteralImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- return visitor.visitTypeLiteral(type);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
deleted file mode 100644
index e2cce17..0000000
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
+++ /dev/null
@@ -1,58 +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.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.UnaryOperator;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class UnaryImpl extends ExpressionImpl implements UnaryOperator, VisitableExression {
-
- private SupportedUnaryOperators operator;
- private ExpressionImpl expression;
-
- @Override
- public SupportedUnaryOperators getOperator() {
- return operator;
- }
-
- public void setOperator(final SupportedUnaryOperators operator) {
- this.operator = operator;
- }
-
- @Override
- public Expression getOperand() {
- return expression;
- }
-
- public void setOperand(final ExpressionImpl expression) {
- this.expression = expression;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
- T operand = expression.accept(visitor);
- return visitor.visitUnaryOperator(operator, operand);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/Parser.java
new file mode 100644
index 0000000..a97c899
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/Parser.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.server.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.atn.PredictionMode;
+import org.antlr.v4.runtime.misc.ParseCancellationException;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
+
+public class Parser {
+ public UriInfo parseUri(final String input, final UriParseTreeVisitor uriParseTreeVisitor)
+ throws UriParserException {
+
+ try {
+ OdataRelativeUriEOFContext parseTree = parseInput(input, true);
+
+ // reset visitor
+ uriParseTreeVisitor.init();
+ parseTree.accept(uriParseTreeVisitor);
+ UriInfoImpl uriInput = uriParseTreeVisitor.getUriInfo();
+
+ return uriInput;
+
+ } catch (ParseCancellationException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof UriParserException) {
+ throw (UriParserException) cause;
+ }
+ }
+ throw new UriParserSyntaxException("unknown syntax error");
+ }
+
+ private OdataRelativeUriEOFContext parseInput(final String input, boolean onResource)
+ throws UriParserSyntaxException {
+ 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));
+
+ // Set error strategy
+ addStage1ErrorStategy(parser);
+
+ // Set error collector
+ addStage1ErrorListener(parser);
+
+ // user the faster LL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+
+ // parse
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (ParseCancellationException hardException) {
+ // stage = 2
+ try {
+
+ // create parser
+ lexer = new UriLexer(new ANTLRInputStream(input));
+ parser = new UriParserParser(new CommonTokenStream(lexer));
+
+ // Set error strategy
+ addStage2ErrorStategy(parser);
+
+ // Set error collector
+ addStage2ErrorListener(parser);
+
+ // Use the slower SLL parsing
+ parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+
+ // parse
+ ret = parser.odataRelativeUriEOF();
+
+ } catch (Exception weakException) {
+ throw new UriParserSyntaxException("Error in syntax", weakException);
+
+ // exceptionOnStage = 2;
+ }
+ } catch (Exception hardException) {
+ throw new UriParserSyntaxException("Error in syntax", hardException);
+ }
+
+ return ret;
+ }
+
+ protected void addStage1ErrorStategy(UriParserParser parser) {
+ // Throw exception at first syntax error
+ parser.setErrorHandler(new BailErrorStrategy());
+
+ }
+
+ protected void addStage2ErrorStategy(UriParserParser parser) {
+ // Throw exception at first syntax error
+ parser.setErrorHandler(new BailErrorStrategy());
+ }
+
+ protected void addStage1ErrorListener(UriParserParser parser) {
+ // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
+ parser.removeErrorListeners();
+ }
+
+ protected void addStage2ErrorListener(UriParserParser parser) {
+ // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
+ parser.removeErrorListeners();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
new file mode 100644
index 0000000..b37a8bd
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * 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.server.core.uri;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.server.api.uri.UriInfo;
+import org.apache.olingo.odata4.server.api.uri.UriInfoAll;
+import org.apache.olingo.odata4.server.api.uri.UriInfoBatch;
+import org.apache.olingo.odata4.server.api.uri.UriInfoCrossjoin;
+import org.apache.olingo.odata4.server.api.uri.UriInfoEntityId;
+import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.server.api.uri.UriInfoMetadata;
+import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.server.api.uri.UriInfoService;
+import org.apache.olingo.odata4.server.api.uri.UriResource;
+import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SkipTokenOption;
+import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions;
+import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption;
+import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.FormatOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.IdOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.InlineCountOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SearchOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SkipTokenOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.SystemQueryOptionImpl;
+import org.apache.olingo.odata4.server.core.uri.queryoption.TopOptionImpl;
+
+public class UriInfoImpl implements UriInfo {
+
+ private UriInfoKind kind;
+
+ private List<String> entitySetNames = new ArrayList<String>(); // for $entity
+ private EdmEntityType entityTypeCast; // for $entity
+
+ // Query options
+ private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
+ private ExpandOptionImpl expandOption;
+ private FilterOptionImpl filterOption;
+ private FormatOptionImpl formatOption;
+ private IdOption idOption;
+ private InlineCountOptionImpl inlineCountOption;
+ private OrderByOptionImpl orderByOption;
+ private SearchOptionImpl searchOption;
+ private SelectOptionImpl selectOption;
+ private SkipOptionImpl skipOption;
+ private SkipTokenOptionImpl skipTokenOption;
+ private TopOptionImpl topOption;
+
+ private String fragment;
+
+ private UriResource lastResourcePart;
+ private List<UriResource> pathParts = new ArrayList<UriResource>();
+
+ @Override
+ public UriInfoAll asUriInfoAll() {
+ return this;
+ }
+
+ @Override
+ public UriInfoBatch asUriInfoBatch() {
+ return this;
+ }
+
+ @Override
+ public UriInfoCrossjoin asUriInfoCrossjoin() {
+ return this;
+ }
+
+ @Override
+ public UriInfoEntityId asUriInfoEntityId() {
+ return this;
+ }
+
+ @Override
+ public UriInfoMetadata asUriInfoMetadata() {
+ return this;
+ }
+
+ @Override
+ public UriInfoResource asUriInfoResource() {
+ return this;
+ }
+
+ @Override
+ public List<String> getEntitySetNames() {
+ return Collections.unmodifiableList(entitySetNames);
+ }
+
+ public void addEntitySetName(final String entitySet) {
+ entitySetNames.add(entitySet);
+ }
+
+ @Override
+ public List<UriResource> getUriResourceParts() {
+ List<UriResource> returnList = new ArrayList<UriResource>();
+ for (UriResource item : pathParts) {
+ returnList.add(item);
+ }
+ return Collections.unmodifiableList(returnList);
+ }
+
+ public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
+ pathParts.add(uriPathInfo);
+ lastResourcePart = uriPathInfo;
+ return this;
+ }
+
+ @Override
+ public List<CustomQueryOption> getCustomQueryOptions() {
+ List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
+ for (CustomQueryOptionImpl item : customQueryOptions) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ @Override
+ public EdmEntityType getEntityTypeCast() {
+ return entityTypeCast;
+ }
+
+ public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
+ entityTypeCast = type;
+ return this;
+ }
+
+ @Override
+ public ExpandOption getExpandOption() {
+ return expandOption;
+ }
+
+ @Override
+ public FilterOption getFilterOption() {
+ return filterOption;
+ }
+
+ @Override
+ public FormatOption getFormatOption() {
+ return formatOption;
+ }
+
+ @Override
+ public IdOption getIdOption() {
+ return idOption;
+ }
+
+ @Override
+ public InlineCountOption getInlineCountOption() {
+ return inlineCountOption;
+ }
+
+ @Override
+ public UriInfoKind getKind() {
+ return kind;
+ }
+
+ public UriInfoImpl setKind(final UriInfoKind kind) {
+ this.kind = kind;
+ return this;
+ }
+
+ public UriResource getLastResourcePart() {
+ return lastResourcePart;
+ }
+
+ @Override
+ public OrderByOption getOrderByOption() {
+ return orderByOption;
+ }
+
+ @Override
+ public SearchOption getSearchOption() {
+
+ return searchOption;
+ }
+
+ @Override
+ public SelectOption getSelectOption() {
+ return selectOption;
+ }
+
+ @Override
+ public SkipOption getSkipOption() {
+ return skipOption;
+ }
+
+ @Override
+ public SkipTokenOption getSkipTokenOption() {
+ return skipTokenOption;
+ }
+
+ @Override
+ public TopOption getTopOption() {
+ return topOption;
+ }
+
+
+ public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
+
+ for (QueryOptionImpl item : list) {
+ if (item instanceof SystemQueryOptionImpl) {
+ setSystemQueryOption((SystemQueryOptionImpl)item);
+ } else if (item instanceof CustomQueryOptionImpl) {
+ customQueryOptions.add((CustomQueryOptionImpl) item);
+ }
+ }
+ return this;
+ }
+
+ public UriInfoImpl setSystemQueryOption(SystemQueryOptionImpl systemOption) {
+
+ if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
+ expandOption = (ExpandOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
+ filterOption = (FilterOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.FORMAT) {
+ formatOption = (FormatOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.ID) {
+ idOption = (IdOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.INLINECOUNT) {
+ inlineCountOption = (InlineCountOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.ORDERBY) {
+ orderByOption = (OrderByOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.SEARCH) {
+ searchOption = (SearchOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.SELECT) {
+ selectOption = (SelectOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.SKIP) {
+ skipOption = (SkipOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.SKIPTOKEN) {
+ skipTokenOption = (SkipTokenOptionImpl) systemOption;
+ } else if (systemOption.getKind() == SupportedQueryOptions.TOP) {
+ topOption = (TopOptionImpl) systemOption;
+ }
+ return this;
+ }
+
+ @Override
+ public UriInfoService asUriInfoService() {
+ return this;
+ }
+
+
+ public String getFragment() {
+ return fragment;
+ }
+
+ public UriInfoImpl setFragment(String fragment) {
+ this.fragment = fragment;
+ return this;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
new file mode 100644
index 0000000..e87c89d
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ *
+ * 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.server.core.uri;
+
+import org.apache.olingo.odata4.server.api.uri.UriParameter;
+import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriParameterImpl implements UriParameter {
+ private String name;
+ private String text;
+ private String alias;
+ private Expression expression;
+ private String referencedProperty;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public UriParameterImpl setName(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ public UriParameterImpl setAlias(final String alias) {
+ this.alias = alias;
+ return this;
+ }
+
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ public UriParameterImpl setText(final String text) {
+ this.text = text;
+ return this;
+ }
+
+ @Override
+ public Expression getExression() {
+ return expression;
+ }
+
+ public UriParameterImpl setExpression(final ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ }
+
+ @Override
+ public String getRefencedProperty() {
+ return this.referencedProperty;
+ }
+
+ public UriParameterImpl setRefencedProperty(String referencedProperty) {
+ this.referencedProperty = referencedProperty;
+ return this;
+ }
+
+}
[12/28] [OLINGO-161] Refactored Java package names
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
deleted file mode 100644
index f06b486..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
+++ /dev/null
@@ -1,562 +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.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.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriParameter;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceLambdaAllImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceLambdaAnyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceSingletonImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceWithKeysImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceValidator implements Validator {
- private Edm edm;
- private Validator invokedBy;
- private UriInfo uriInfo = null;
-
- private UriResourceImpl uriPathInfo = null;
- private int uriResourceIndex;
-
- // --- Setup ---
-
- public UriResourceValidator setUpValidator(final Validator uriValidator) {
- invokedBy = uriValidator;
- return this;
- }
-
- public UriResourceValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public UriResourceValidator setUriInfoImplPath(final UriInfoImpl uriInfoPath) {
- uriInfo = uriInfoPath;
- last();
- return this;
- }
-
- // --- Execution ---
-
- public UriResourceValidator run(final String uri) {
- ParserTest testParser = new ParserTest();
- UriInfoImpl uriInfoTmp = null;
- uriPathInfo = null;
- try {
- uriInfoTmp = (UriInfoImpl) testParser.parseUri(uri, new UriParseTreeVisitor(edm));
- } catch (UriParserException e) {
- fail("Exception occured while parsing the URI: " + uri + "\n"
- + " Exception: " + e.getMessage());
- }
-
- if (uriInfoTmp.getKind() != UriInfoKind.resource) {
- fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
- }
- uriInfo = uriInfoTmp;
-
- first();
- return this;
- }
-
- // --- Navigation ---
-
- public UriValidator goUpUriValidator() {
- return (UriValidator) invokedBy;
- }
-
- public ExpandValidator goUpExpandValidator() {
- return (ExpandValidator) invokedBy;
- }
-
- public FilterValidator goUpFilterValidator() {
- return (FilterValidator) invokedBy;
- }
-
- public FilterValidator goLambdaExpression() {
- if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
- FilterValidator val = new FilterValidator();
- val.setEdm(edm);
- val.setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
- return (val);
- } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
- FilterValidator val = new FilterValidator();
- val.setEdm(edm);
- val.setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
- return (val);
- } else {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- return null;
- }
-
- public UriResourceValidator isLambdaVar(final String var) {
- String actualVar = null;
- if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
- actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLamdaVariable();
- } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
- actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
- } else {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- assertEquals(var, actualVar);
- return this;
- }
-
- public UriResourceValidator goSelectItemPath(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
-
- return new UriResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo1);
-
- }
-
- public ExpandValidator goExpand() {
- ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
- if (expand == null) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- return new ExpandValidator().setGoUpValidator(this).setExpand(expand);
- }
-
- public UriResourceValidator first() {
- uriResourceIndex = 0;
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
- return this;
- }
-
- public UriResourceValidator last() {
- uriResourceIndex = 0;
-
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
- uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
-
- return this;
- }
-
- public UriResourceValidator n() {
- uriResourceIndex++;
-
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
-
- return this;
- }
-
- public UriResourceValidator at(final int index) {
- uriResourceIndex = index;
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
- return this;
- }
-
- // --- Validation ---
-
- public UriResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
-
- if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
- uriPathInfo.getKind() != UriResourceKind.singleton &&
- uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- EdmType actualType = null;
- if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
- actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
- } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
- actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
- }
-
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(expectedType.toString(), actualName.toString());
- return this;
- }
-
- public UriResourceValidator isType(final FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourcePartTyped)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
-
- EdmType actualType = uriPathInfoTyped.getType();
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(type.toString(), actualName.toString());
-
- return this;
- }
-
- public UriResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
- isType(type);
- assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
- return this;
- }
-
- public UriResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
- // input parameter type may be null in order to assert that the singleTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
- if (type == null) {
- assertEquals(type, actualType);
- } else {
- assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
- }
-
- return this;
- }
-
- public UriResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
- // input parameter type may be null in order to assert that the collectionTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
- if (expectedType == null) {
- assertEquals(expectedType, actualType);
- } else {
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(expectedType.toString(), actualName.toString());
- }
-
- return this;
- }
-
- // other functions
- public UriResourceValidator checkCustomParameter(final int index, final String name, final String value) {
- if (uriInfo == null) {
- fail("hasQueryParameter: uriInfo == null");
- }
-
- List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
- if (list.size() <= index) {
- fail("not enough queryParameters");
- }
-
- CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
- assertEquals(name, option.getName());
- assertEquals(value, option.getText());
- return this;
- }
-
- // TODO remove
- public UriResourceValidator isCollection(final boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourcePartTyped)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
-
- EdmType type = uriPathInfoTyped.getType();
- if (type == null) {
- fail("isCollection: type == null");
- }
- assertEquals(isCollection, uriPathInfoTyped.isCollection());
- return this;
- }
-
- public UriResourceValidator isFilterString(final String expectedFilterTreeAsString) {
-
- ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
- try {
- String filterTreeAsString = filterTree.accept(new FilterTreeToText());
- assertEquals(expectedFilterTreeAsString, filterTreeAsString);
- } catch (ExceptionVisitExpression e) {
- fail("isFilterString: Exception " + e.getMessage() + " occured");
- } catch (ODataApplicationException e) {
- fail("isFilterString: Exception " + e.getMessage() + " occured");
- }
-
- return this;
- }
-
-
- public UriResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(refencedProperty, keyPredicates.get(index).getRefencedProperty());
- return this;
-
- }
- public UriResourceValidator isKeyPredicate(final int index, final String name, final String text) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(text, keyPredicates.get(index).getText());
- return this;
-
- }
-
- public UriResourceValidator isParameter(final int index, final String name, final String text) {
- if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getParameters();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(text, keyPredicates.get(index).getText());
- return this;
-
- }
-
- public UriResourceValidator isParameterAlias(final int index, final String name, final String alias) {
- if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getParameters();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(alias, keyPredicates.get(index).getAlias());
- return this;
-
- }
-
-
- public UriResourceValidator isKind(final UriInfoKind kind) {
- assertEquals(kind, uriInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isPrimitiveProperty(final String name,
- final FullQualifiedName type, boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, property.isCollection());
- return this;
- }
-
- public UriResourceValidator isComplexProperty(final String name, final FullQualifiedName type, boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, property.isCollection());
- return this;
- }
-
- public UriResourceValidator isNavProperty(final String name, final FullQualifiedName type, boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, uriPathInfoProp.isCollection());
- return this;
- }
-
- public UriResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
- assertNotNull(uriPathInfo);
- assertEquals(infoType, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isAction(final String name) {
- assertEquals(UriResourceKind.action, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
- return this;
- }
-
- public UriResourceValidator isFunction(final String name) {
- assertEquals(UriResourceKind.function, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
- return this;
- }
-
- public UriResourceValidator isFunctionImport(final String name) {
- assertEquals(UriResourceKind.function, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
- return this;
- }
-
- public UriResourceValidator isEntitySet(final String name) {
- assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
- return this;
- }
-
- public UriResourceValidator isComplex(final String name) {
- assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
- return this;
- }
-
- public UriResourceValidator isSingleton(final String name) {
- assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
- return this;
- }
-
- public UriResourceValidator isValue() {
- assertEquals(UriResourceKind.value, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isCount() {
- assertEquals(UriResourceKind.count, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isRef() {
- assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isActionImport(final String actionName) {
- assertEquals(UriResourceKind.action, uriPathInfo.getKind());
- assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
- return this;
- }
-
- public UriResourceValidator isIt() {
- assertEquals(UriResourceKind.it, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourceValidator isTopText(final String topText) {
- assertEquals(topText, uriInfo.getTopOption().getText());
- return this;
- }
-
- public UriResourceValidator isFormatText(final String formatText) {
- assertEquals(formatText, uriInfo.getFormatOption().getText());
- return this;
- }
-
- public UriResourceValidator isInlineCountText(final String inlineCountText) {
- assertEquals(inlineCountText, uriInfo.getInlineCountOption().getText());
- return this;
- }
-
- public UriResourceValidator isSkipText(final String skipText) {
- assertEquals(skipText, uriInfo.getSkipOption().getText());
- return this;
- }
-
- public UriResourceValidator isSkipTokenText(final String skipTokenText) {
- assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
- return this;
- }
-
- public UriResourceValidator isSelectItemStar(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(true, item.isStar());
- return this;
- }
-
- public UriResourceValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
deleted file mode 100644
index 5e71770..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
+++ /dev/null
@@ -1,247 +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.testutil;
-
-import static org.junit.Assert.assertEquals;
-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.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
-import org.apache.olingo.odata4.producer.core.uri.Parser;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.apache.olingo.odata4.producer.core.uri.UriParserSemanticException;
-import org.apache.olingo.odata4.producer.core.uri.UriParserSyntaxException;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-
-public class UriValidator implements Validator {
- private Edm edm;
-
- private UriInfoImpl uriInfo;
- private Exception exception;
-
- // Setup
- public UriValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- // Execution
- public UriValidator run(final String uri) {
- Parser parser = new Parser();
- uriInfo = null;
- try {
- // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
- uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
- } catch (UriParserException e) {
- fail("Exception occured while parsing the URI: " + uri + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
- public UriValidator runEx(final String uri) {
- Parser parser = new Parser();
- uriInfo = null;
- try {
- // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
- uriInfo = (UriInfoImpl) parser.parseUri(uri, new UriParseTreeVisitor(edm));
-
- } catch (UriParserException e) {
- exception = e;
- }
-
- return this;
- }
-
- public UriValidator log(final String uri) {
- ParserTest parserTest = new ParserTest();
- uriInfo = null;
- try {
- // uriInfoTmp = new UriParserImpl(edm).ParseUri(uri);
- uriInfo = (UriInfoImpl) parserTest.parseUri(uri, new UriParseTreeVisitor(edm));
- fail("Exception expected");
- } catch (UriParserException e) {
- fail("Exception occured while parsing the URI: " + uri + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
- // Navigation
- public UriResourceValidator goPath() {
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- return new UriResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
- }
-
- public FilterValidator goFilter() {
- FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
- if (filter == null) {
- fail("no filter found");
- }
- return new FilterValidator().setUriValidator(this).setFilter(filter);
-
- }
-
- public ExpandValidator goExpand() {
- ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
- if (expand == null) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- return new ExpandValidator().setGoUpValidator(this).setExpand(expand);
- }
-
-
- public UriResourceValidator goSelectItemPath(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
-
- return new UriResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo1);
-
- }
-
- // Validation
- public UriValidator isKind(final UriInfoKind kind) {
- assertEquals(kind, uriInfo.getKind());
- return this;
- }
-
- public UriValidator isCustomParameter(final int index, final String name, final String value) {
- if (uriInfo == null) {
- fail("hasQueryParameter: uriInfo == null");
- }
-
- List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
- if (list.size() <= index) {
- fail("not enought queryParameters");
- }
-
- CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
- assertEquals(name, option.getName());
- assertEquals(value, option.getText());
- return this;
- }
-
- public void isCrossJoinEntityList(final List<String> entitySets) {
- if (uriInfo.getKind() != UriInfoKind.crossjoin) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- int i = 0;
- for (String entitySet : entitySets) {
- assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
- i++;
- }
-
- }
-
- public UriValidator isExSyntax(long errorID) {
- assertEquals(UriParserSyntaxException.class, exception.getClass());
- return this;
- }
-
- public UriValidator isExSemantic(long errorID) {
- assertEquals(UriParserSemanticException.class, exception.getClass());
- return this;
- }
-
- public UriValidator isIdText(final String text) {
- assertEquals(text, uriInfo.getIdOption().getText());
- return this;
- }
-
- public UriValidator isExpandText(final String text) {
- assertEquals(text, uriInfo.getExpandOption().getText());
- return this;
- }
-
- public UriValidator isSelectText(final String text) {
- assertEquals(text, uriInfo.getSelectOption().getText());
- return this;
- }
-
- public UriValidator isFormatText(final String text) {
- assertEquals(text, uriInfo.getFormatOption().getText());
- return this;
- }
-
- public UriValidator isFragmentText(final String text) {
- if (uriInfo.getKind() != UriInfoKind.metadata) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- assertEquals(text, uriInfo.getFragment());
-
- return this;
- }
-
- public UriValidator isEntityType(final FullQualifiedName fullName) {
- if (uriInfo.getKind() != UriInfoKind.entityId) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
- return this;
- }
-
- private String fullName(final EdmEntityType type) {
- return type.getNamespace() + "." + type.getName();
- }
-
- public UriValidator isSelectItemStar(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(true, item.isStar());
- return this;
- }
-
- public UriValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/Validator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/Validator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/Validator.java
deleted file mode 100644
index 11706a6..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/Validator.java
+++ /dev/null
@@ -1,23 +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.testutil;
-
-public interface Validator {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
deleted file mode 100644
index e602c93..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
+++ /dev/null
@@ -1,201 +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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoAll;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoBatch;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoCrossjoin;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoEntityId;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoMetadata;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoService;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelsOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SearchOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipTokenOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.TopOptionImpl;
-import org.junit.Test;
-
-public class UriInfoImplTest {
-
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testKind() {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
- assertEquals(UriInfoKind.all, uriInfo.getKind());
- }
-
- @Test
- public void testCasts() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- UriInfoAll all = uriInfo.asUriInfoAll();
- assertEquals(uriInfo, all);
-
- UriInfoBatch batch = uriInfo.asUriInfoBatch();
- assertEquals(uriInfo, batch);
-
- UriInfoCrossjoin crossjoin = uriInfo.asUriInfoCrossjoin();
- assertEquals(uriInfo, crossjoin);
-
- UriInfoEntityId entityID = uriInfo.asUriInfoEntityId();
- assertEquals(uriInfo, entityID);
-
- UriInfoMetadata metadata = uriInfo.asUriInfoMetadata();
- assertEquals(uriInfo, metadata);
-
- UriInfoResource resource = uriInfo.asUriInfoResource();
- assertEquals(uriInfo, resource);
-
- UriInfoService service = uriInfo.asUriInfoService();
- assertEquals(uriInfo, service);
-
- }
-
- @Test
- public void testEntityNames() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- uriInfo.addEntitySetName("A");
- uriInfo.addEntitySetName("B");
-
- assertEquals("A", uriInfo.getEntitySetNames().get(0));
- assertEquals("B", uriInfo.getEntitySetNames().get(1));
-
- }
-
- @Test
- public void testResourceParts() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- UriResourceActionImpl action = new UriResourceActionImpl();
- UriResourceEntitySetImpl entitySet0 = new UriResourceEntitySetImpl();
- UriResourceEntitySetImpl entitySet1 = new UriResourceEntitySetImpl();
-
- uriInfo.addResourcePart(action);
- uriInfo.addResourcePart(entitySet0);
-
- assertEquals(action, uriInfo.getUriResourceParts().get(0));
- assertEquals(entitySet0, uriInfo.getUriResourceParts().get(1));
-
- assertEquals(entitySet0, uriInfo.getLastResourcePart());
-
- uriInfo.addResourcePart(entitySet1);
- assertEquals(entitySet1, uriInfo.getLastResourcePart());
- }
-
- @Test
- public void testCustomQueryOption() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- List<QueryOptionImpl> queryOptions = new ArrayList<QueryOptionImpl>();
-
- ExpandOptionImpl expand = new ExpandOptionImpl();
- FilterOptionImpl filter = new FilterOptionImpl();
- FormatOptionImpl format = new FormatOptionImpl();
- IdOptionImpl id = new IdOptionImpl();
- InlineCountOptionImpl inlinecount = new InlineCountOptionImpl();
- OrderByOptionImpl orderby = new OrderByOptionImpl();
- SearchOptionImpl search = new SearchOptionImpl();
- SelectOptionImpl select = new SelectOptionImpl();
- SkipOptionImpl skip = new SkipOptionImpl();
- SkipTokenOptionImpl skipToken = new SkipTokenOptionImpl();
- TopOptionImpl top = new TopOptionImpl();
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- CustomQueryOptionImpl customOption0 = new CustomQueryOptionImpl();
- customOption0.setText("A");
- CustomQueryOptionImpl customOption1 = new CustomQueryOptionImpl();
- customOption1.setText("B");
-
- QueryOptionImpl queryOption = new QueryOptionImpl();
-
- queryOptions.add(expand);
- queryOptions.add(filter);
- queryOptions.add(format);
- queryOptions.add(id);
- queryOptions.add(inlinecount);
- queryOptions.add(orderby);
- queryOptions.add(search);
- queryOptions.add(select);
- queryOptions.add(skip);
- queryOptions.add(skipToken);
- queryOptions.add(top);
- queryOptions.add(customOption0);
- queryOptions.add(customOption1);
- queryOptions.add(levels);//not stored
- queryOptions.add(queryOption);//not stored
- uriInfo.setQueryOptions(queryOptions);
-
- assertEquals(expand, uriInfo.getExpandOption());
- assertEquals(filter, uriInfo.getFilterOption());
- assertEquals(format, uriInfo.getFormatOption());
- assertEquals(id, uriInfo.getIdOption());
- assertEquals(inlinecount, uriInfo.getInlineCountOption());
- assertEquals(orderby, uriInfo.getOrderByOption());
- assertEquals(search, uriInfo.getSearchOption());
- assertEquals(select, uriInfo.getSelectOption());
- assertEquals(skip, uriInfo.getSkipOption());
- assertEquals(skipToken, uriInfo.getSkipTokenOption());
- assertEquals(top, uriInfo.getTopOption());
-
- List<CustomQueryOption> customQueryOptions = uriInfo.getCustomQueryOptions();
- assertEquals(customOption0, customQueryOptions.get(0));
- assertEquals(customOption1, customQueryOptions.get(1));
- }
-
- @Test
- public void testFragment() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- uriInfo.setFragment("F");
- assertEquals("F",uriInfo.getFragment());
- }
-
- @Test
- public void testEntityTypeCast() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- assertNotNull(entityType);
-
- uriInfo.setEntityTypeCast(entityType);
- assertEquals(entityType,uriInfo.getEntityTypeCast());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImplTest.java
deleted file mode 100644
index 7b1d0fc..0000000
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriParameterImplTest.java
+++ /dev/null
@@ -1,508 +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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-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.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.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmEntitySetImpl;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.odata4.commons.core.edm.provider.EdmSingletonImpl;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
-import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
-import org.junit.Test;
-
-public class UriParameterImplTest {
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testUriParameterImpl() {
- UriParameterImpl impl = new UriParameterImpl();
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
-
- impl.setText("Text");
- impl.setName("A");
- impl.setAlias("@A");
- impl.setExpression(expression);
-
- assertEquals("Text", impl.getText());
- assertEquals("A", impl.getName());
- assertEquals("@A", impl.getAlias());
- assertEquals(expression, impl.getExression());
- }
-
- @Test
- public void testUriResourceActionImpl() {
- UriResourceActionImpl impl = new UriResourceActionImpl();
- assertEquals(UriResourceKind.action, impl.getKind());
- assertEquals("", impl.toString());
-
- // action
- EdmAction action = edm.getAction(EdmTechTestProvider.nameUARTETParam, null, null);
- impl.setAction(action);
- assertEquals(action, impl.getAction());
- assertEquals(EdmTechTestProvider.nameUARTETParam.getName(), impl.toString());
-
- // action import
- impl = new UriResourceActionImpl();
- EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTPrimParam");
- impl.setActionImport(actionImport);
- assertEquals(actionImport, impl.getActionImport());
- assertEquals(actionImport.getAction(), impl.getAction());
- assertEquals(false, impl.isCollection());
- assertEquals("AIRTPrimParam", impl.toString());
- assertEquals(actionImport.getAction().getReturnType().getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceLambdaAllImpl() {
- UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
- assertEquals(UriResourceKind.lambdaAll, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
- assertEquals("all", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaAnyImpl() {
- UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
- assertEquals(UriResourceKind.lambdaAny, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance(), impl.getType());
- assertEquals("any", impl.toString());
- }
-
- @Test
- public void testUriResourceComplexPropertyImpl() {
- UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
- assertEquals(UriResourceKind.complexProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- assertEquals(property.getType(), impl.getComplexType());
- EdmComplexType complexType = impl.getComplexType(); // must work without cast
-
- EdmComplexTypeImpl complexTypeImplType =
- (EdmComplexTypeImpl) edm.getComplexType(EdmTechProvider.nameCTBasePrimCompNav);
-
- impl.setTypeFilter(complexTypeImplType);
- assertEquals(complexTypeImplType, impl.getTypeFilter());
- assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
- complexType = impl.getComplexTypeFilter(); // must work without cast
-
- }
-
- @Test
- public void testUriResourcePrimitivePropertyImpl() {
- UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
- assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceCountImpl() {
- UriResourceCountImpl impl = new UriResourceCountImpl();
- assertEquals(UriResourceKind.count, impl.getKind());
- assertEquals("$count", impl.toString());
- }
-
- @Test
- public void testUriResourceEntitySetImpl() {
- UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
- assertEquals(UriResourceKind.entitySet, impl.getKind());
-
- EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
- impl.setEntitSet(entitySet);
-
- assertEquals("ESAllPrim", impl.toString());
- assertEquals(entitySet, impl.getEntitySet());
-
- assertEquals(entitySet.getEntityType(), impl.getType());
- assertEquals(entitySet.getEntityType(), impl.getEntityType());
- EdmEntityType entityType = impl.getEntityType(); // must work without cast
-
- // is Collection
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceFunctionImpl() {
- UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
- assertEquals(UriResourceKind.function, impl.getKind());
- assertEquals("", impl.toString());
-
- // function
- EdmFunction function = (EdmFunction) edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
- .getFunction(new ArrayList<String>());
- assertNotNull(function);
- impl.setFunction(function);
-
- assertEquals(function, impl.getFunction());
- assertEquals("UFNRTInt16", impl.toString());
- assertEquals(function.getReturnType().getType(), impl.getType());
-
- // function import
- impl = new UriResourceFunctionImpl();
- EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
- impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
- assertEquals(functionImport, impl.getFunctionImport());
- assertEquals("FINRTInt16", impl.toString());
-
- // function collection
- impl = new UriResourceFunctionImpl();
- functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
- assertNotNull(function);
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- impl.setFunctionImport(functionImport, Arrays.asList(parameter));
- assertEquals("FICRTESTwoKeyNavParam", impl.toString());
-
-
- impl.setFunction(functionImport.getFunction(Arrays.asList("ParameterInt16")));
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
-
- assertEquals(parameter, impl.getParameters().get(0));
- }
-
- @Test
- public void testUriResourceImplKeyPred() {
- class Mock extends UriResourceWithKeysImpl {
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public Mock setType(EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock", impl.toString(true));
-
- // set both
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav/()com.sap.odata.test1.ETTwoBaseTwoKeyNav",
- impl.toString(true));
-
- // set entry
- // TODO remove ???
- impl = new Mock();
- impl.setType(entityType);
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
-
- // set collection
- // TODO remove ???
- impl = new Mock();
- impl.setType(entityType);
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
-
- impl = new Mock();
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- impl.setKeyPredicates(keyPredicates);
- assertNotNull(null, impl.getKeyPredicates());
-
- }
-
- @Test
- public void testUriResourceImplTyped() {
- class Mock extends UriResourceTypedImpl {
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- public Mock setType(EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
-
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- EdmEntityType entityTypeBaseEntry = edm.getEntityType(EdmTechProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals("mock", impl.toString());
- assertEquals("mock", impl.toString(true));
- assertEquals("mock", impl.toString(false));
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilter());
- assertEquals("mock", impl.toString());
- assertEquals("mock/com.sap.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- assertEquals("mock", impl.toString(false));
- //
- }
-
- @Test
- public void testUriResourceItImpl() {
- UriResourceItImpl impl = new UriResourceItImpl();
- assertEquals(UriResourceKind.it, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- assertEquals("$it", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceNavigationPropertyImpl() {
- UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
- assertEquals(UriResourceKind.navigationProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
- assertNotNull(property);
-
- impl.setNavigationProperty(property);
- assertEquals(property, impl.getProperty());
-
- assertEquals("NavPropertyETKeyNavMany", impl.toString());
- assertEquals(property.getType(), impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceRefImpl() {
- UriResourceRefImpl impl = new UriResourceRefImpl();
- assertEquals(UriResourceKind.ref, impl.getKind());
- assertEquals("$ref", impl.toString());
- }
-
- @Test
- public void testUriResourceRootImpl() {
- UriResourceRootImpl impl = new UriResourceRootImpl();
- assertEquals(UriResourceKind.root, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- assertEquals("$root", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceSingletonImpl() {
- UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
- assertEquals(UriResourceKind.singleton, impl.getKind());
-
- EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
- impl.setSingleton(singleton);
-
- assertEquals("SINav", impl.toString());
- assertEquals(singleton, impl.getSingleton());
-
- assertEquals(singleton.getEntityType(), impl.getType());
- assertEquals(singleton.getEntityType(), impl.getEntityType());
- EdmEntityType entityType = impl.getEntityType(); // must work without cast
-
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
-
- // is Collection
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceValueImpl() {
- UriResourceValueImpl impl = new UriResourceValueImpl();
- assertEquals(UriResourceKind.value, impl.getKind());
- assertEquals("$value", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaVarImpl() {
- UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
- assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
-
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
- impl.setType(entityType);
- impl.setVariableText("A");
-
- assertEquals("A", impl.toString());
- assertEquals(entityType, impl.getType());
- assertEquals("A", impl.getVariableText());
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- }
-
- @Test
- public void testUriResourceStartingTypeFilterImpl () {
- UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
- assertEquals(UriResourceKind.startingTypeFilter, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETTwoKeyNav);
-
-
- impl.setType(entityType);
- assertEquals("com.sap.odata.test1.ETTwoKeyNav", impl.toString());
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
-
- }
-}