You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/09 14:28:53 UTC
[05/15] [OLINGO-266] refactor ref module to server-ref
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
new file mode 100644
index 0000000..702d559
--- /dev/null
+++ b/lib/server-ref/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -0,0 +1,5110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.uri.antlr;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
+import org.apache.olingo.commons.api.ODataApplicationException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.core.Encoder;
+import org.apache.olingo.server.api.uri.UriInfoKind;
+import org.apache.olingo.server.api.uri.UriResourceKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
+import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.server.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.server.core.testutil.techprovider.ComplexTypeProvider;
+import org.apache.olingo.server.core.testutil.techprovider.EntityTypeProvider;
+import org.apache.olingo.server.core.testutil.techprovider.EnumTypeProvider;
+import org.apache.olingo.server.core.testutil.techprovider.PropertyProvider;
+import org.apache.olingo.server.core.uri.parser.UriParserException;
+import org.apache.olingo.server.core.uri.testutil.FilterValidator;
+import org.apache.olingo.server.core.uri.testutil.ResourceValidator;
+import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.junit.Test;
+
+public class TestFullResourcePath {
+ Edm edm = null;
+ TestUriValidator testUri = null;
+ ResourceValidator testRes = null;
+ FilterValidator testFilter = null;
+
+ public TestFullResourcePath() {
+ edm = new EdmProviderImpl(new EdmTechTestProvider());
+ testUri = new TestUriValidator().setEdm(edm);
+ testRes = new ResourceValidator().setEdm(edm);
+ testFilter = new FilterValidator().setEdm(edm);
+ }
+
+ @Test
+ public void test() throws UriParserException {
+
+ }
+
+ @Test
+ public void testFunctionBound_varOverloading() {
+ // on ESTwoKeyNav
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+ // with string parameter
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+ // with string parameter
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(ComplexTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(ComplexTypeProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
+ .isType(EntityTypeProvider.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(ComplexTypeProvider.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(ComplexTypeProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .isType(EntityTypeProvider.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(ComplexTypeProvider.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(ComplexTypeProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+ .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCprop() {
+ testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isFunction("BFCESAllPrimRTCTAllPrim")
+ .isType(ComplexTypeProvider.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(ComplexTypeProvider.nameCTTwoPrim, false)
+ .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCpropColl() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(ComplexTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(ComplexTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(ComplexTypeProvider.nameCTPrimComp)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(ComplexTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(ComplexTypeProvider.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(ComplexTypeProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.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(ComplexTypeProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.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(ComplexTypeProvider.nameCTTwoPrim)
+ .isTypeFilter(ComplexTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim)
+ .isTypeFilter(ComplexTypeProvider.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", PropertyProvider.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", PropertyProvider.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(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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(ComplexTypeProvider.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(PropertyProvider.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(PropertyProvider.nameString, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(PropertyProvider.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", PropertyProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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", PropertyProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.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", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runBfuncBnSingleRtEs() {
+
+ testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilter(EntityTypeProvider.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(EntityTypeProvider.nameETAllPrim, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(PropertyProvider.nameString);
+
+ // on collection of primitive
+ testUri.run("ESCollAllPrim(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETCollAllPrim, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(PropertyProvider.nameString);
+
+ // on complex
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .at(2)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+ // on collection of complex
+ testUri.run("ESKeyNav(1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .at(1)
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .at(2)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETAllPrim);
+
+ // on entity
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
+ + "/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
+
+ // on collection of entity
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1).isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.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(EntityTypeProvider.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(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETKeyNav)
+ .isIdText("ESKeyNav(1)");
+ }
+
+ @Test
+ public void runEntityIdError() {
+ // TODO planned: move to validator
+ // 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(EntityTypeProvider.nameETAllPrim, true);
+
+ testUri.run("ESAllPrim/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EntityTypeProvider.nameETAllPrim, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runEsNameError() {
+
+ testUri.runEx("ESAllPrim/$count/$ref").isExSemantic(0);
+ testUri.runEx("ESAllPrim/$ref/$count").isExSemantic(0);
+ testUri.runEx("ESAllPrim/$ref/invalid").isExSemantic(0);
+ testUri.runEx("ESAllPrim/$count/invalid").isExSemantic(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(EntityTypeProvider.nameETTwoPrim, true)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768");
+
+ testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.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() throws UnsupportedEncodingException {
+ testUri.run(encode("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("ESTwoPrim(1)/com.sap.odata.test1.ETBase(1)")
+ * .isExSemantic(0);
+ *
+ * testUri.runEx("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)")
+ * .isExSemantic(0);
+ *
+ * testUri.runEx("ESBase/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(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
+
+ testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(ComplexTypeProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(ComplexTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim)
+ .isTypeFilter(ComplexTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim)
+ .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
+ }
+
+ @Test
+ public void runNsNamePpNp() {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'(3)'")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+ .n()
+ .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETKeyNavMany(3)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "3")
+ .isKeyPredicate(1, "PropertyString", "'4'")
+ .isTypeFilterOnCollection(EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "4")
+ .isKeyPredicate(1, "PropertyString", "'5'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EntityTypeProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "4")
+ .isKeyPredicate(1, "PropertyString", "'5'")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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", EntityTypeProvider.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", EntityTypeProvider.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", PropertyProvider.nameByte, false);
+
+ testUri.run("ESAllPrim(1)/PropertyByte/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyByte", PropertyProvider.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", PropertyProvider.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", PropertyProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.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", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.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", EntityTypeProvider.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", EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.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(EntityTypeProvider.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(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .isTypeFilterOnEntry(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.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(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim)
+ .isTypeFilter(ComplexTypeProvider.nameCTBase);
+
+ }
+
+ @Test
+ public void runSingletonPpSpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+ .isType(PropertyProvider.nameString, true);
+
+ }
+
+ @Test
+ public void runSingletonEntityPpNp() {
+ testUri.run("SINav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
+
+ testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.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(ComplexTypeProvider.nameCTPrimComp, true);
+
+ testUri.run("SINav/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runSingletonEntityPpSp() {
+ testUri.run("SINav/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+ }
+
+ @Test
+ public void runSingletonEntityPpSpColl() {
+ testUri.run("SINav/CollPropertyString")
+
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
+ testUri.run("SINav/CollPropertyString/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.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", EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.nameETKeyNav, true)
+ .n().isRef();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.nameETKeyNav, true)
+ .n().isRef()
+ .goUpExpandValidator()
+ .isSortOrder(0, false)
+ .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany/$ref($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.nameETKeyNav, true)
+ .n().isCount();
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne/$count")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.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", EntityTypeProvider.nameETKeyNav, true)
+ .isType(EntityTypeProvider.nameETKeyNav, true)
+ .goUpExpandValidator()
+ .isSortOrder(0, false)
+ .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+
+ testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1)")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .
<TRUNCATED>