http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72fcaa1a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java deleted file mode 100644 index 53e9c88..0000000 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java +++ /dev/null @@ -1,6003 +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.parser; - -import java.util.Arrays; -import java.util.Collections; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edmx.EdmxReference; -import org.apache.olingo.commons.api.format.ContentType; -import org.apache.olingo.server.api.OData; -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.MethodKind; -import org.apache.olingo.server.core.uri.parser.UriParserSemanticException.MessageKeys; -import org.apache.olingo.server.core.uri.parser.search.SearchParserException; -import org.apache.olingo.server.core.uri.testutil.FilterValidator; -import org.apache.olingo.server.core.uri.testutil.TestUriValidator; -import org.apache.olingo.server.core.uri.validator.UriValidationException; -import org.apache.olingo.server.tecsvc.provider.ActionProvider; -import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider; -import org.apache.olingo.server.tecsvc.provider.ContainerProvider; -import org.apache.olingo.server.tecsvc.provider.EdmTechProvider; -import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider; -import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider; -import org.apache.olingo.server.tecsvc.provider.FunctionProvider; -import org.apache.olingo.server.tecsvc.provider.PropertyProvider; -import org.apache.olingo.server.tecsvc.provider.TypeDefinitionProvider; -import org.junit.Test; - -public class TestFullResourcePath { - - private static final OData oData = OData.newInstance(); - private static final Edm edm = oData.createServiceMetadata( - new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm(); - - private final TestUriValidator testUri = new TestUriValidator().setEdm(edm); - private final FilterValidator testFilter = new FilterValidator().setEdm(edm); - - @Test - public void allowedSystemQueryOptionsOnAll() throws Exception { - testUri.run("$all", "$count=true&$format=json&$search=abc&$skip=5&$top=5&$skiptoken=abc") - .isKind(UriInfoKind.all) - .isInlineCountText("true") - .isFormatText("json") - .isSearchSerialized("'abc'") - .isSkipText("5") - .isTopText("5") - .isSkipTokenText("abc"); - } - - @Test - public void allowedSystemQueryOptionsOnCrossjoin() throws Exception { - testUri.run("$crossjoin(ESAllPrim,ESTwoPrim)", "$count=true&$expand=ESAllPrim" - + "&$filter=ESAllPrim/PropertyInt16 eq 2&$format=json&$orderby=ESAllPrim/PropertyInt16" - + "&$search=abc&$skip=5&$top=5&$skiptoken=abc") - .isKind(UriInfoKind.crossjoin) - .isInlineCountText("true") - .goExpand().goPath().isEntitySet("ESAllPrim") - .goUpExpandValidator().goUpToUriValidator() - .goFilter().left().goPath().first().isEntitySet("ESAllPrim") - .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false) - .goUpFilterValidator().goUpToUriValidator() - .isFormatText("json") - .isSearchSerialized("'abc'") - .isSkipText("5") - .isTopText("5") - .isSkipTokenText("abc"); - } - - @Test - public void trimQueryOptionsValue() throws Exception { - // OLINGO-846 trim query option value - testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ") - .isKind(UriInfoKind.resource).goPath() - .first().isEntitySet("ESAllPrim"); - // OLINGO-846 trim query option value - testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ") - .isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16> eq <12>>"); - } - - @Test - public void valueOnNonMediaEntity() throws Exception { - testUri.runEx("ESAllPrim/$value").isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS); - testUri.runEx("ESAllPrim(1)/NavPropertyETTwoPrimMany/$value").isExSemantic( - UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS); - testUri.runEx("FICRTCollESMedia()/$value") - .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS); - - testUri.runEx("ESAllPrim(1)/$value").isExSemantic(UriParserSemanticException.MessageKeys.NOT_A_MEDIA_RESOURCE); - testUri.runEx("ESAllPrim(1)/NavPropertyETTwoPrimOne/$value").isExSemantic( - UriParserSemanticException.MessageKeys.NOT_A_MEDIA_RESOURCE); - testUri.runEx("FICRTETKeyNav()/$value").isExSemantic(UriParserSemanticException.MessageKeys.NOT_A_MEDIA_RESOURCE); - } - - @Test - public void enumAndTypeDefAsKey() throws Exception { - testUri - .run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',PropertyDefString='abc')") - .goPath() - .at(0) - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'abc'"); - - testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has Namespace1_Alias.ENString'String1'") - .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>"); - - testUri - .run("ESMixEnumDefCollComp(PropertyEnumString=Namespace1_Alias.ENString'String1',PropertyDefString='abc')") - .goPath() - .at(0) - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "Namespace1_Alias.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'abc'"); - } - - @Test - public void functionBound_varOverloading() throws Exception { - // on ESTwoKeyNav - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_()").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.BFC_RTESTwoKeyNav_(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.BFC_RTESTwoKeyNav_()").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.BFC_RTESTwoKeyNav_()" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')" - + "/olingo.odata.test1.ETTwoBaseTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .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.BFNESAllPrimRTCTAllPrim()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESAllPrim") - .n() - .isFunction("BFNESAllPrimRTCTAllPrim") - .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(MessageKeys.UNKNOWN_PART); - testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)") - .isExSemantic(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.BFC_RTESTwoKeyNav_()(PropertyInt16=1,PropertyString='2')" - + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .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()/PropertyCompNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyCompNav") - .isType(ComplexTypeProvider.nameCTNavFiveProp); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyCompNav") - .isType(ComplexTypeProvider.nameCTNavFiveProp) - .n() - .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false); - - testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16/$value") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFCESKeyNavRTETKeyNav") - .n() - .isComplex("PropertyCompNav") - .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.BFC_RTESTwoKeyNav_()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_(ParameterString='2')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .isParameter(0, "ParameterString", "'2'") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_(ParameterString='3')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .isParameter(0, "ParameterString", "'3'") - .isType(EntityTypeProvider.nameETTwoKeyNav); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_()/$count") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .n() - .isCount(); - - testUri.run("ESTwoKeyNav/olingo.odata.test1.BFC_RTESTwoKeyNav_()(PropertyInt16=1,PropertyString='2')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .n() - .isFunction("BFC_RTESTwoKeyNav_") - .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.BA_RTETTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESTwoKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'2'") - .n() - .isAction("BA_RTETTwoKeyNav"); - - testUri.run("ESKeyNav(PropertyInt16=1)/olingo.odata.test1.BA_RTETTwoKeyNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isAction("BA_RTETTwoKeyNav"); - } - - @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.BFC_RTESTwoKeyNav_()") - .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 crossjoin() 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 crossjoinFilter() throws Exception { - testUri.run("$crossjoin(ESTwoPrim,ESMixPrimCollComp)", - "$filter=ESTwoPrim/PropertyString eq ESMixPrimCollComp/PropertyComp/PropertyString") - .goFilter() - .isBinary(BinaryOperatorKind.EQ) - .is("<<ESTwoPrim/PropertyString> eq <ESMixPrimCollComp/PropertyComp/PropertyString>>"); - } - - @Test - public void crossjoinExpand() throws Exception { - testUri.run("$crossjoin(ESTwoPrim,ESAllPrim)", - "$expand=ESTwoPrim") - .goExpand() - .first().goPath().first().isEntitySet("ESTwoPrim"); - - testUri.run("$crossjoin(ESTwoPrim,ESAllPrim)", - "$expand=ESTwoPrim,ESAllPrim") - .goExpand() - .first().goPath().first().isEntitySet("ESTwoPrim") - .goUpExpandValidator().next().goPath().first().isEntitySet("ESAllPrim"); - - // TODO: Once crossjoin is implemented these tests should no longer result in errors -// testUri.run("$crossjoin(ESTwoPrim,ESAllPrim)", -// "$expand=ESAllPrim/NavPropertyETTwoPrimOne") -// .goExpand() -// .first().goPath().at(0).isEntitySet("ESAllPrim") -// .at(1).isNavProperty("NavPropertyETTwoPrimOne", new FullQualifiedName("Namespace1_Alias.ETTwoPrim"), false); - } - - @Test - public void crossjoinError() 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); - testUri.runEx("$crossjoin(ESKeyNav)/$ref") - .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 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 esNameError() { - - testUri.runEx("ESAllPrim/$count/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - testUri.runEx("ESAllPrim/$ref/$count").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - testUri.runEx("ESAllPrim/$ref/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - testUri.runEx("ESAllPrim/$count/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT); - testUri.runEx("ESAllPrim/PropertyString").isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION); - testUri.runEx("ESAllPrim(1)/whatever").isExSemantic(MessageKeys.PROPERTY_NOT_IN_TYPE); - testUri.runEx("ESAllPrim('1')").isExSemantic(MessageKeys.INVALID_KEY_VALUE); - testUri.runEx("ESAllPrim(PropertyInt16)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("ESAllPrim(PropertyInt16=)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')").isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES); - - testUri.runEx("ESBase/olingo.odata.test1.ETBase/PropertyInt16") - .isExSemantic(MessageKeys.PROPERTY_AFTER_COLLECTION); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim") - .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETAllKey") - .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim('1')/olingo.odata.test1.ETAllKey") - .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim") - .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim" - + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)") - .isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - - testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETAllKey").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - testUri.runEx("ETBaseTwoKeyTwoPrim()").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - testUri.runEx("ESAllNullable(1)/CollPropertyString/$value").isExSemantic(MessageKeys.ONLY_FOR_TYPED_PARTS); - - testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value").isExSemantic(MessageKeys.RESOURCE_NOT_FOUND); - } - - @Test - public void resourcePathWithApostrophe() throws Exception { - testUri.runEx("ESAllPrim'").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testUri.runEx("ESAllPrim'InvalidStuff").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - testFilter.runOnETKeyNavEx("PropertyInt16' eq 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE); - testFilter.runOnETKeyNavEx("PropertyInt16 eq' 0").isExSemantic(MessageKeys.TYPES_NOT_COMPATIBLE); - testFilter.runOnETKeyNavEx("PropertyInt16 eq 0'") - .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION); - testFilter.runOnETKeyNavEx("PropertyInt16 eq 'dsd''") - .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - } - - @Test - public void runFunctionsWithKeyPredicates() throws Exception { - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam") - .isFunction("UFCRTCollETMixPrimCollCompTwoParam") - .isParameter(0, "ParameterString", "'1'") - .isParameter(1, "ParameterInt16", "1"); - - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=0)") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam") - .isFunction("UFCRTCollETMixPrimCollCompTwoParam") - .isParameter(0, "ParameterString", "'1'") - .isParameter(1, "ParameterInt16", "1") - .isKeyPredicate(0, "PropertyInt16", "0"); - - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(0)") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam") - .isFunction("UFCRTCollETMixPrimCollCompTwoParam") - .isParameter(0, "ParameterString", "'1'") - .isParameter(1, "ParameterInt16", "1") - .isKeyPredicate(0, "PropertyInt16", "0"); - - testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16 eq 0)") - .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - - // PropertyInt32 does not exist - testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=0)") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); - - testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)" - + "(PropertyInt16=0,PropertyInt16=1)") - .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY); - - testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollCTTwoPrimTwoParam") - .isFunction("UFCRTCollCTTwoPrimTwoParam") - .isParameter(0, "ParameterString", "'1'") - .isParameter(1, "ParameterInt16", "1"); - - testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=1)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(1)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1,PropertyInt16=2)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollESTwoKeyNavParam") - .isFunction("UFCRTCollETTwoKeyNavParam") - .isParameter(0, "ParameterInt16", "1"); - - testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='1')") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollESTwoKeyNavParam") - .isFunction("UFCRTCollETTwoKeyNavParam") - .isParameter(0, "ParameterInt16", "1") - .isKeyPredicate(0, "PropertyInt16", "1") - .isKeyPredicate(1, "PropertyString", "'1'"); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16 eq 1)") - .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1)") - .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1,PropertyString='1')") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)()") - .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1)") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); - - testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,Unkown=1)") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); - - testUri.run("FICRTCollString()") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTCollString") - .isFunction("UFCRTCollString"); - - testUri.run("FICRTString()") - .isKind(UriInfoKind.resource) - .goPath().first() - .isFunctionImport("FICRTString") - .isFunction("UFCRTString"); - - testUri.runEx("FICRTCollString()(0)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.runEx("FICRTString()(0)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - } - - @Test - public void runNonComposableFunctions() throws Exception { - - - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$top=1"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", - "$filter=PropertyInt16 eq 1"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$count=true"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skiptoken=5"); - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$search=test"); - - testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()") - .isKind(UriInfoKind.resource) - .goPath().first() - .isEntitySet("ESAllPrim") - .at(1) - .isFunction("BFNESAllPrimRTCTAllPrim"); - - testUri.runEx("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()" - + "/PropertyString") - .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH); - - testUri.runEx("FINRTByteNineParam(ParameterEnum=Namespace1_Alias.ENString'String1'," - + "CollParameterETTwoPrim=@collComp,ParameterComp=@comp,ParameterDef='key1'," - + "ParameterETTwoPrim=@comp,CollParameterDef=@collDef,CollParameterByte=@collByte," - + "CollParameterComp=@collComp,CollParameterEnum=@collEnum)/$value?@comp={\"PropertyInt16\":1}" - + "&@collByte=[1]&@collEnum=[\"String1,String1\"]&@collDef=[\"Test\"]&@collComp=[{\"PropertyInt16\":11}]") - .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH); - } - - @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(MessageKeys.INVALID_KEY_VALUE); - testUri.runEx("ESTwoPrim(PropertyInt16='wrong')").isExSemantic(MessageKeys.INVALID_KEY_VALUE); - } - - @Test - public void runEsNameParaKeys() throws Exception { - testUri.run("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.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); - - // Keys cannot be specified twice. - testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)") - .isExSemantic(MessageKeys.KEY_NOT_ALLOWED); - - testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)").isExSemantic(MessageKeys.INCOMPATIBLE_TYPE_FILTER); - } - - @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"); - - testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1'," - + "PropertyDefString='key1')/PropertyEnumString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'key1'") - .n() - .isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false); - - testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1'," - + "PropertyDefString='key1')/PropertyDefString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'key1'") - .n() - .isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false); - } - - @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(); - - testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1'," - + "PropertyDefString='key1')/CollPropertyEnumString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'key1'") - .n() - .isPrimitiveProperty("CollPropertyEnumString", EnumTypeProvider.nameENString, true); - - testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1'," - + "PropertyDefString='key1')/CollPropertyDefString") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESMixEnumDefCollComp") - .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'") - .isKeyPredicate(1, "PropertyDefString", "'key1'") - .n() - .isPrimitiveProperty("CollPropertyDefString", TypeDefinitionProvider.nameTDString, true); - } - - @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)/PropertyCompNav") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false) - .isKeyPredicate(0, "PropertyInt16", "2") - .n() - .isComplex("PropertyCompNav"); - - 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)/PropertyCompNav/NavPropertyETTwoKeyNavOne") - .isKind(UriInfoKind.resource).goPath() - .first() - .isEntitySet("ESKeyNav") - .isKeyPredicate(0, "PropertyInt16", "1") - .n() - .isComplex("PropertyCompNav") - .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 constraints 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("FICRTCollESTwoKeyNavParam(ParameterInt16=1)" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')" - + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTCollESTwoKeyNavParam") - .isFunction("UFCRTCollETTwoKeyNavParam") - .isParameter(0, "ParameterInt16", "1") - .isType(EntityTypeProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav) - .isKeyPredicate(0, "PropertyInt16", "2") - .isKeyPredicate(1, "PropertyString", "'3'") - .n() - .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav"); - - testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString=null)") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTCollCTTwoPrimTwoParam") - .isFunction("UFCRTCollCTTwoPrimTwoParam") - .isParameter(0, "ParameterInt16", "1") - .isParameter(1, "ParameterString", null); - } - - @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)") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTETTwoKeyNavParam") - .isParameter(0, "ParameterInt16", "1"); - - testUri.run("FICRTESMedia(ParameterInt16=1)/$value") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTESMedia") - .isFunction("UFCRTETMedia") - .n() - .isValue(); - - testUri.run("FICRTETKeyNav()/$ref") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTETKeyNav") - .isFunction("UFCRTETKeyNav") - .n() - .isRef(); - testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/$ref") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTETTwoKeyNavParam") - .isFunction("UFCRTETTwoKeyNavParam") - .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)/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("FICRTCollESTwoKeyNavParam(ParameterInt16=1)" - + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTCollESTwoKeyNavParam") - .isFunction("UFCRTCollETTwoKeyNavParam") - .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("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam") - .isFunction("UFCRTCollETMixPrimCollCompTwoParam") - .isParameter(0, "ParameterInt16", "1") - .isParameter(1, "ParameterString", "'2'") - .isType(EntityTypeProvider.nameETMixPrimCollComp); - - testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')") - .isKind(UriInfoKind.resource).goPath() - .first() - .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam") - .isFunction("UFCRTCollETM
<TRUNCATED>