http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java deleted file mode 100644 index 0b5cb2a..0000000 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java +++ /dev/null @@ -1,5204 +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.server.core.uri.antlr; - -import java.io.UnsupportedEncodingException; -import java.util.Arrays; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.http.HttpContentType; -import org.apache.olingo.commons.core.Encoder; -import org.apache.olingo.server.api.ODataApplicationException; -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.uri.parser.UriParserException; -import org.apache.olingo.server.core.uri.parser.UriParserSemanticException; -import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException; -import org.apache.olingo.server.core.uri.testutil.EdmTechTestProvider; -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.apache.olingo.server.tecsvc.provider.ComplexTypeProvider; -import org.apache.olingo.server.tecsvc.provider.ContainerProvider; -import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider; -import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider; -import org.apache.olingo.server.tecsvc.provider.PropertyProvider; -import org.junit.Ignore; -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 testFunctionBound_varOverloading() throws Exception { - // on ESTwoKeyNav - testUri.run("ESTwoKeyNav/olingo.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/olingo.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/olingo.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() throws Exception { - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyComp/olingo.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("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, false) - .n() - .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav"); - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyComp/olingo.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("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, false) - .n() - .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav") - .isType(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isUriPathInfoKind(UriResourceKind.count); - - } - - @Test - public void runBfuncBnCpropCollRtEs() throws Exception { - testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isUriPathInfoKind(UriResourceKind.complexProperty) - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true) - .n() - .isFunction("BFCCollCTPrimCompRTESAllPrim"); - - testUri - .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isUriPathInfoKind(UriResourceKind.complexProperty) - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true) - .n() - .isFunction("BFCCollCTPrimCompRTESAllPrim") - .isType(EntityTypeProvider.nameETAllPrim, true) - .n() - .isUriPathInfoKind(UriResourceKind.count); - } - - @Test - public void runBfuncBnCpropRtEs() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')" - + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isUriPathInfoKind(UriResourceKind.complexProperty) - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, false) - .n() - .isFunction("BFCCTPrimCompRTESTwoKeyNav"); - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')" - + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isUriPathInfoKind(UriResourceKind.complexProperty) - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, false) - .n() - .isFunction("BFCCTPrimCompRTESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .n() - .isUriPathInfoKind(UriResourceKind.count); - - } - - @Test - public void runBfuncBnEntityRtEs() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.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() throws Exception { - testUri - .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/olingo.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/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')" - + "/olingo.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() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav" - + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav, true) - .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey"); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav" - + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()" - + "/olingo.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" - + "/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')" - + "/olingo.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() throws Exception { - testUri.run("ESAllPrim/olingo.odata.test1.BFCESAllPrimRTCTAllPrim()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESAllPrim") - .n() - .isFunction("BFCESAllPrimRTCTAllPrim") - .isType(ComplexTypeProvider.nameCTAllPrim); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTCTTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim, false) - .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase); - } - - @Test - public void runBfuncBnEsRtCpropColl() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim, true); - - testUri.run("ESTwoKeyNav/olingo.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() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTTwoKeyNav") - .n() - .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false); - - testUri.run("ESTwoKeyNav/olingo.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/olingo.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/olingo.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/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" - + "/NavPropertyETTwoKeyNavOne/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNavParam") - .isParameter(0, "ParameterString", "'1'") - .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" - + "/NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNavParam") - .isParameter(0, "ParameterString", "'1'") - .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp) - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTAllPrim); - - testUri.run("ESKeyNav/olingo.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/olingo.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); - - testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(WrongParameter='1')") - .isExSemantic(UriParserSemanticException.MessageKeys.UNKNOWN_PART); - testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)") - .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE); - } - - @Test - public void runBfuncBnEsRtEntyPpNpCast() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()" - + "/NavPropertyETTwoKeyNavOne/olingo.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/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')" - + "/NavPropertyETTwoKeyNavOne/olingo.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() throws Exception { - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTNavFiveProp); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp/PropertyInt16") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTNavFiveProp) - .n() - .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp/PropertyInt16/$value") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyComp") - .isType(ComplexTypeProvider.nameCTNavFiveProp) - .n() - .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) - .n() - .isValue(); - - } - - @Test - public void runBfuncBnEsRtEntyPpCpCast() throws Exception { - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" - + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNavParam") - .isParameter(0, "ParameterString", "'1'") - .n() - .isComplex("PropertyCompTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim) - .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')" - + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')" - + "/PropertyCompTwoPrim/olingo.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("PropertyCompTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim) - .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); - } - - @Test - public void runBfuncBnEsRtEntityPpSp() throws Exception { - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); - - testUri.run("ESKeyNav/olingo.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() throws Exception { - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESTwoKeyNav/olingo.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/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESKeyNav/olingo.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/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .n() - .isCount(); - - testUri.run("ESTwoKeyNav/olingo.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() throws Exception { - - testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp" - + "/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/olingo.odata.test1.BAESAllPrimRTETAllPrim") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp) - .n() - .isFunction("BFCCollCTPrimCompRTESAllPrim") - .n() - .isAction("BAESAllPrimRTETAllPrim"); - - } - - @Test - public void runBfuncBnEsRtPrim() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTString"); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()/$value") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTString") - .isType(PropertyProvider.nameString) - .n() - .isValue(); - } - - @Test - public void runbfuncBnEsRtPrimColl() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTCollString") - .isType(PropertyProvider.nameString, true); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFCESTwoKeyNavRTCollString") - .isType(PropertyProvider.nameString, true) - .n() - .isCount(); - } - - @Test - public void runBfuncBnPpropCollRtEs() throws Exception { - testUri.run("ESKeyNav(1)/CollPropertyString/olingo.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/olingo.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() throws Exception { - - testUri.run("ESKeyNav(1)/PropertyString/olingo.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/olingo.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/olingo.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() throws Exception { - - testUri.run("SINav/olingo.odata.test1.BFCSINavRTESTwoKeyNav()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .isType(EntityTypeProvider.nameETTwoKeyNav, false) - .n() - .isFunction("BFCSINavRTESTwoKeyNav"); - } - - @Test - public void runBfuncBnSingleCastRtEs() throws Exception { - testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.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() throws Exception { - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.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)/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isAction("BAETTwoKeyNavRTETTwoKeyNav"); - } - - @Test - public void runActionBound_on_EntityCollection() throws Exception { - testUri.run("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isAction("BAESTwoKeyNavRTESTwoKeyNav"); - } - - @Test - public void runFunctionBound_on_var_Types() throws Exception { - - // on primitive - testUri.run("ESAllPrim(1)/PropertyString/olingo.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/olingo.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')" - + "/PropertyComp/olingo.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)/CollPropertyComp/olingo.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')" - + "/olingo.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/olingo.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() throws Exception { - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/olingo.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/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')" - + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/olingo.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() throws Exception { - 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() throws Exception { - testUri.runEx("$crossjoin").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("$crossjoin/error").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - testUri.runEx("$crossjoin()").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid") - .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - } - - @Test - public void runEntityId() throws Exception { - testUri.run("$entity", "$id=ESKeyNav(1)") - .isKind(UriInfoKind.entityId) - .isIdText("ESKeyNav(1)"); - testUri.run("$entity/olingo.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(UriParserSyntaxException.MessageKeys.SYNTAX); - // testUri.runEx("$entity?$idfalse=ESKeyNav(1)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - // testUri.runEx("$entity/olingo.odata.test1.invalidType?$id=ESKeyNav(1)").isExSemantic(); - // testUri.runEx("$entity/invalid?$id=ESKeyNav(1)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - } - - @Test - public void runEsName() throws Exception { - 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(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PROPERTIES); - testUri.runEx("ESAllPrim/$ref/$count") - .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS); - testUri.runEx("ESAllPrim/$ref/invalid") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS); - testUri.runEx("ESAllPrim/$count/invalid") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS); - testUri.runEx("ESAllPrim/PropertyString") - .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_AFTER_COLLECTION); - testUri.runEx("ESAllPrim(1)/whatever") - .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE); - testUri.runEx("ESAllPrim(PropertyInt16)") - .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE); - testUri.runEx("ESAllPrim(PropertyInt16=)") - .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')") - .isExSemantic(UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES); - - testUri.runEx("ESBase/olingo.odata.test1.ETBase/PropertyInt16") - .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_AFTER_COLLECTION); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETAllKey") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim('1')/olingo.odata.test1.ETAllKey") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETAllKey") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim()") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ESAllNullable(1)/CollPropertyString/$value") - .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS); - - testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value") - .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND); - } - - @Test - public void runEsNameCast() throws Exception { - testUri.run("ESTwoPrim/olingo.odata.test1.ETBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim, true) - .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); - - testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(-32768)/olingo.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/olingo.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() throws Exception { - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.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')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyComp/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("PropertyComp") - .n() - .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); - } - - @Test - public void runEsNameKey() throws Exception { - 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.runEx("ESTwoPrim(wrong)") - .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE); - testUri.runEx("ESTwoPrim(PropertyInt16=wrong)") - .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE); - } - - @Test - public void runEsNameParaKeys() throws Exception { - testUri.run(encode("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255," - + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648," - + "PropertyInt64=-9223372036854775808,PropertyDecimal=1,PropertyDate=2013-09-25," - + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00," - + "PropertyDuration=duration'P50903316DT2H25M4S'," - + "PropertyGuid=12345678-1234-1234-1234-123456789012," - + "PropertyTimeOfDay=12:34:55)")) - .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", "1") - .isKeyPredicate(8, "PropertyDate", "2013-09-25") - .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00") - .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'") - .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012") - .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55"); - } - - @Test - public void runEsNameKeyCast() throws Exception { - // testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)") - // .isExSemantic(UriParserSemanticException.MessageKeys.xxx); - - // testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)") - // .isExSemantic(UriParserSemanticException.MessageKeys.xxx); - - testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)") - .isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER); - - testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnEntry(EntityTypeProvider.nameETBase); - - testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETTwoBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase); - - testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); - - testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(1)") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase); - - testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isKeyPredicate(0, "PropertyInt16", "1") - .isTypeFilterOnCollection(EntityTypeProvider.nameETBase); - - testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoPrim") - .isType(EntityTypeProvider.nameETTwoPrim) - .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase); - } - - @Test - public void runEsNameParaKeysCast() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.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/olingo.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() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isComplex("PropertyComp"); - - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isComplex("PropertyComp") - .n() - .isComplex("PropertyComp"); - } - - @Test - public void runEsNamePpCpColl() throws Exception { - testUri.run("ESMixPrimCollComp(5)/CollPropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixPrimCollComp") - .isKeyPredicate(0, "PropertyInt16", "5") - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTTwoPrim, true); - - testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true); - - testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false) - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true) - .n() - .isCount(); - } - - @Test - public void runEsNamePpCpCast() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isComplex("PropertyComp"); - - testUri - .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyComp/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav) - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isComplex("PropertyComp") - .n() - .isComplex("PropertyComp"); - - testUri - .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyCompTwoPrim/olingo.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("PropertyCompTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim) - .isTypeFilter(ComplexTypeProvider.nameCTBase); - - testUri - .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/PropertyCompTwoPrim/olingo.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("PropertyCompTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim) - .isTypeFilter(ComplexTypeProvider.nameCTTwoBase); - } - - @Test - public void runNsNamePpNp() throws Exception { - 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)/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) - .isKeyPredicate(0, "PropertyInt16", "2") - .n() - .isComplex("PropertyComp"); - - 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)/PropertyComp/NavPropertyETTwoKeyNavOne") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isComplex("PropertyComp") - .n() - .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false); - - testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')" - + "/PropertyComp/PropertyComp/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("PropertyComp") - .n() - .isComplex("PropertyComp") - .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() throws Exception { - testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.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')/olingo.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')/olingo.odata.test1.ETBaseTwoKeyNav" - + "/NavPropertyETTwoKeyNavMany/olingo.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/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')" - + "/olingo.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/olingo.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() throws Exception { - // 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() throws Exception { - 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)/PropertyComp/PropertyString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixPrimCollComp") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isComplex("PropertyComp") - .n() - .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); - } - - @Test - public void runEsNamePpSpColl() throws Exception { - 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() throws Exception { - 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() throws Exception { - - testUri.run("FICRTString()/olingo.odata.test1.BFCStringRTESTwoKeyNav()"); - } - - @Test - public void runFunctionImpCastBf() throws Exception { - - testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav" - + "/olingo.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)" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')" - + "/olingo.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() throws Exception { - - 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)/olingo.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')" - + "/olingo.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)" - + "/olingo.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() throws Exception { - /**/ - 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(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND); - testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)") - .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND); - } - - @Test - public void runFunctionImpEsAlias() throws Exception { - - 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() throws Exception { - - testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/olingo.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)/olingo.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)" - + "/olingo.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)" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')" - + "/olingo.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() throws Exception { - testUri.run("SIMedia/$value") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SIMedia") - .n().isValue(); - } - - @Test - public void runSingletonPpNpCast() throws Exception { - testUri.run("SINav/olingo.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/olingo.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() throws Exception { - testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isComplex("PropertyComp"); - - testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isComplex("PropertyComp") - .n() - .isComplex("PropertyComp"); - - testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyCompTwoPrim/olingo.odata.test1.CTBase") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav) - .n() - .isComplex("PropertyCompTwoPrim") - .isType(ComplexTypeProvider.nameCTTwoPrim) - .isTypeFilter(ComplexTypeProvider.nameCTBase); - - } - - @Test - public void runSingletonPpSpCast() throws Exception { - testUri.run("SINav/olingo.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/olingo.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() throws Exception { - 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() throws Exception { - testUri.run("SINav/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .n() - .isComplex("PropertyComp"); - - testUri.run("SINav/PropertyComp/PropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .n() - .isComplex("PropertyComp") - .n() - .isComplex("PropertyComp"); - - } - - @Test - public void runSingletonEntityPpCpColl() throws Exception { - testUri.run("SINav/CollPropertyComp") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true); - - testUri.run("SINav/CollPropertyComp/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .n() - .isComplex("CollPropertyComp") - .isType(ComplexTypeProvider.nameCTPrimComp, true) - .n() - .isCount(); - } - - @Test - public void runSingletonEntityPpSp() throws Exception { - testUri.run("SINav/PropertyString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isSingleton("SINav") - .n() - .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false); - } - - @Test - public void runSingletonEntityPpSpColl() throws Exception { - 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() throws Exception { - - testUri.run("ESKeyNav(1)", "$expand=*") - .isKind(UriInfoKind.resource).goPath().goExpand() - .first() - .isSegmentStar(); - - testUri.run("ESKeyNav(1)", "$expand=*/$ref") - .isKind(UriInfoKind.resource).goPath().goExpand() - .first() - .isSegmentStar() - .isSegmentRef(); - - testUri.run("ESKeyNav(1)", "$expand=*/$ref,NavPropertyETKeyNavMany") - .isKind(UriInfoKind.resource).goPath().goExpand() - .first() - .isSegmentStar().isSegmentRef() - .next() - .goPath().first() - .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true); - - testUri.run("ESKeyNav(1)", "$expand=*($levels=3)") - .isKind(UriInfoKind.resource).goPath().goExpand() - .first() - .isSegmentStar() - .isLevelText("3"); - - testUri.run("ESKeyNav(1)", "$expand=*($levels=max)") - .isKind(UriInfoKind.resource).goPath().goExpand() - .first() - .isSegmentStar() - .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.ru
<TRUNCATED>
