You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/01/24 13:38:26 UTC
[1/2] [OLINGO-63] Uri Parser: Extends test cases
Updated Branches:
refs/heads/master ae46250b0 -> c8d0b26ad
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
index f7bf3ac..d0234a5 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestByAbapResourcePath.java
@@ -18,183 +18,827 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri.antlr;
+// sync 20.1.2014
+import java.util.Arrays;
+
import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriResourcePathValidator;
+import org.apache.olingo.odata4.producer.core.testutil.UriResourceValidator;
import org.apache.olingo.odata4.producer.core.testutil.UriValidator;
import org.junit.Test;
public class TestByAbapResourcePath {
Edm edm = null;
- private final String PropertyBoolean = "PropertyBoolean=true";
- private final String PropertyByte = "PropertyByte=1";
- boolean test;
- private final String PropertyDate = "PropertyDate=2013-09-25";
- private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
- private final String PropertyDecimal = "PropertyDecimal=12";
- private final String PropertyDuration = "PropertyDuration=duration'P10DT5H34M21.123456789012S'";
- private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
- private final String PropertyInt16 = "PropertyInt16=1";
- private final String PropertyInt32 = "PropertyInt32=12";
- private final String PropertyInt64 = "PropertyInt64=64";
- private final String PropertySByte = "PropertySByte=1";
- private final String PropertyString = "PropertyString='ABC'";
- private final String PropertyTimeOfDay = "PropertyTimeOfDay=12:34:55.123456789012";
-
- private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
- + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
- + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
- FilterValidator testFilter = null;
- UriResourcePathValidator testPath = null;
UriValidator testUri = null;
+ UriResourceValidator testRes = null;
+ FilterValidator testFilter = null;
public TestByAbapResourcePath() {
edm = new EdmProviderImpl(new EdmTechTestProvider());
-
testUri = new UriValidator().setEdm(edm);
- testPath = new UriResourcePathValidator().setEdm(edm);
+ testRes = new UriResourceValidator().setEdm(edm);
testFilter = new FilterValidator().setEdm(edm);
}
@Test
- public void runActionImportTests() {
- testUri.run("AIRTPrimParam").isKind(UriInfoKind.resource).goPath().isUriPathInfoKind(UriResourceKind.action);
- testUri.run("AIRTPrimCollParam").isKind(UriInfoKind.resource).goPath().isUriPathInfoKind(UriResourceKind.action);
- testUri.run("AIRTCompParam").isKind(UriInfoKind.resource).goPath().isUriPathInfoKind(UriResourceKind.action);
- testUri.run("AIRTCompCollParam").isKind(UriInfoKind.resource).goPath().isUriPathInfoKind(UriResourceKind.action);
- testUri.run("AIRTETParam").isKind(UriInfoKind.resource).goPath().isUriPathInfoKind(UriResourceKind.action);
+ public void runAction_VarReturnType() {
+
+ testUri.run("AIRTPrimParam").isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isActionImport("AIRTPrimParam")
+ .isAction("UARTPrimParam")
+ .isType(EdmTechProvider.nameString, false);
+
+ testUri.run("AIRTPrimCollParam").isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isActionImport("AIRTPrimCollParam")
+ .isAction("UARTPrimCollParam")
+ .isType(EdmTechProvider.nameString, true);
+
+ testUri.run("AIRTCompParam").isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isActionImport("AIRTCompParam")
+ .isAction("UARTCompParam")
+ .isType(EdmTechProvider.nameCTTwoPrim, false);
+
+ testUri.run("AIRTCompCollParam").isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isActionImport("AIRTCompCollParam")
+ .isAction("UARTCompCollParam")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testUri.run("AIRTETParam").isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isActionImport("AIRTETParam")
+ .isAction("UARTETParam")
+ .isType(EdmTechProvider.nameETTwoKeyTwoPrim, false);
+
+ // TODO add error test
// testUri.run("AIRTPrimParam/invalidElement").isKind(UriInfoKind.resource).goPath().
- //isUriPathInfoKind(UriResourceKind.action);
+ // isUriPathInfoKind(UriResourceKind.action);
// testUri.run("InvalidAction");
}
+//DONE
+
@Test
- public void runGeht() {
- // based from 20.1.2014
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count");
- testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()");
- testUri
- .run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()");
+ public void runBfuncBnCpropCastRtEs() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
+ .isType(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ }
+
+ @Test
+ public void runBfuncBnCpropCollRtEs() {
+ testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim");
+
testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()");
+ .run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+ }
+
+ @Test
+ public void runBfuncBnCpropRtEs() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/PropertyComplex/com.sap.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, false)
+ .n()
+ .isFunction("BFCCTPrimCompRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+
+ }
+
+ @Test
+ public void runBfuncBnEntityRtEs() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnEntityCastRtEs() {
testUri
.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()");
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+
testUri
.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()");
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()");
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav");
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav");
- testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value");
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne");
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComplex");
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex");
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyString");
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString");
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
- + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav");
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnEsCastRtEs() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
+ .isType(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav"
+ + "/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCprop() {
+ testUri.run("ESAllPrim/com.sap.odata.test1.BFCESAllPrimRTCTAllPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isFunction("BFCESAllPrimRTCTAllPrim")
+ .isType(EdmTechProvider.nameCTAllPrim);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameCTBase);
+ }
+
+ @Test
+ public void runBfuncBnEsRtCpropColl() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntityPpNp() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavOne")
+ .isType(EdmTechProvider.nameETKeyNav, false)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.ref);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isNav("NavPropertyETMediaOne")
+ .isType(EdmTechProvider.nameETMedia, false)
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp)
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTAllPrim);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavOne/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .n()
+ .isSimple("PropertyString")
+ .isType(EdmTechProvider.nameString);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isSimple("PropertyString")
+ .isType(EdmTechProvider.nameString);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntyPpNpCast() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
+ + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
testUri
.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
- + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETTwoBaseTwoKeyNav");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16/$value");
+ + "/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase");
+ }
- testUri
- .run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()");
- testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')");
+ @Test
+ public void runBfuncBnEsRtEntityPpCp() {
- testUri
- .run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex"
- + "/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/com.sap.odata.test1.BAESAllPrimRTETAllPrim");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()/$value");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count");
- testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()");
- testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()/$count");
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()");
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$count");
- testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$ref");
- testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav");
- testUri.run("ESKeyNav(PropertyInt16=1)/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav");
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp);
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
- testUri
- .run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/com.sap.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
- testUri.run("$crossjoin(ESKeyNav)");
- testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)");
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp)
+ .n()
+ .isSimple("PropertyInt16")
+ .isType(EdmTechProvider.nameInt16);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComplex/PropertyInt16/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .isType(EdmTechProvider.nameCTNavFiveProp)
+ .n()
+ .isSimple("PropertyInt16")
+ .isType(EdmTechProvider.nameInt16, false)
+ .n()
+ .isValue();
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntyPpCpCast() {
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNavParam")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+ }
+
+ @Test
+ public void runBfuncBnEsRtEntityPpSp() {
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isSimple("PropertyInt16")
+ .isType(EdmTechProvider.nameInt16);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isSimple("PropertyInt16")
+ .isType(EdmTechProvider.nameInt16)
+ .n()
+ .isValue();
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtEs() {
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .n()
+ .isCount();
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav"); // check for properties
+ }
+
+ @Test
+ public void runBfuncBnEsRtEsBa() {
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComplex"
+ + "/com.sap.odata.test1.BFCCollCTPrimCompRTESAllPrim()/com.sap.odata.test1.BAESAllPrimRTETAllPrim")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .n()
+ .isAction("BAESAllPrimRTETAllPrim");
+
+ }
+
+ @Test
+ public void runBfuncBnEsRtPrim() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTString()/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString")
+ .isType(EdmTechProvider.nameString)
+ .n()
+ .isValue();
+ }
+
+ @Test
+ public void runbfuncBnEsRtPrimColl() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(EdmTechProvider.nameString, true);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runBfuncBnPpropCollRtEs() {
+ testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isSimple("CollPropertyString")
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/CollPropertyString/com.sap.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isSimple("CollPropertyString")
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runBfuncBnPpropRtEs() {
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isSimple("PropertyString")
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true);
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isSimple("PropertyString")
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
+
+ testUri.run("ESKeyNav(1)/PropertyString/com.sap.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isSimple("PropertyString")
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runBfuncBnSingleRtEs() {
+
+ testUri.run("SINav/com.sap.odata.test1.BFCSINavRTESTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isFunction("BFCSINavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBfuncBnSingleCastRtEs() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/com.sap.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
+ }
+
+ @Test
+ public void runBactionEntity() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/com.sap.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+ }
+
+ @Test
+ public void runBactionEntity_set() {
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isAction("BAESTwoKeyNavRTESTwoKeyNav");
+ }
+
+ @Test
+ public void runBactionEntityCast() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/com.sap.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
+ .n()
+ .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
+ }
+
+ @Test
+ public void runCrossjoin() {
+ testUri.run("$crossjoin(ESKeyNav)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
+
+ testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)")
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
+ }
+
+ @Test
+ public void runCrossjoinError() {
// testUri.run("$crossjoin");
// testUri.run("$crossjoin/error");
// testUri.run("$crossjoin()");
// testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid");
// testUri.run("$crossjoin(invalidEntitySet)");
- testUri.run("$entity?$id=ESKeyNav(1)");
- testUri.run("$entity/com.sap.odata.test1.ETKeyNav?$id=ESKeyNav(1)");
+ }
+
+ @Test
+ public void runEntityId() {
+ testUri.run("$entity?$id=ESKeyNav(1)")
+ .isKind(UriInfoKind.entityId)
+ .isID("ESKeyNav(1)");
+ testUri.run("$entity/com.sap.odata.test1.ETKeyNav?$id=ESKeyNav(1)")
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EdmTechProvider.nameETKeyNav)
+ .isID("ESKeyNav(1)");
+ }
+
+ @Test
+ public void runEntityIdError() {
+ // entity_id_error
+
// testUri.run("$entity");
// testUri.run("$entity?$idfalse=ESKeyNav(1)");
// testUri.run("$entity/com.sap.odata.test1.invalidType?$id=ESKeyNav(1)");
// testUri.run("$entity/invalid?$id=ESKeyNav(1)");
- testUri.run("ESAllPrim");
- testUri.run("ESAllPrim/$count");
+ }
+
+ @Test
+ public void runEsName() {
+ testUri.run("ESAllPrim")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true);
+
+ testUri.run("ESAllPrim/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EdmTechProvider.nameETAllPrim, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runEsNameError() {
// testUri.run("ESAllPrim/$count/$ref");
// testUri.run("ESAllPrim/$ref/$count");
@@ -206,166 +850,940 @@ public class TestByAbapResourcePath {
// testUri.run("ESAllPrim(PropertyInt16=)");
// testUri.run("ESAllPrim(PropertyInt16=1,Invalid='1')");
// testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
+ // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
// testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETAllKey");
// testUri.run("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim('1')/com.sap.odata.test1.ETAllKey");
// testUri.run("ETBaseTwoKeyTwoPrim(1)/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
+ // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim");
// testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETBaseTwoKeyTwoPrim"
- // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)");
+ // +"/com.sap.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)");
// testUri.run("ETBaseTwoKeyTwoPrim/com.sap.odata.test1.ETAllKey");
// testUri.run("ETBaseTwoKeyTwoPrim()");
// testUri.run("ESAllNullable(1)/CollPropertyString/$value");
// testUri.run("ETMixPrimCollComp(1)/ComplexProperty/$value");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)");
- testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/PropertyInt16");
- testUri.run("ESCollAllPrim(1)");
- testUri.run("ESCollAllPrim(PropertyInt16=1)");
- testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')");
- testUri.run("ESCollAllPrim(null)");
- testUri
- .run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
- + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
- + "PropertyInt64=-9223372036854775808,PropertyDecimal=0.1,PropertyDate=2013-09-25,"
- + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
- + "PropertyDuration=duration'P10DT5H34M21.123456789012S',"
- + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
- + "PropertyTimeOfDay=12:34:55.123456789012)");
- testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase");
- testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')");
- testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase(1)");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)");
- testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)");
-
- // testUri.run("ESBase/com.sap.odata.test1.ETTwoPrim(1)");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex/PropertyComplex");
- testUri.run("ESMixPrimCollComp(5)/CollPropertyComplex");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count");
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplex/PropertyComplex");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase");
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany");
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)");
- testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)");
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16");
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex");
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne");
- testUri
- .run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavMany(4)");
- testUri.run("ESKeyNav(1)/PropertyComplex/NavPropertyETTwoKeyNavOne");
- testUri
- .run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
- + "/PropertyComplex/PropertyComplex/PropertyInt16");
- testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value");
- testUri
- .run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value");
- testUri
- .run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/$ref");
+ }
+
+ @Test
+ public void runEsNameCast() {
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, true)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(-32768)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+ }
+
+ @Test
+ public void runEsNamePpSpCast() {
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isSimple("PropertyDate");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isSimple("PropertyInt16");
+ }
+
+ @Test
+ public void runEsNameKey() {
+ testUri.run("ESCollAllPrim(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+
+ testUri.run("ESCollAllPrim(PropertyInt16=1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+
+ testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESFourKeyAlias");
+
+ testUri.run("ESCollAllPrim(null)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
+ }
+
+ @Test
+ public void runEsNameParaKeys() {
+ testUri.run("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
+ + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
+ + "PropertyInt64=-9223372036854775808,PropertyDecimal=0.1,PropertyDate=2013-09-25,"
+ + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
+ + "PropertyDuration=duration'P10DT5H34M21.123456789012S',"
+ + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
+ + "PropertyTimeOfDay=12:34:55.123456789012)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllKey");
+ }
+
+ @Test
+ public void runEsNameKeyCast() {
+ // testUri.run("xESTwoPrim(1)/com.sap.odata.test1.ETBase(1)");
+ // testUri.run("xESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase(1)");
+ // testUri.run("xESBase/com.sap.odata.test1.ETTwoPrim(1)");
+
+ testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETBase(1)/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBase);
+
+ testUri.run("ESTwoPrim/com.sap.odata.test1.ETTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EdmTechProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBase);
+ }
+
+ @Test
+ public void runEsNameParaKeysCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("ESTwoKeyNav/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+ }
+
+ @Test
+ public void run_EsNamePpCp() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+ }
+
+ @Test
+ public void runEsNamePpCpColl() {
+ testUri.run("ESMixPrimCollComp(5)/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTTwoPrim, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runEsNamePpCpCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex");
+
testUri
.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany");
+ + "/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
testUri
.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany(3)");
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTBase);
+
testUri
.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')");
- testUri
- .run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany");
+ + "/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTTwoBase);
+ }
+
+ @Test
+ public void runNsNamePpNp() {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany")
+ .n()
+ .isSimple("PropertyInt16");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany")
+ .n()
+ .isComplex("PropertyComplex");
+ testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavMany(4)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false)
+ .n()
+ .isNav("NavPropertyETKeyNavMany")
+ .isType(EdmTechProvider.nameETKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/PropertyComplex/NavPropertyETTwoKeyNavOne")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavOne")
+ .isType(EdmTechProvider.nameETTwoKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
+ + "/PropertyComplex/PropertyComplex/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isSimple("PropertyInt16");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETMediaMany")
+ .isType(EdmTechProvider.nameETMedia, false)
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isNav("NavPropertyETKeyNavOne")
+ .n()
+ .isNav("NavPropertyETMediaOne")
+ .n()
+ .isValue();
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETKeyNavOne/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isNav("NavPropertyETKeyNavOne")
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runEsNamePpNpCast() {
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETKeyNavMany(3)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ + "/NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETBaseTwoKeyNavMany");
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
+ + "NavPropertyETTwoKeyNavMany/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
+ + "NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ }
+
+ @Test
+ public void runEsNamePpNpRc() {
// testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')");
// testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')");
- testUri.run("ESAllPrim(1)/PropertyByte");
- testUri.run("ESAllPrim(1)/PropertyByte/$value");
- testUri.run("ESMixPrimCollComp(1)/PropertyComplex/PropertyString");
- testUri.run("ESCollAllPrim(1)/CollPropertyString");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count");
- testUri.run("ESAllPrim/$ref");
- testUri.run("ESAllPrim(-32768)/$ref");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref");
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref");
+
+ }
+
+ @Test
+ public void runEsNamePpSp() {
+ testUri.run("ESAllPrim(1)/PropertyByte")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isSimple("PropertyByte");
+
+ testUri.run("ESAllPrim(1)/PropertyByte/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isSimple("PropertyByte")
+ .n()
+ .isValue();
+
+ testUri.run("ESMixPrimCollComp(1)/PropertyComplex/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isSimple("PropertyString");
+ }
+
+ @Test
+ public void runEsNamePpSpColl() {
+ testUri.run("ESCollAllPrim(1)/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim")
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+
+ }
+
+ @Test
+ public void runEsNameRef() {
+ testUri.run("ESAllPrim/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isRef();
+
+ testUri.run("ESAllPrim(-32768)/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isRef();
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isRef();
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany")
+ .n()
+ .isRef();
+ }
+
+ @Test
+ public void runFunctionImpBf() {
+
testUri.run("FICRTString()/com.sap.odata.test1.BFCStringRTESTwoKeyNav()");
- testUri
- .run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()");
- testUri
- .run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()");
- testUri.run("FICRTETKeyNav()");
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')");
- testUri.run("FICRTETMedia()/$value");
- testUri.run("FICRTETKeyNav()/$ref");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/$ref");
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri
- .run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri
- .run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')");
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')");
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count");
- testUri.run("FICRTCollCTTwoPrimParam()");
- testUri.run("FICRTCollCTTwoPrimParam(invalidParam=2)");
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16='1',ParameterString='2')");
+ }
+
+ @Test
+ public void runFunctionImpCastBf() {
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+ }
+
+ @Test
+ public void runFunctionImpEntity() {
+
+ testUri.run("FICRTETKeyNav()")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .isType(EdmTechProvider.nameETKeyNav);
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam");
+
+ testUri.run("FICRTETMedia()/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETMedia")
+ .isFunction("UFCRTETMedia")
+ .n()
+ .isValue();
+
+ testUri.run("FICRTETKeyNav()/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .n()
+ .isRef();
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/$ref")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .n()
+ .isRef();
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+ }
+
+ @Test
+ public void runFunctionImpEs() {
+ /**/
+ testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isType(EdmTechProvider.nameETMixPrimCollComp);
+
+ testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FINRTESMixPrimCollCompTwoParam")
+ .isFunction("UFNRTESMixPrimCollCompTwoParam")
+ .isType(EdmTechProvider.nameETMixPrimCollComp);
+
+ testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isType(EdmTechProvider.nameETMixPrimCollComp)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runFunctionImpError() {
+ /*
+ * testUri.run("FICRTCollCTTwoPrimParam()");
+ * testUri.run("FICRTCollCTTwoPrimParam(invalidParam=2)");
+ * testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16='1',ParameterString='2')");
+ */
+ }
+
+ @Test
+ public void runFunctionImpEsAlias() {
+
testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)?@parameterAlias=1");
testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count?@parameterAlias=1");
testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@invalidAlias)?@validAlias=1");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav/$count");
- testUri
- .run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')");
- testUri
- .run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav");
- testUri.run("SIMedia/$value");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex/PropertyComplex");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16");
- testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString");
- testUri.run("SINav/NavPropertyETKeyNavMany");
- testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')");
- testUri.run("SINav/PropertyComplex");
- testUri.run("SINav/PropertyComplex/PropertyComplex");
- testUri.run("SINav/CollPropertyComplex");
- testUri.run("SINav/CollPropertyComplex/$count");
- testUri.run("SINav/PropertyString");
- testUri.run("SINav/CollPropertyString");
- testUri.run("SINav/CollPropertyString/$count");
+ }
+
+ @Test
+ public void runFunctionImpEsCast() {
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/com.sap.odata.test1.ETBaseTwoKeyNav/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isCount();
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav);
+
+ testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
+ + "/com.sap.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
+ + "/com.sap.odata.test1.ETTwoBaseTwoKeyNav")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESTwoKeyNavParam")
+ .isFunction("UFCRTESTwoKeyNavParam")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav)
+ .isTypeFilterOnEntry(EdmTechProvider.nameETTwoBaseTwoKeyNav);
+
+ }
+
+ @Test
+ public void runSingletonEntityValue() {
+ testUri.run("SIMedia/$value")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SIMedia")
+ .n().isValue();
+ }
+
+ @Test
+ public void runSingletonPpNpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ }
+
+ @Test
+ public void runSingletonPpCpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexTwoPrim/com.sap.odata.test1.CTBase")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComplexTwoPrim")
+ .isType(EdmTechProvider.nameCTTwoPrim)
+ .isTypeFilter(EdmTechProvider.nameCTBase);
+
+ }
+
+ @Test
+ public void runSingletonPpSpCast() {
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isSimple("PropertyInt16");
+
+ testUri.run("SINav/com.sap.odata.test1.ETBaseTwoKeyNav/CollPropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EdmTechProvider.nameETTwoKeyNav)
+ .isTypeFilter(EdmTechProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true);
+
+ }
+
+ @Test
+ public void runSingletonEntityPpNp() {
+ testUri.run("SINav/NavPropertyETKeyNavMany")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNav("NavPropertyETKeyNavMany");
+
+ testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isNav("NavPropertyETTwoKeyNavMany");
+ }
+
+ @Test
+ public void runSingletonEntityPpCp() {
+ testUri.run("SINav/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("PropertyComplex");
+
+ testUri.run("SINav/PropertyComplex/PropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("PropertyComplex")
+ .n()
+ .isComplex("PropertyComplex");
+
+ }
+
+ @Test
+ public void runSingletonEntityPpCpColl() {
+ testUri.run("SINav/CollPropertyComplex")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true);
+
+ testUri.run("SINav/CollPropertyComplex/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isComplex("CollPropertyComplex")
+ .isType(EdmTechProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
+ }
+
+ @Test
+ public void runSingletonEntityPpSp() {
+ testUri.run("SINav/PropertyString")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isSimple("PropertyString");
+ }
+
+ @Test
+ public void runSingletonEntityPpSpColl() {
+ testUri.run("SINav/CollPropertyString")
+
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true);
+ testUri.run("SINav/CollPropertyString/$count")
+
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .n()
+ .isSimple("CollPropertyString")
+ .isType(EdmTechProvider.nameString, true)
+ .n()
+ .isCount();
+ }
+
+ // TODO make rest
+ @Test
+ public void runExpand() {
testUri.run("ESKeyNav(1)?$expand=*");
testUri.run("ESKeyNav(1)?$expand=*/$ref");
testUri.run("ESKeyNav(1)?$expand=*/$ref,NavPropertyETKeyNavMany");
@@ -394,9 +1812,9 @@ public class TestByAbapResourcePath {
testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=5)");
testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($select=PropertyString)");
testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavOne($levels=max)");
-
testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1;$top=2)");
testUri.run("ESKeyNav(1)?$expand=NavPropertyETKeyNavMany($skip=1%3b$top=2)");
+
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?$expand=NavPropertyETKeyNavMany");
testUri
.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav"
@@ -420,17 +1838,37 @@ public class TestByAbapResourcePath {
+ "$expand=NavPropertyETKeyNavOne))");
testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)");
testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyComplex/PropertyInt16)");
+ }
+
+ @Test
+ public void runTop() {
+ // top
testUri.run("ESKeyNav?$top=1");
testUri.run("ESKeyNav?$top=0");
testUri.run("ESKeyNav?$top=-3");
+ }
+
+ @Test
+ public void runFormat() {
+ // format
testUri.run("ESKeyNav(1)?$format=atom");
testUri.run("ESKeyNav(1)?$format=json");
testUri.run("ESKeyNav(1)?$format=xml");
testUri.run("ESKeyNav(1)?$format=IANA_content_type/must_contain_a_slash");
- testUri.run("ESKeyNav(1)?$format=Test_all_valid_signs_specified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27");
+ testUri.run("ESKeyNav(1)?$format=Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27");
+ }
+
+ @Test
+ public void runCount() {
+ // count
testUri.run("ESAllPrim?$count=true");
testUri.run("ESAllPrim?$count=false");
// testUri.run("ESAllPrim?$count=foo");
+ }
+
+ @Test
+ public void rest() {
+ // skip
testUri.run("ESAllPrim?$skip=3");
testUri.run("ESAllPrim?$skip=0");
testUri.run("ESAllPrim?$skip=-3");
@@ -611,7 +2049,7 @@ public class TestByAbapResourcePath {
testFilter
.runOnETTwoKeyNav(
"com.sap.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=PropertyInt16)/PropertyComplex"
- + "/PropertyComplex/PropertyString eq 'SomeString'"
+ + "/PropertyComplex/PropertyString eq 'SomeString'"
);
testFilter.runOnETKeyNav("indexof(PropertyString,'47') eq 5");
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
index 4659b5d..a0e895f 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestUriParserImpl.java
@@ -31,7 +31,7 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOptionEn
import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
-import org.apache.olingo.odata4.producer.core.testutil.UriResourcePathValidator;
+import org.apache.olingo.odata4.producer.core.testutil.UriResourceValidator;
import org.apache.olingo.odata4.producer.core.testutil.UriValidator;
import org.junit.Test;
@@ -56,21 +56,21 @@ public class TestUriParserImpl {
+ "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
+ "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
FilterValidator testFilter = null;
- UriResourcePathValidator testPath = null;
+ UriResourceValidator testPath = null;
UriValidator testUri = null;
public TestUriParserImpl() {
edm = new EdmProviderImpl(new EdmTechTestProvider());
testUri = new UriValidator().setEdm(edm);
- testPath = new UriResourcePathValidator().setEdm(edm);
+ testPath = new UriResourceValidator().setEdm(edm);
testFilter = new FilterValidator().setEdm(edm);
}
@Test
public void test() {
-
+ // use this method for error analysis
testPath.run("ESAllKey(" + allKeys + ")")
.isUriPathInfoKind(UriResourceKind.entitySet)
.isKeyPredicate(0, "PropertyString", "'ABC'")
@@ -79,7 +79,7 @@ public class TestUriParserImpl {
@Test
public void testActionImport() {
-
+
testPath.run("AIRTPrimParam")
.isUriPathInfoKind(UriResourceKind.action)
.isType(EdmTechProvider.nameString);
@@ -484,7 +484,7 @@ public class TestUriParserImpl {
.isType(EdmTechProvider.nameETKeyNav)
.isKeyPredicate(0, "PropertyInt16", "1")
.at(1)
- .isNav("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)
+ .isNav("NavPropertyETTwoKeyNavOne")
.isUriPathInfoKind(UriResourceKind.navigationProperty)
.isType(EdmTechProvider.nameETTwoKeyNav)
.at(2)
@@ -524,7 +524,7 @@ public class TestUriParserImpl {
.isType(EdmTechProvider.nameETKeyNav)
.isType(EdmTechProvider.nameETTwoKeyNav)
.isKeyPredicate(0, "PropertyInt16", "1")
- .isNav("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav)
+ .isNav("NavPropertyETTwoKeyNavMany")
.at(1)
.isUriPathInfoKind(UriResourceKind.navigationProperty)
.isType(EdmTechProvider.nameETTwoKeyNav)
[2/2] git commit: [OLINGO-63] Uri Parser: Extends test cases
Posted by ko...@apache.org.
[OLINGO-63] Uri Parser: Extends test cases
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/c8d0b26a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/c8d0b26a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/c8d0b26a
Branch: refs/heads/master
Commit: c8d0b26ad6c9d57987a7f2a928eebb96be13bd06
Parents: ae46250
Author: Sven Kobler <sv...@sap.com>
Authored: Thu Jan 23 17:09:06 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Fri Jan 24 13:37:03 2014 +0100
----------------------------------------------------------------------
.../producer/api/uri/UriResourceSingleton.java | 6 +-
.../producer/core/uri/UriParseTreeVisitor.java | 18 +-
.../producer/core/uri/UriResourceImplTyped.java | 2 +-
.../core/uri/UriResourceSingletonImpl.java | 29 +-
.../producer/core/testutil/EdmTechProvider.java | 2 +-
.../producer/core/testutil/FilterValidator.java | 2 +-
.../core/testutil/UriResourcePathValidator.java | 318 ---
.../core/testutil/UriResourceValidator.java | 408 ++++
.../producer/core/testutil/UriValidator.java | 21 +-
.../core/uri/antlr/TestByAbapResourcePath.java | 1984 +++++++++++++++---
.../core/uri/antlr/TestUriParserImpl.java | 14 +-
11 files changed, 2187 insertions(+), 617 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
index b34295d..2e0232b 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/UriResourceSingleton.java
@@ -18,11 +18,15 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.api.uri;
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
public interface UriResourceSingleton extends UriResourcePartTyped {
- EdmType getEntityType();
+
EdmSingleton getSingleton();
+ EdmEntityType getEntityType();
+ EdmEntityType getEntityTypeFilter();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
index 28d0bd2..2ae5675 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
@@ -232,7 +232,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
EdmActionImport edmAI = edmEntityContainer.getActionImport(odi);
if (edmAI != null) {
UriResourceActionImpl uriPathInfo = new UriResourceActionImpl();
- uriPathInfo.setAction(edmAI.getAction());
+ uriPathInfo.setActionImport(edmAI);
+
uriInfoResource.addPathInfo(uriPathInfo);
return null;
}
@@ -339,7 +340,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} else {
// is
- if (lastSegment.getComplexTypeFilter() != null) {
+ if (lastSegment.getTypeFilter() != null) {
throw wrap(new UriParserSemanticException("Chaining typefilters not allowed"));
}
@@ -376,7 +377,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} else {
- if (lastSegment.getComplexTypeFilter() != null) {
+ if (lastSegment.getTypeFilter() != null) {
throw wrap(new UriParserSemanticException("Chaining Typefilters not allowed"));
}
@@ -459,7 +460,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return lastKeyPred.getTypeFilterOnCollection();
}
}
- EdmType type = lastSegment.getComplexTypeFilter();
+ EdmType type = lastSegment.getTypeFilter();
if (type != null) {
return type;
}
@@ -557,7 +558,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (type == null) {
throw wrap(new UriParserSemanticException("Expected EntityTypeName"));
}
-
+ uriInfo.setEntityTypeCast(type);
+
contextUriInfo = uriInfo;
contextType.push(uriInfo.getEntityTypeCast());
@@ -1049,8 +1051,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
* lastPathInfo.addTypeFilter(typeFilter);
* }
*/
-
- return id.setValue(ctx.children.get(2).getText());
+
+ String text = ctx.children.get(2).getText();
+
+ return id.setValue(text).setText(text);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
index 7545e96..0b5aca4 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
@@ -31,7 +31,7 @@ public abstract class UriResourceImplTyped extends UriResourcePartImpl implement
super(kind);
}
- public EdmType getComplexTypeFilter() {//TODO rename to TypeFilter
+ public EdmType getTypeFilter() {//TODO rename to TypeFilter
return typeFilter;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
index f6666a2..bee3fb0 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceSingletonImpl.java
@@ -18,23 +18,36 @@
******************************************************************************/
package org.apache.olingo.odata4.producer.core.uri;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceSingleton;
-public class UriResourceSingletonImpl extends UriResourceImplTyped {
+public class UriResourceSingletonImpl extends UriResourceImplTyped implements UriResourceSingleton {
private EdmSingleton singleton;
public UriResourceSingletonImpl() {
super(UriResourceKind.singleton);
}
+
+ @Override
+ public EdmSingleton getSingleton() {
+ return singleton;
+ }
+
public UriResourceSingletonImpl setSingleton(EdmSingleton singleton) {
this.singleton = singleton;
return this;
}
+
+ @Override
+ public EdmEntityType getEntityTypeFilter() {
+ return (EdmEntityType) typeFilter;
+ }
@Override
public String toString() {
@@ -45,10 +58,24 @@ public class UriResourceSingletonImpl extends UriResourceImplTyped {
public EdmType getType() {
return singleton.getEntityType();
}
+
+ @Override
+ public EdmEntityType getEntityType() {
+ return singleton.getEntityType();
+ }
@Override
public boolean isCollection() {
return false;
}
+
+
+
+
+
+
+
+
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
index 3c2bc79..38adef0 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
@@ -568,7 +568,7 @@ public class EdmTechProvider extends EdmProvider {
new Parameter().setName("ParameterInt16").setType(nameInt16)))
.setReturnType(
- new ReturnType().setCollection(true).setType(nameCTTwoPrim))
+ new ReturnType().setType(nameCTTwoPrim).setCollection(true))
);
} else if (actionName.equals(nameUARTETParam)) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
index 43c562b..e3673e6 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
@@ -39,7 +39,7 @@ public class FilterValidator implements Validator {
private int logLevel;
// --- Setup ---
- public FilterValidator SetUriResourcePathValidator(UriResourcePathValidator uriResourcePathValidator) {
+ public FilterValidator SetUriResourcePathValidator(UriResourceValidator uriResourcePathValidator) {
this.invokedBy = uriResourcePathValidator;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
deleted file mode 100644
index 0aa9761..0000000
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourcePathValidator.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.producer.core.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriInfo;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
-import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
-import org.apache.olingo.odata4.producer.api.uri.UriParameter;
-import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
-import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriParserException;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceImplKeyPred;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceImplTyped;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourcePartImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
-import org.apache.olingo.odata4.producer.core.uri.UriResourcePropertyImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourcePathValidator implements Validator {
- private Edm edm;
- private Validator invokedBy;
- private UriInfo uriInfo = null;
-
- private UriResourcePartImpl uriPathInfo = null;
-
- // --- Setup ---
-
- public UriResourcePathValidator setUriValidator(UriValidator uriValidator) {
- invokedBy = uriValidator;
- return this;
- }
-
- public UriResourcePathValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public UriResourcePathValidator setUriInfoImplPath(UriInfoImpl uriInfoPath) {
- this.uriInfo = uriInfoPath;
- last();
- return this;
- }
-
- // --- Execution ---
-
- public UriResourcePathValidator run(String uri) {
- UriInfoImpl uriInfoTmp = null;
- uriPathInfo = null;
- try {
- uriInfoTmp = ParserAdapter.parseUri(uri, new UriParseTreeVisitor(edm));
- } catch (UriParserException e) {
- fail("Exception occured while parsing the URI: " + uri + "\n"
- + " Exception: " + e.getMessage());
- }
-
- if (uriInfoTmp.getKind() != UriInfoKind.resource) {
- fail("Validator can only be used on resourcePaths");
- }
- this.uriInfo = uriInfoTmp;
-
- first();
- return this;
- }
-
- // --- Navigation ---
-
- public UriValidator goUpUriValidator() {
- return (UriValidator) invokedBy;
- }
-
- public UriResourcePathValidator at(int index) {
- try {
- uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(index);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segemnts");
- }
- return this;
- }
-
- public UriResourcePathValidator first() {
- try {
- uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(0);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segemnts");
- }
- return this;
- }
-
- public UriResourcePathValidator last() {
- try {
- uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enought segemnts");
- }
-
- return this;
- }
-
- // --- Validation ---
-
- public UriResourcePathValidator isTypeFilter(FullQualifiedName expectedType) {
-
- if (uriPathInfo.getKind() != UriResourceKind.complexProperty) {
- fail("type wrong ujriResourceKind ( you may also check isTypeFilterOnEntry or isTypeFilterOnCollection");
- }
-
- EdmType actualType= ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
-
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(expectedType.toString(), actualName.toString());
- return this;
- }
-
- public UriResourcePathValidator isType(FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceImplTyped)) {
- fail("not typed");
- }
- UriResourceImplTyped uriPathInfoTyped = (UriResourceImplTyped) uriPathInfo;
-
- EdmType actualType = uriPathInfoTyped.getType();
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(type.toString(), actualName.toString());
- return this;
- }
-
- public UriResourcePathValidator isTypeFilterOnEntry(FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceImplKeyPred)) {
- fail("not typed");
- }
- UriResourceImplKeyPred uriPathInfoKeyPred = (UriResourceImplKeyPred) uriPathInfo;
-
- // input parameter type may be null in order to assert that the singleTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
- if (type == null) {
- assertEquals(type, actualType);
- } else {
- assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
- }
-
- return this;
- }
-
- public UriResourcePathValidator isTypeFilterOnCollection(FullQualifiedName expectedType) {
- if (!(uriPathInfo instanceof UriResourceImplKeyPred)) {
- fail("not typed");
- }
- UriResourceImplKeyPred uriPathInfoKeyPred = (UriResourceImplKeyPred) uriPathInfo;
-
- // input parameter type may be null in order to assert that the collectionTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
- if (expectedType == null) {
- assertEquals(expectedType, actualType);
- } else {
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(expectedType.toString(), actualName.toString());
- }
-
- return this;
- }
-
- // other functions
- public UriResourcePathValidator checkCustomParameter(int index, String name, String value) {
- if (uriInfo == null) {
- fail("hasQueryParameter: uriInfo == null");
- }
-
- List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
- if (list.size() <= index) {
- fail("not enought queryParameters");
- }
-
- CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
- assertEquals(name, option.getName());
- assertEquals(value, option.getText());
- return this;
- }
-
- public UriResourcePathValidator isCollection(boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourceImplTyped)) {
- fail("not typed");
- }
- UriResourceImplTyped uriPathInfoTyped = (UriResourceImplTyped) uriPathInfo;
-
- EdmType type = uriPathInfoTyped.getType();
- if (type == null) {
- fail("isCollection: type == null");
- }
- assertEquals(isCollection, uriPathInfoTyped.isCollection());
- return this;
- }
-
- public UriResourcePathValidator isFilterString(String expectedFilterTreeAsString) {
-
- ExpressionImpl filterTree = (ExpressionImpl) this.uriInfo.getFilterOption().getExpression();
- try {
- String filterTreeAsString = filterTree.accept(new FilterTreeToText());
- assertEquals(expectedFilterTreeAsString, filterTreeAsString);
- } catch (ExceptionVisitExpression e) {
- fail("isFilterString: Exception " + e.getMessage() + " occured");
- }
-
- return this;
- }
-
- public UriResourcePathValidator isKeyPredicate(int index, String name, String value) {
- if (!(uriPathInfo instanceof UriResourceEntitySetImpl)) {
- // TODO add and "or" for FunctionImports
- fail("isKeyPredicate: uriPathInfo is not instanceof UriPathInfoEntitySetImpl");
- }
-
- UriResourceEntitySetImpl info = (UriResourceEntitySetImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(value, keyPredicates.get(index).getText());
- return this;
-
- }
-
- public UriResourcePathValidator isKind(UriInfoKind kind) {
- assertEquals(kind, uriInfo.getKind());
- return this;
- }
-
- public UriResourcePathValidator isProperty(String name, FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourcePropertyImpl)) {
- // TODO add and "or" for FunctionImports
- fail("not a property");
- }
-
- UriResourcePropertyImpl uriPathInfoProp = (UriResourcePropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- return this;
- }
-
- public UriResourcePathValidator isComplexProperty(int index, String name, FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
- // TODO add and "or" for FunctionImports
- fail("not a property");
- }
-
- UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- return this;
- }
-
- public UriResourcePathValidator isUriPathInfoKind(UriResourceKind infoType) {
- assertNotNull(uriPathInfo);
- assertEquals(infoType, uriPathInfo.getKind());
- return this;
- }
-
- public UriResourcePathValidator isNav(String name, FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
- // TODO add and "or" for FunctionImports
- fail("not a property");
- }
-
- UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getNavigationProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
new file mode 100644
index 0000000..a4c4d4a
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriResourceValidator.java
@@ -0,0 +1,408 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.testutil;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.producer.api.uri.UriInfo;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.UriParameter;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
+import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriParserException;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceComplexPropertyImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceImplKeyPred;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceImplTyped;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourcePartImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
+import org.apache.olingo.odata4.producer.core.uri.UriResourcePropertyImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceSimplePropertyImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceSingletonImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceValidator implements Validator {
+ private Edm edm;
+ private Validator invokedBy;
+ private UriInfo uriInfo = null;
+
+ private UriResourcePartImpl uriPathInfo = null;
+ private int uriResourceIndex;
+
+ // --- Setup ---
+
+ public UriResourceValidator setUriValidator(UriValidator uriValidator) {
+ invokedBy = uriValidator;
+ return this;
+ }
+
+ public UriResourceValidator setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public UriResourceValidator setUriInfoImplPath(UriInfoImpl uriInfoPath) {
+ this.uriInfo = uriInfoPath;
+ last();
+ return this;
+ }
+
+ // --- Execution ---
+
+ public UriResourceValidator run(String uri) {
+ UriInfoImpl uriInfoTmp = null;
+ uriPathInfo = null;
+ try {
+ uriInfoTmp = ParserAdapter.parseUri(uri, new UriParseTreeVisitor(edm));
+ } catch (UriParserException e) {
+ fail("Exception occured while parsing the URI: " + uri + "\n"
+ + " Exception: " + e.getMessage());
+ }
+
+ if (uriInfoTmp.getKind() != UriInfoKind.resource) {
+ fail("Validator can only be used on resourcePaths");
+ }
+ this.uriInfo = uriInfoTmp;
+
+ first();
+ return this;
+ }
+
+ // --- Navigation ---
+
+ public UriValidator goUpUriValidator() {
+ return (UriValidator) invokedBy;
+ }
+
+ public UriResourceValidator at(int index) {
+ uriResourceIndex = index;
+ try {
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+ return this;
+ }
+
+ public UriResourceValidator first() {
+ uriResourceIndex = 0;
+ try {
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(0);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+ return this;
+ }
+
+ public UriResourceValidator last() {
+ try {
+ uriResourceIndex = 0;
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
+ uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator n() {
+ uriResourceIndex++;
+
+ try {
+ uriPathInfo = (UriResourcePartImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
+ } catch (IndexOutOfBoundsException ex) {
+ fail("not enought segemnts");
+ }
+
+ return this;
+ }
+
+ // --- Validation ---
+
+ public UriResourceValidator isTypeFilter(FullQualifiedName expectedType) {
+
+ if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
+ uriPathInfo.getKind() != UriResourceKind.singleton) {
+ fail("type wrong ujriResourceKind ( you may also check isTypeFilterOnEntry or isTypeFilterOnCollection");
+ }
+
+ EdmType actualType = null;
+ if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
+ actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
+ } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
+ actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
+ }
+
+ if (actualType == null) {
+ fail("type information not set");
+ }
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+ assertEquals(expectedType.toString(), actualName.toString());
+ return this;
+ }
+
+ public UriResourceValidator isType(FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourceImplTyped)) {
+ fail("not typed");
+ }
+ UriResourceImplTyped uriPathInfoTyped = (UriResourceImplTyped) uriPathInfo;
+
+ EdmType actualType = uriPathInfoTyped.getType();
+ if (actualType == null) {
+ fail("type information not set");
+ }
+
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+
+ assertEquals(type.toString(), actualName.toString());
+
+ return this;
+ }
+
+ public UriResourceValidator isType(FullQualifiedName type, boolean isFinallyACollection) {
+ isType(type);
+ assertEquals(isFinallyACollection, ((UriResourceImplTyped) uriPathInfo).isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isTypeFilterOnEntry(FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourceImplKeyPred)) {
+ fail("not keypred");
+ }
+ UriResourceImplKeyPred uriPathInfoKeyPred = (UriResourceImplKeyPred) uriPathInfo;
+
+ // input parameter type may be null in order to assert that the singleTypeFilter is not set
+ EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
+ if (type == null) {
+ assertEquals(type, actualType);
+ } else {
+ assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator isTypeFilterOnCollection(FullQualifiedName expectedType) {
+ if (!(uriPathInfo instanceof UriResourceImplKeyPred)) {
+ fail("not keypred");
+ }
+ UriResourceImplKeyPred uriPathInfoKeyPred = (UriResourceImplKeyPred) uriPathInfo;
+
+ // input parameter type may be null in order to assert that the collectionTypeFilter is not set
+ EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
+ if (expectedType == null) {
+ assertEquals(expectedType, actualType);
+ } else {
+ FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
+ assertEquals(expectedType.toString(), actualName.toString());
+ }
+
+ return this;
+ }
+
+ // other functions
+ public UriResourceValidator checkCustomParameter(int index, String name, String value) {
+ if (uriInfo == null) {
+ fail("hasQueryParameter: uriInfo == null");
+ }
+
+ List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
+ if (list.size() <= index) {
+ fail("not enought queryParameters");
+ }
+
+ CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
+ assertEquals(name, option.getName());
+ assertEquals(value, option.getText());
+ return this;
+ }
+
+ // TODO remove
+ public UriResourceValidator isCollection(boolean isCollection) {
+ if (!(uriPathInfo instanceof UriResourceImplTyped)) {
+ fail("not typed");
+ }
+ UriResourceImplTyped uriPathInfoTyped = (UriResourceImplTyped) uriPathInfo;
+
+ EdmType type = uriPathInfoTyped.getType();
+ if (type == null) {
+ fail("isCollection: type == null");
+ }
+ assertEquals(isCollection, uriPathInfoTyped.isCollection());
+ return this;
+ }
+
+ public UriResourceValidator isFilterString(String expectedFilterTreeAsString) {
+
+ ExpressionImpl filterTree = (ExpressionImpl) this.uriInfo.getFilterOption().getExpression();
+ try {
+ String filterTreeAsString = filterTree.accept(new FilterTreeToText());
+ assertEquals(expectedFilterTreeAsString, filterTreeAsString);
+ } catch (ExceptionVisitExpression e) {
+ fail("isFilterString: Exception " + e.getMessage() + " occured");
+ }
+
+ return this;
+ }
+
+ public UriResourceValidator isKeyPredicate(int index, String name, String value) {
+ if (!(uriPathInfo instanceof UriResourceEntitySetImpl)) {
+ // TODO add and "or" for FunctionImports
+ fail("isKeyPredicate: uriPathInfo is not instanceof UriPathInfoEntitySetImpl");
+ }
+
+ UriResourceEntitySetImpl info = (UriResourceEntitySetImpl) uriPathInfo;
+ List<UriParameter> keyPredicates = info.getKeyPredicates();
+ assertEquals(name, keyPredicates.get(index).getName());
+ assertEquals(value, keyPredicates.get(index).getText());
+ return this;
+
+ }
+
+ public UriResourceValidator isKind(UriInfoKind kind) {
+ assertEquals(kind, uriInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isProperty(String name, FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourcePropertyImpl)) {
+ // TODO add and "or" for FunctionImports
+ fail("not a property");
+ }
+
+ UriResourcePropertyImpl uriPathInfoProp = (UriResourcePropertyImpl) uriPathInfo;
+
+ EdmElement property = uriPathInfoProp.getProperty();
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ return this;
+ }
+
+ public UriResourceValidator isComplexProperty(int index, String name, FullQualifiedName type) {
+ if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
+ // TODO add and "or" for FunctionImports
+ fail("not a property");
+ }
+
+ UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
+
+ EdmElement property = uriPathInfoProp.getProperty();
+
+ assertEquals(name, property.getName());
+ assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ return this;
+ }
+
+ public UriResourceValidator isUriPathInfoKind(UriResourceKind infoType) {
+ assertNotNull(uriPathInfo);
+ assertEquals(infoType, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isAction(String name) {
+ assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
+ return this;
+ }
+
+ public UriResourceValidator isFunction(String name) {
+ assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
+ return this;
+ }
+
+ public UriResourceValidator isFunctionImport(String name) {
+ assertEquals(UriResourceKind.function, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
+ return this;
+ }
+
+ public UriResourceValidator isEntitySet(String name) {
+ assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
+ return this;
+ }
+
+ public UriResourceValidator isComplex(String name) {
+ assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
+ return this;
+ }
+
+ public UriResourceValidator isSimple(String name) {
+ assertEquals(UriResourceKind.simpleProperty, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceSimplePropertyImpl) uriPathInfo).getProperty().getName());
+ return this;
+ }
+
+ public UriResourceValidator isSingleton(String name) {
+ assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
+ return this;
+ }
+
+ public UriResourceValidator isValue() {
+ assertEquals(UriResourceKind.value, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isCount() {
+ assertEquals(UriResourceKind.count, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isRef() {
+ assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
+ return this;
+ }
+
+ public UriResourceValidator isActionImport(String actionName) {
+ assertEquals(UriResourceKind.action, uriPathInfo.getKind());
+ assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
+ return this;
+ }
+
+ public UriResourceValidator isNav(String name) {
+ assertEquals(UriResourceKind.navigationProperty, uriPathInfo.getKind());
+ assertEquals(name, ((UriResourceNavigationPropertyImpl) uriPathInfo).getNavigationProperty().getName());
+ // assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c8d0b26a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
index ed9413a..8054085 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/UriValidator.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
@@ -60,12 +61,12 @@ public class UriValidator implements Validator {
}
// Navigation
- public UriResourcePathValidator goPath() {
+ public UriResourceValidator goPath() {
if (uriInfo.getKind() != UriInfoKind.resource) {
fail("goPath can only be used on resourcePaths");
}
- return new UriResourcePathValidator()
+ return new UriResourceValidator()
.setUriValidator(this)
.setEdm(edm)
.setUriInfoImplPath(uriInfo);
@@ -125,15 +126,21 @@ public class UriValidator implements Validator {
return this;
}
- public UriValidator isEntityType(FullQualifiedName nameetbase) {
+ public UriValidator isEntityType(FullQualifiedName fullName) {
if (uriInfo.getKind() != UriInfoKind.entityId) {
fail("isKeyPredicate: uriPathInfo is not instanceof UriInfoImplCrossjoin");
}
-
- assertEquals(nameetbase.toString(), uriInfo.getEntityTypeCast().toString());
+
+ assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
return this;
}
-
-
+
+ private String fullName(EdmEntityType type) {
+ return type.getNamespace() + "." + type.getName();
+ }
+
+ public void isID(String idAsText) {
+ assertEquals(idAsText, uriInfo.getIdOption().getText());
+ }
}