You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/11/06 16:58:39 UTC
[1/5] olingo-odata4 git commit: [OLINGO-821] Verify Enum and TypeDef
support
Repository: olingo-odata4
Updated Branches:
refs/heads/master ac828a355 -> 639362caa
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/resources/EntityETMixEnumDefCollCompWithEnumStrings.json
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/resources/EntityETMixEnumDefCollCompWithEnumStrings.json b/lib/server-test/src/test/resources/EntityETMixEnumDefCollCompWithEnumStrings.json
new file mode 100644
index 0000000..0207d29
--- /dev/null
+++ b/lib/server-test/src/test/resources/EntityETMixEnumDefCollCompWithEnumStrings.json
@@ -0,0 +1,24 @@
+{
+ "PropertyEnumString" : "String2",
+ "PropertyDefString" : "def",
+ "CollPropertyEnumString" : ["String1", "String2"],
+ "CollPropertyDefString" : ["def1", "def2"],
+ "PropertyCompMixedEnumDef" : {
+ "PropertyEnumString" : "String2",
+ "PropertyDefString" : "def",
+ "CollPropertyEnumString" : ["String1", "String2"],
+ "CollPropertyDefString" : ["def1", "def2"]
+ },
+ "CollPropertyCompMixedEnumDef" : [{
+ "PropertyEnumString" : "String2",
+ "PropertyDefString" : "def",
+ "CollPropertyEnumString" : ["String1", "String2"],
+ "CollPropertyDefString" : ["def1", "def2"]
+ }, {
+ "PropertyEnumString" : "String2",
+ "PropertyDefString" : "def",
+ "CollPropertyEnumString" : ["String1", "String2"],
+ "CollPropertyDefString" : ["def1", "def2"]
+ }
+ ]
+}
[2/5] olingo-odata4 git commit: [OLINGO-821] Verify Enum and TypeDef
support
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index 6f1c4ad..69458ab 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -72,33 +72,52 @@ public class TestFullResourcePath {
}
@Test
+ public void enumAndTypeDefAsKey() throws Exception {
+ testUri
+ .run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',PropertyDefString='abc')")
+ .goPath()
+ .at(0)
+ .isEntitySet("ESMixEnumDefCollComp")
+ .isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
+ .isKeyPredicate(1, "PropertyDefString", "'abc'");
+
+ testUri
+ .run("ESMixEnumDefCollComp", "$filter=PropertyEnumString has Namespace1_Alias.ENString'String1'")
+ .goPath()
+ .at(0)
+ .isEntitySet("ESMixEnumDefCollComp")
+ .goUpUriValidator()
+ .goFilter().is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>");
+ }
+
+ @Test
public void testFunctionBound_varOverloading() throws Exception {
// on ESTwoKeyNav
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
// with string parameter
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
// with string parameter
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
}
@Test
@@ -142,32 +161,32 @@ public class TestFullResourcePath {
@Test
public void runBfuncBnCpropCollRtEs() throws Exception {
testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComp")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim");
testUri
- .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
+ .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isUriPathInfoKind(UriResourceKind.complexProperty)
+ .isComplex("CollPropertyComp")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .n()
+ .isFunction("BFCCollCTPrimCompRTESAllPrim")
+ .isType(EntityTypeProvider.nameETAllPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
}
@Test
@@ -208,20 +227,20 @@ public class TestFullResourcePath {
@Test
public void runBfuncBnEntityRtEs() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
}
@Test
public void runBfuncBnEntityCastRtEs() throws Exception {
testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+ + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -233,8 +252,8 @@ public class TestFullResourcePath {
.isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
testUri
- .run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
+ .run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
+ + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -259,8 +278,8 @@ public class TestFullResourcePath {
.isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+ + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
+ + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -290,76 +309,76 @@ public class TestFullResourcePath {
@Test
public void runBfuncBnEsRtCprop() throws Exception {
testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isFunction("BFNESAllPrimRTCTAllPrim")
- .isType(ComplexTypeProvider.nameCTAllPrim);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isFunction("BFNESAllPrimRTCTAllPrim")
+ .isType(ComplexTypeProvider.nameCTAllPrim);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, false)
- .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim, false)
+ .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
}
@Test
public void runBfuncBnEsRtCpropColl() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim, true);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
+ .isType(ComplexTypeProvider.nameCTTwoPrim, true)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.count);
}
@Test
public void runBfuncBnEsRtEntityPpNp() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n()
- .isUriPathInfoKind(UriResourceKind.ref);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
+ .n()
+ .isUriPathInfoKind(UriResourceKind.ref);
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
+ .n()
+ .isValue();
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
+ "/NavPropertyETTwoKeyNavOne")
@@ -432,9 +451,9 @@ public class TestFullResourcePath {
.isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(WrongParameter='1')")
- .isExSemantic(MessageKeys.UNKNOWN_PART);
+ .isExSemantic(MessageKeys.UNKNOWN_PART);
testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)")
- .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+ .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
}
@Test
@@ -452,8 +471,8 @@ public class TestFullResourcePath {
.isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
testUri
- .run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
- + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+ .run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
+ + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -473,40 +492,40 @@ public class TestFullResourcePath {
public void runBfuncBnEsRtEntityPpCp() throws Exception {
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyCompNav")
- .isType(ComplexTypeProvider.nameCTNavFiveProp);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyCompNav")
+ .isType(ComplexTypeProvider.nameCTNavFiveProp);
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyCompNav")
- .isType(ComplexTypeProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyCompNav")
+ .isType(ComplexTypeProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyCompNav/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyCompNav")
- .isType(ComplexTypeProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isComplex("PropertyCompNav")
+ .isType(ComplexTypeProvider.nameCTNavFiveProp)
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
+ .n()
+ .isValue();
}
@@ -548,24 +567,24 @@ public class TestFullResourcePath {
@Test
public void runBfuncBnEsRtEntityPpSp() throws Exception {
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESKeyNavRTETKeyNav")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
+ .n()
+ .isValue();
}
@@ -573,57 +592,57 @@ public class TestFullResourcePath {
public void runBfuncBnEsRtEs() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isParameter(0, "ParameterString", "'2'")
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
testUri.run("ESKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'3'")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isParameter(0, "ParameterString", "'3'")
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .n()
+ .isCount();
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'");
}
@@ -649,165 +668,165 @@ public class TestFullResourcePath {
@Test
public void runBfuncBnEsRtPrim() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString");
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString")
- .isType(PropertyProvider.nameString)
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTString")
+ .isType(PropertyProvider.nameString)
+ .n()
+ .isValue();
}
@Test
public void runbfuncBnEsRtPrimColl() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(PropertyProvider.nameString, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(PropertyProvider.nameString, true);
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(PropertyProvider.nameString, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isFunction("BFCESTwoKeyNavRTCollString")
+ .isType(PropertyProvider.nameString, true)
+ .n()
+ .isCount();
}
@Test
public void runBfuncBnPpropCollRtEs() throws Exception {
testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true);
testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+ .n()
+ .isFunction("BFCCollStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
}
@Test
public void runBfuncBnPpropRtEs() throws Exception {
testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true);
testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .n()
+ .isCount();
testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
+ .n()
+ .isFunction("BFCStringRTESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
}
@Test
public void runBfuncBnSingleRtEs() throws Exception {
testUri.run("SINav/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isFunction("BFCSINavRTESTwoKeyNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isFunction("BFCSINavRTESTwoKeyNav");
}
@Test
public void runBfuncBnSingleCastRtEs() throws Exception {
testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isSingleton("SINav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
}
@Test
public void runActionBound_on_EntityEntry() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
testUri.run("ESKeyNav(PropertyInt16=1)/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isAction("BAETTwoKeyNavRTETTwoKeyNav");
}
@Test
public void runActionBound_on_EntityCollection() throws Exception {
testUri.run("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isAction("BAESTwoKeyNavRTESTwoKeyNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .n()
+ .isAction("BAESTwoKeyNavRTESTwoKeyNav");
}
@Test
@@ -815,24 +834,24 @@ public class TestFullResourcePath {
// on primitive
testUri.run("ESAllPrim(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETAllPrim, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(PropertyProvider.nameString);
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETAllPrim, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(PropertyProvider.nameString);
// on collection of primitive
testUri.run("ESCollAllPrim(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETCollAllPrim, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(PropertyProvider.nameString);
-
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETCollAllPrim, false)
+ .at(1)
+ .isUriPathInfoKind(UriResourceKind.primitiveProperty)
+ .isType(PropertyProvider.nameString);
+
// on complex
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
+ "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
@@ -847,14 +866,14 @@ public class TestFullResourcePath {
// on collection of complex
testUri.run("ESKeyNav(1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1)
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETAllPrim);
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .at(1)
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .at(2)
+ .isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETAllPrim);
// on entity
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
@@ -869,12 +888,12 @@ public class TestFullResourcePath {
// on collection of entity
testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1).isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
+ .goPath()
+ .at(0)
+ .isUriPathInfoKind(UriResourceKind.entitySet)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(1).isUriPathInfoKind(UriResourceKind.function)
+ .isType(EntityTypeProvider.nameETTwoKeyNav);
}
@Test
@@ -907,12 +926,12 @@ public class TestFullResourcePath {
@Test
public void runCrossjoin() throws Exception {
testUri.run("$crossjoin(ESKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
+ .isKind(UriInfoKind.crossjoin)
+ .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
}
@Test
@@ -921,35 +940,35 @@ public class TestFullResourcePath {
testUri.runEx("$crossjoin/error").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
testUri.runEx("$crossjoin()").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid")
- .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
+ .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
}
@Test
public void runEntityId() throws Exception {
testUri.run("$entity", "$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isIdText("ESKeyNav(1)");
+ .isKind(UriInfoKind.entityId)
+ .isIdText("ESKeyNav(1)");
testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EntityTypeProvider.nameETKeyNav)
- .isIdText("ESKeyNav(1)");
+ .isKind(UriInfoKind.entityId)
+ .isEntityType(EntityTypeProvider.nameETKeyNav)
+ .isIdText("ESKeyNav(1)");
}
@Test
public void runEsName() throws Exception {
testUri.run("ESAllPrim")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EntityTypeProvider.nameETAllPrim, true);
testUri.run("ESAllPrim/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isType(EntityTypeProvider.nameETAllPrim, true)
+ .n()
+ .isCount();
}
@Test
@@ -998,221 +1017,221 @@ public class TestFullResourcePath {
// TODO Currently "'" is not allowed in OData identifiers, but the specification allows this character (Unicode Cf)
testUri.runEx("ESAllPrim'").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
testUri.runEx("ESAllPrim'InvalidStuff").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
+
testUri.runEx("ESAllPrim", "$filter=PropertyInt16' eq 0")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
+ .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+
testUri.runEx("ESAllPrim", "$filter=PropertyInt16 eq' 0")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
+ .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+
testUri.runEx("ESAllPrim", "$filter=PropertyInt16 eq 0'")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
-
+ .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+
testUri.runEx("ESAllPrim", "$filter=PropertyInt16 eq 'dsd''")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
+ .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
}
-
+
@Test
public void runFunctionsWithKeyPredicates() throws Exception {
testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
- .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterString", "'1'")
- .isParameter(1, "ParameterInt16", "1");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+ .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .isParameter(1, "ParameterInt16", "1");
+
testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=0)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
- .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterString", "'1'")
- .isParameter(1, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "0");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+ .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .isParameter(1, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "0");
+
testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(0)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
- .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterString", "'1'")
- .isParameter(1, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "0");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+ .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .isParameter(1, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "0");
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16 eq 0)")
- .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-
+ .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+
// PropertyInt32 does not exist
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=0)")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
- testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)"
+ .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
+ testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterString='1',ParameterInt16=1)"
+ "(PropertyInt16=0,PropertyInt16=1)")
- .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
+ .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
- .isFunction("UFCRTCollCTTwoPrimTwoParam")
- .isParameter(0, "ParameterString", "'1'")
- .isParameter(1, "ParameterInt16", "1");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
+ .isFunction("UFCRTCollCTTwoPrimTwoParam")
+ .isParameter(0, "ParameterString", "'1'")
+ .isParameter(1, "ParameterInt16", "1");
+
testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt16=1)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(1)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterString='1',ParameterInt16=1)(PropertyInt32=1,PropertyInt16=2)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollESTwoKeyNavParam")
- .isFunction("UFCRTCollETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollESTwoKeyNavParam")
+ .isFunction("UFCRTCollETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1");
+
testUri.run("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='1')")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollESTwoKeyNavParam")
- .isFunction("UFCRTCollETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1,"PropertyString", "'1'");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollESTwoKeyNavParam")
+ .isFunction("UFCRTCollETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'1'");
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16 eq 1)")
- .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
-
+ .isExSemantic(MessageKeys.INVALID_KEY_VALUE);
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1)")
- .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
+ .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1,PropertyString='1')")
- .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
+ .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)()")
- .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
+ .isExSemantic(MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyInt32=1)")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
+ .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
testUri.runEx("FICRTCollESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,Unkown=1)")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
-
+ .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
+
testUri.run("FICRTCollString()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollString")
- .isFunction("UFCRTCollString");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollString")
+ .isFunction("UFCRTCollString");
+
testUri.run("FICRTString()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTString")
- .isFunction("UFCRTString");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTString")
+ .isFunction("UFCRTString");
+
testUri.runEx("FICRTCollString()(0)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
-
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+
testUri.runEx("FICRTString()(0)")
- .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
+ .isExSemantic(MessageKeys.KEY_NOT_ALLOWED);
}
-
+
@Test
public void runNonComposableFunctions() throws Exception {
testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
- .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'1'");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+ .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'1'");
+
testUri.run("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
- .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'1'");
-
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isFunctionImport("FICRTCollETMixPrimCollCompTwoParam")
+ .isFunction("UFCRTCollETMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'1'");
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')(0)/PropertyInt16")
- .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
-
+ .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$top=1")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
- testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')",
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
+ testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')",
"$filter=PropertyInt16 eq 1")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skip=1")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$count=true")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$skiptoken=5")
- .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
-
+ .isExValidation(UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
+
// $search is currently not implemented. Please change this exception if the implementation is done.
testUri.runEx("FICRTCollETMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='1')", "$search=test")
- .isExSemantic(MessageKeys.NOT_IMPLEMENTED);
-
+ .isExSemantic(MessageKeys.NOT_IMPLEMENTED);
+
testUri.run("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESAllPrim")
- .at(1)
- .isFunction("BFNESAllPrimRTCTAllPrim");
-
- testUri.runEx("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()"
- + "/PropertyString")
- .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
+ .isKind(UriInfoKind.resource)
+ .goPath().first()
+ .isEntitySet("ESAllPrim")
+ .at(1)
+ .isFunction("BFNESAllPrimRTCTAllPrim");
+
+ testUri.runEx("ESAllPrim/olingo.odata.test1.BFNESAllPrimRTCTAllPrim()"
+ + "/PropertyString")
+ .isExValidation(UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH);
}
-
+
@Test
public void runEsNameCast() throws Exception {
testUri.run("ESTwoPrim/olingo.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, true)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(-32768)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768");
testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim, false)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
+ .isKeyPredicate(0, "PropertyInt16", "-32768");
}
@@ -1220,15 +1239,15 @@ public class TestFullResourcePath {
public void runEsNamePpSpCast() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+ "/PropertyComp/PropertyInt16")
@@ -1248,23 +1267,23 @@ public class TestFullResourcePath {
@Test
public void runEsNameKey() throws Exception {
testUri.run("ESCollAllPrim(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
testUri.run("ESCollAllPrim(PropertyInt16=1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim");
testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESFourKeyAlias")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "KeyAlias1", "2")
- .isKeyPredicate(2, "KeyAlias2", "'3'")
- .isKeyPredicate(3, "KeyAlias3", "'4'");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESFourKeyAlias")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "KeyAlias1", "2")
+ .isKeyPredicate(2, "KeyAlias2", "'3'")
+ .isKeyPredicate(3, "KeyAlias3", "'4'");
testUri.runEx("ESTwoPrim(wrong)").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
testUri.runEx("ESTwoPrim(PropertyInt16=wrong)").isExSemantic(MessageKeys.INVALID_KEY_VALUE);
@@ -1308,147 +1327,147 @@ public class TestFullResourcePath {
testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)").isExSemantic(MessageKeys.INCOMPATIBLE_TYPE_FILTER);
testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoPrim")
+ .isType(EntityTypeProvider.nameETTwoPrim)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
}
@Test
public void runEsNameParaKeysCast() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'");
}
@Test
public void run_EsNamePpCp() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComp");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isComplex("PropertyComp");
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isComplex("PropertyComp")
+ .n()
+ .isComplex("PropertyComp");
}
@Test
public void runEsNamePpCpColl() throws Exception {
testUri.run("ESMixPrimCollComp(5)/CollPropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "5")
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .isKeyPredicate(0, "PropertyInt16", "5")
+ .n()
+ .isComplex("CollPropertyComp")
+ .isType(ComplexTypeProvider.nameCTTwoPrim, true);
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComp")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true);
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isComplex("CollPropertyComp")
+ .isType(ComplexTypeProvider.nameCTPrimComp, true)
+ .n()
+ .isCount();
}
@Test
public void runEsNamePpCpCast() throws Exception {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESTwoKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .n()
+ .isComplex("PropertyComp");
testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComp/PropertyComp")
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyComp/PropertyComp")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1462,8 +1481,8 @@ public class TestFullResourcePath {
.isComplex("PropertyComp");
testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1478,8 +1497,8 @@ public class TestFullResourcePath {
.isTypeFilter(ComplexTypeProvider.nameCTBase);
testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
+ .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
+ + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1496,63 +1515,63 @@ public class TestFullResourcePath {
@Test
public void runNsNamePpNp() throws Exception {
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2");
testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2");
testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyCompNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isComplex("PropertyCompNav");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isComplex("PropertyCompNav");
testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ "/NavPropertyETKeyNavMany(4)")
@@ -1569,24 +1588,24 @@ public class TestFullResourcePath {
.isKeyPredicate(0, "PropertyInt16", "4");
testUri.run("ESKeyNav(1)/PropertyCompNav/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyCompNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
- + "/PropertyComp/PropertyComp/PropertyInt16")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESKeyNav")
.isKeyPredicate(0, "PropertyInt16", "1")
.n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
+ .isComplex("PropertyCompNav")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
+
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
+ + "/PropertyComp/PropertyComp/PropertyInt16")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
.isKeyPredicate(1, "PropertyString", "'(3)'")
.n()
.isComplex("PropertyComp")
@@ -1596,15 +1615,15 @@ public class TestFullResourcePath {
.isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .n()
+ .isValue();
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
+ "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
@@ -1654,7 +1673,7 @@ public class TestFullResourcePath {
.isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany(3)")
+ + "/NavPropertyETKeyNavMany(3)")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1726,128 +1745,128 @@ public class TestFullResourcePath {
public void runEsNamePpNpRc() throws Exception {
// checks for using referential constrains to fill missing keys
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+ .isKeyPredicate(1, "PropertyString", "'2'");
testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
+ .isKeyPredicate(1, "PropertyString", "'2'");
}
@Test
public void runEsNamePpSp() throws Exception {
testUri.run("ESAllPrim(1)/PropertyByte")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false);
testUri.run("ESAllPrim(1)/PropertyByte/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
+ .n()
+ .isValue();
testUri.run("ESMixPrimCollComp(1)/PropertyComp/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESMixPrimCollComp")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isComplex("PropertyComp")
+ .n()
+ .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
}
@Test
public void runEsNamePpSpColl() throws Exception {
testUri.run("ESCollAllPrim(1)/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESCollAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "2")
+ .isKeyPredicate(1, "PropertyString", "'3'")
+ .n()
+ .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
+ .n()
+ .isCount();
}
@Test
public void runEsNameRef() throws Exception {
testUri.run("ESAllPrim/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .n()
+ .isRef();
testUri.run("ESAllPrim(-32768)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESAllPrim")
+ .isKeyPredicate(0, "PropertyInt16", "-32768")
+ .n()
+ .isRef();
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .n()
+ .isRef();
testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isEntitySet("ESKeyNav")
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .n()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
+ .isKeyPredicate(0, "PropertyInt16", "1")
+ .isKeyPredicate(1, "PropertyString", "'2'")
+ .n()
+ .isRef();
}
@Test
@@ -1885,64 +1904,64 @@ public class TestFullResourcePath {
.isKeyPredicate(1, "PropertyString", "'3'")
.n()
.isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
+
testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString=null)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
- .isFunction("UFCRTCollCTTwoPrimTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", null);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
+ .isFunction("UFCRTCollCTTwoPrimTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", null);
}
@Test
public void runFunctionImpEntity() throws Exception {
testUri.run("FICRTETKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav);
-
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .isType(EntityTypeProvider.nameETKeyNav);
+
testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1");
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1");
testUri.run("FICRTESMedia(ParameterInt16=1)/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMedia")
- .isFunction("UFCRTETMedia")
- .n()
- .isValue();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMedia")
+ .isFunction("UFCRTETMedia")
+ .n()
+ .isValue();
testUri.run("FICRTETKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETKeyNav")
+ .isFunction("UFCRTETKeyNav")
+ .n()
+ .isRef();
testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .n()
- .isRef();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .n()
+ .isRef();
testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTETTwoKeyNavParam")
+ .isFunction("UFCRTETTwoKeyNavParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isType(EntityTypeProvider.nameETTwoKeyNav)
+ .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
+
testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath()
.first()
@@ -1969,39 +1988,39 @@ public class TestFullResourcePath {
public void runFunctionImpEs() throws Exception {
/**/
testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EntityTypeProvider.nameETMixPrimCollComp);
testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp);
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EntityTypeProvider.nameETMixPrimCollComp);
testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp)
- .n()
- .isCount();
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
+ .isFunction("UFCRTESMixPrimCollCompTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", "'2'")
+ .isType(EntityTypeProvider.nameETMixPrimCollComp)
+ .n()
+ .isCount();
}
@Test
public void runFunctionIm
<TRUNCATED>
[5/5] olingo-odata4 git commit: [OLINGO-821] Verify Enum and TypeDef
support
Posted by ch...@apache.org.
[OLINGO-821] Verify Enum and TypeDef support
Included full integration tests for all components
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/639362ca
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/639362ca
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/639362ca
Branch: refs/heads/master
Commit: 639362caa32daa89f24622194b78f6a3020982d2
Parents: ac828a3
Author: Christian Amend <ch...@sap.com>
Authored: Fri Nov 6 16:29:55 2015 +0100
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Nov 6 16:29:55 2015 +0100
----------------------------------------------------------------------
.../olingo/fit/tecsvc/client/BasicITCase.java | 8 +-
.../tecsvc/client/FilterSystemQueryITCase.java | 2 +-
.../deserializer/xml/ODataXmlDeserializer.java | 188 +-
.../serializer/json/ODataJsonSerializer.java | 7 +-
.../olingo/server/tecsvc/data/DataCreator.java | 1052 +--
.../olingo/server/tecsvc/data/DataProvider.java | 51 +-
.../tecsvc/provider/ComplexTypeProvider.java | 2 +-
.../tecsvc/provider/EntityTypeProvider.java | 8 +-
.../tecsvc/provider/PropertyProvider.java | 9 +-
.../json/ODataJsonDeserializerEntityTest.java | 25 +
.../xml/ODataXmlDeserializerTest.java | 4 +-
.../json/ODataJsonSerializerTest.java | 60 +-
.../serializer/xml/ODataXmlSerializerTest.java | 2 -
.../core/uri/antlr/TestFullResourcePath.java | 6114 +++++++++---------
...tityETMixEnumDefCollCompWithEnumStrings.json | 24 +
15 files changed, 3859 insertions(+), 3697 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
index de0a0ac..a09cafa 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
@@ -468,10 +468,6 @@ public class BasicITCase extends AbstractParamTecSvcITCase {
@Test
public void createEntityWithEnumAndTypeDefinition() throws Exception {
ClientEntity newEntity = getFactory().newEntity(new FullQualifiedName(SERVICE_NAMESPACE, "ETMixEnumDefCollComp"));
- newEntity.getProperties().add(getFactory().newEnumProperty("PropertyEnumString",
- getFactory().newEnumValue(null, "String2")));
- newEntity.getProperties().add(getFactory().newPrimitiveProperty("PropertyDefString",
- getFactory().newPrimitiveValueBuilder().buildString("Test String")));
final ODataEntityCreateRequest<ClientEntity> request = getClient().getCUDRequestFactory().getEntityCreateRequest(
getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESMixEnumDefCollComp").build(),
newEntity);
@@ -481,11 +477,11 @@ public class BasicITCase extends AbstractParamTecSvcITCase {
ClientProperty property = createdEntity.getProperty("PropertyEnumString");
assertNotNull(property);
// TODO: Improve client value types.
- assertEquals("String2", isJson() ? property.getPrimitiveValue().toValue() : property.getEnumValue().getValue());
+ assertEquals("String1", isJson() ? property.getPrimitiveValue().toValue() : property.getEnumValue().getValue());
property = createdEntity.getProperty("PropertyDefString");
assertNotNull(property);
// TODO: Improve client value types.
- assertEquals("Test String", isJson() ?
+ assertEquals("1", isJson() ?
property.getPrimitiveValue().toValue() :
property.getEnumValue().getValue());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
index 6fe2e5b..4ecca7c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
@@ -187,7 +187,7 @@ public class FilterSystemQueryITCase extends AbstractParamTecSvcITCase {
assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
- result = sendRequest(ES_MIX_ENUM_DEF_COLL_COMP, "PropertyEnumString has Namespace1_Alias.ENString'String1'");
+ result = sendRequest(ES_MIX_ENUM_DEF_COLL_COMP, "PropertyEnumString eq Namespace1_Alias.ENString'String2'");
assertTrue(result.getBody().getEntities().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
index 8ddd72d..eb1f5de 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -82,8 +82,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
private Object primitive(final XMLEventReader reader, final StartElement start,
- final EdmType type, final boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final boolean isUnicode) throws XMLStreamException, EdmPrimitiveTypeException,
+ final EdmType type, final boolean isNullable, final Integer maxLength, final Integer precision,
+ final Integer scale, final boolean isUnicode) throws XMLStreamException, EdmPrimitiveTypeException,
DeserializerException {
Object value = null;
@@ -99,12 +99,12 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
final EdmPrimitiveType primitiveType = (EdmPrimitiveType) type;
final String stringValue = event.asCharacters().getData();
- value = primitiveType.valueOfString(stringValue,
- isNullable,
- maxLength,
- precision,
- scale,
- isUnicode,
+ value = primitiveType.valueOfString(stringValue,
+ isNullable,
+ maxLength,
+ precision,
+ scale,
+ isUnicode,
primitiveType.getDefaultType());
}
@@ -123,8 +123,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
StartElement se = event.asStartElement();
- EdmProperty p = (EdmProperty)edmComplex.getProperty(se.getName().getLocalPart());
- value.getValue().add(property(reader, se, p.getType(), p.isNullable(), p.getMaxLength(),
+ EdmProperty p = (EdmProperty) edmComplex.getProperty(se.getName().getLocalPart());
+ value.getValue().add(property(reader, se, p.getType(), p.isNullable(), p.getMaxLength(),
p.getPrecision(), p.getScale(), p.isUnicode(), p.isCollection()));
}
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
@@ -145,12 +145,12 @@ public class ODataXmlDeserializer implements ODataDeserializer {
while (reader.hasNext() && !foundEndProperty) {
final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
+ if (event.isStartElement()) {
if (edmType instanceof EdmPrimitiveType) {
values.add(primitive(reader, event.asStartElement(), edmType, isNullable,
- maxLength, precision, scale, isUnicode));
+ maxLength, precision, scale, isUnicode));
} else if (edmType instanceof EdmComplexType) {
- values.add(complex(reader, event.asStartElement(), (EdmComplexType) edmType));
+ values.add(complex(reader, event.asStartElement(), (EdmComplexType) edmType));
}
// do not add null or empty values
}
@@ -203,7 +203,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final Attribute nullAttr = start.getAttributeByName(nullQName);
if (nullAttr != null) {
- //found null
+ // found null
boolean foundEndProperty = false;
while (reader.hasNext() && !foundEndProperty) {
final XMLEvent event = reader.nextEvent();
@@ -211,7 +211,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
foundEndProperty = true;
}
}
- valuable.setValue(getValueType(edmType, false), null);
+ valuable.setValue(getValueType(edmType, false), null);
return;
}
@@ -221,23 +221,23 @@ public class ODataXmlDeserializer implements ODataDeserializer {
collection(valuable, reader, start, edmType, isNullable, maxLength, precision, scale, isUnicode);
} else if (edmType instanceof EdmPrimitiveType) {
valuable.setValue(getValueType(edmType, false),
- primitive(reader, start, edmType, isNullable, maxLength, precision, scale, isUnicode));
+ primitive(reader, start, edmType, isNullable, maxLength, precision, scale, isUnicode));
} else if (edmType instanceof EdmComplexType) {
valuable.setValue(ValueType.COMPLEX, complex(reader, start, (EdmComplexType) edmType));
} else if (edmType instanceof EdmEntityType) {
valuable.setValue(ValueType.ENTITY, entity(reader, start, (EdmEntityType) edmType));
}
- // do not add null or empty values
+ // do not add null or empty values
}
@Override
- public DeserializerResult property(InputStream input, EdmProperty edmProperty)
+ public DeserializerResult property(InputStream input, EdmProperty edmProperty)
throws DeserializerException {
try {
final XMLEventReader reader = getReader(input);
final StartElement start = skipBeforeFirstStartElement(reader);
- Property property = property(reader, start,
- edmProperty.getType(),
+ Property property = property(reader, start,
+ edmProperty.getType(),
edmProperty.isNullable(),
edmProperty.getMaxLength(),
edmProperty.getPrecision(),
@@ -249,8 +249,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
} catch (XMLStreamException e) {
throw new DeserializerException(e.getMessage(), e, DeserializerException.MessageKeys.IO_EXCEPTION);
} catch (final EdmPrimitiveTypeException e) {
- throw new DeserializerException(e.getMessage(), e,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
}
}
@@ -286,8 +286,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
}
- private void inline(final XMLEventReader reader, final StartElement start, final Link link,
- final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
+ private void inline(final XMLEventReader reader, final StartElement start, final Link link,
+ final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
DeserializerException {
boolean foundEndElement = false;
@@ -301,35 +301,35 @@ public class ODataXmlDeserializer implements ODataDeserializer {
if (inline != null) {
if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
if (navigationProperty.isCollection()) {
- throw new DeserializerException( "Navigation Property "+ link.getTitle() +
+ throw new DeserializerException("Navigation Property " + link.getTitle() +
" must be collection entities",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
}
-
+
link.setInlineEntity(entity(reader, inline, navigationProperty.getType()));
}
if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
if (!navigationProperty.isCollection()) {
- throw new DeserializerException("Navigation Property " + link.getTitle() +
+ throw new DeserializerException("Navigation Property " + link.getTitle() +
" must be single entity",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
- }
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
link.setInlineEntitySet(entitySet(reader, inline, navigationProperty.getType()));
}
}
} else if (entryRefQName.equals(event.asStartElement().getName())) {
if (navigationProperty.isCollection()) {
- throw new DeserializerException("Binding annotation: " + link.getTitle() +
+ throw new DeserializerException("Binding annotation: " + link.getTitle() +
" must be collection of entity references",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
- }
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
link.setBindingLink(entityRef(reader, event.asStartElement()));
link.setType(Constants.ENTITY_BINDING_LINK_TYPE);
} else if (Constants.QNAME_ATOM_ELEM_FEED.equals(event.asStartElement().getName())) {
if (navigationProperty.isCollection()) {
- throw new DeserializerException("Binding annotation: " + link.getTitle() +
+ throw new DeserializerException("Binding annotation: " + link.getTitle() +
" must be single entity references",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
}
link.setBindingLinks(entityRefCollection(reader, event.asStartElement()));
link.setType(Constants.ENTITY_COLLECTION_BINDING_LINK_TYPE);
@@ -342,17 +342,17 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
}
- private List<String> entityRefCollection(XMLEventReader reader, StartElement start)
+ private List<String> entityRefCollection(XMLEventReader reader, StartElement start)
throws XMLStreamException {
boolean foundEndElement = false;
ArrayList<String> references = new ArrayList<String>();
while (reader.hasNext() && !foundEndElement) {
final XMLEvent event = reader.nextEvent();
-
+
if (event.isStartElement() && entryRefQName.equals(event.asStartElement().getName())) {
- references.add(entityRef(reader, event.asStartElement()));
+ references.add(entityRef(reader, event.asStartElement()));
}
-
+
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
foundEndElement = true;
}
@@ -386,7 +386,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
return null;
}
- private void properties(final XMLEventReader reader, final StartElement start, final Entity entity,
+ private void properties(final XMLEventReader reader, final StartElement start, final Entity entity,
final EdmEntityType edmEntityType)
throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
@@ -395,10 +395,14 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
- EdmProperty edmProperty = (EdmProperty)edmEntityType
- .getProperty(event.asStartElement().getName().getLocalPart());
- entity.getProperties().add(property(reader, event.asStartElement(),
- edmProperty.getType(),
+ String propertyName = event.asStartElement().getName().getLocalPart();
+ EdmProperty edmProperty = (EdmProperty) edmEntityType.getProperty(propertyName);
+ if (edmProperty == null) {
+ throw new DeserializerException("Invalid Property in payload with name: " + propertyName,
+ DeserializerException.MessageKeys.UNKNOWN_CONTENT, propertyName);
+ }
+ entity.getProperties().add(property(reader, event.asStartElement(),
+ edmProperty.getType(),
edmProperty.isNullable(),
edmProperty.getMaxLength(),
edmProperty.getPrecision(),
@@ -480,7 +484,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
if (mediaETag != null) {
entity.setMediaETag(mediaETag.getValue());
}
- } else if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
+ } else if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
inline(reader, event.asStartElement(), link, edmEntityType);
if (link.getInlineEntity() == null && link.getInlineEntitySet() == null) {
entity.getNavigationBindings().add(link);
@@ -488,8 +492,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
if (link.getInlineEntitySet() != null) {
List<String> bindings = new ArrayList<String>();
List<Entity> entities = link.getInlineEntitySet().getEntities();
-
- for (Entity inlineEntity:entities) {
+
+ for (Entity inlineEntity : entities) {
// check if this is reference
if (inlineEntity.getId() != null && inlineEntity.getProperties().isEmpty()) {
bindings.add(inlineEntity.getId().toASCIIString());
@@ -501,11 +505,11 @@ public class ODataXmlDeserializer implements ODataDeserializer {
entity.getNavigationBindings().add(link);
} else {
entity.getNavigationLinks().add(link);
- }
+ }
} else {
// add link
- entity.getNavigationLinks().add(link);
- }
+ entity.getNavigationLinks().add(link);
+ }
}
} else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
entity.getAssociationLinks().add(link);
@@ -543,7 +547,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
@Override
- public DeserializerResult entity(InputStream input, EdmEntityType edmEntityType)
+ public DeserializerResult entity(InputStream input, EdmEntityType edmEntityType)
throws DeserializerException {
try {
final XMLEventReader reader = getReader(input);
@@ -551,14 +555,14 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final Entity entity = entity(reader, start, edmEntityType);
if (entity == null) {
throw new DeserializerException("No entity found!", DeserializerException.MessageKeys.INVALID_ENTITY);
- }
+ }
return DeserializerResultImpl.with().entity(entity)
- .build();
+ .build();
} catch (XMLStreamException e) {
- throw new DeserializerException(e.getMessage(), e,
+ throw new DeserializerException(e.getMessage(), e,
DeserializerException.MessageKeys.IO_EXCEPTION);
} catch (final EdmPrimitiveTypeException e) {
- throw new DeserializerException(e.getMessage(), e,
+ throw new DeserializerException(e.getMessage(), e,
DeserializerException.MessageKeys.INVALID_ENTITY);
}
}
@@ -579,7 +583,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
private EntityCollection entitySet(final XMLEventReader reader, final StartElement start,
- final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
+ final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
DeserializerException {
if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
return null;
@@ -635,8 +639,8 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final XMLEventReader reader = getReader(input);
final StartElement start = skipBeforeFirstStartElement(reader);
EntityCollection entityCollection = entitySet(reader, start, edmEntityType);
- if(entityCollection != null) {
- for (Entity entity: entityCollection.getEntities()) {
+ if (entityCollection != null) {
+ for (Entity entity : entityCollection.getEntities()) {
entity.setType(edmEntityType.getFullQualifiedName().getFullQualifiedNameAsString());
}
}
@@ -644,11 +648,11 @@ public class ODataXmlDeserializer implements ODataDeserializer {
} catch (final XMLStreamException e) {
throw new DeserializerException(e.getMessage(), e, DeserializerException.MessageKeys.IO_EXCEPTION);
} catch (final EdmPrimitiveTypeException e) {
- throw new DeserializerException(e.getMessage(), e,
+ throw new DeserializerException(e.getMessage(), e,
DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
}
}
-
+
@Override
public DeserializerResult entityReferences(InputStream stream) throws DeserializerException {
try {
@@ -673,7 +677,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
}
@Override
- public DeserializerResult actionParameters(InputStream stream, EdmAction edmAction)
+ public DeserializerResult actionParameters(InputStream stream, EdmAction edmAction)
throws DeserializerException {
Map<String, Parameter> parameters = new LinkedHashMap<String, Parameter>();
if (edmAction.getParameterNames() == null || edmAction.getParameterNames().isEmpty()
@@ -682,13 +686,13 @@ public class ODataXmlDeserializer implements ODataDeserializer {
.build();
}
- try {
+ try {
final XMLEventReader reader = getReader(stream);
while (reader.hasNext()) {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement() && parametersQName.equals(event.asStartElement().getName())) {
consumeParameters(edmAction, reader, event.asStartElement(), parameters);
- }
+ }
}
// EDM checks.
for (final String param : edmAction.getParameterNames()) {
@@ -715,53 +719,53 @@ public class ODataXmlDeserializer implements ODataDeserializer {
} catch (XMLStreamException e) {
throw new DeserializerException(e.getMessage(), e, DeserializerException.MessageKeys.IO_EXCEPTION);
} catch (final EdmPrimitiveTypeException e) {
- throw new DeserializerException(e.getMessage(), e,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
}
}
- private void consumeParameters(EdmAction edmAction, XMLEventReader reader,
- StartElement start, Map<String, Parameter> parameters) throws DeserializerException,
+ private void consumeParameters(EdmAction edmAction, XMLEventReader reader,
+ StartElement start, Map<String, Parameter> parameters) throws DeserializerException,
EdmPrimitiveTypeException, XMLStreamException {
-
+
List<String> parameterNames = edmAction.getParameterNames();
if (edmAction.isBound()) {
// The binding parameter must not occur in the payload.
parameterNames = parameterNames.subList(1, parameterNames.size());
}
-
- boolean foundEndElement = false;
+
+ boolean foundEndElement = false;
while (reader.hasNext() && !foundEndElement) {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
boolean found = false;
- for(String paramName:parameterNames) {
- if(paramName.equals(event.asStartElement().getName().getLocalPart())) {
+ for (String paramName : parameterNames) {
+ if (paramName.equals(event.asStartElement().getName().getLocalPart())) {
found = true;
- Parameter parameter = createParameter(reader, event.asStartElement(), paramName,
+ Parameter parameter = createParameter(reader, event.asStartElement(), paramName,
edmAction.getParameter(paramName));
Parameter previous = parameters.put(paramName, parameter);
if (previous != null) {
- throw new DeserializerException("Duplicate property detected",
- DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
+ throw new DeserializerException("Duplicate property detected",
+ DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
}
- break; //for
+ break; // for
}
}
if (!found) {
throw new DeserializerException("failed to read " + event.asStartElement().getName().getLocalPart(),
- DeserializerException.MessageKeys.UNKNOWN_CONTENT);
+ DeserializerException.MessageKeys.UNKNOWN_CONTENT);
}
- }
+ }
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
foundEndElement = true;
- }
- }
+ }
+ }
}
- private Parameter createParameter(XMLEventReader reader, StartElement start, String paramName,
+ private Parameter createParameter(XMLEventReader reader, StartElement start, String paramName,
EdmParameter edmParameter) throws DeserializerException, EdmPrimitiveTypeException, XMLStreamException {
-
+
Parameter parameter = new Parameter();
parameter.setName(paramName);
switch (edmParameter.getType().getKind()) {
@@ -769,14 +773,14 @@ public class ODataXmlDeserializer implements ODataDeserializer {
case ENUM:
case DEFINITION:
case COMPLEX:
- Property property = property(reader, start,
- edmParameter.getType(),
- edmParameter.isNullable(),
- edmParameter.getMaxLength(),
- edmParameter.getPrecision(),
- edmParameter.getScale(),
- true,
- edmParameter.isCollection());
+ Property property = property(reader, start,
+ edmParameter.getType(),
+ edmParameter.isNullable(),
+ edmParameter.getMaxLength(),
+ edmParameter.getPrecision(),
+ edmParameter.getScale(),
+ true,
+ edmParameter.isCollection());
parameter.setValue(property.getValueType(), property.getValue());
break;
case ENTITY:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 1ddc979..b5a2c6a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@ -391,7 +391,12 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
throw new SerializerException("Non-nullable property not present!",
SerializerException.MessageKeys.MISSING_PROPERTY, edmProperty.getName());
} else {
- json.writeNull();
+ if(edmProperty.isCollection()){
+ json.writeStartArray();
+ json.writeEndArray();
+ }else {
+ json.writeNull();
+ }
}
} else {
writePropertyValue(edmProperty, property, selectedPaths, json);
[3/5] olingo-odata4 git commit: [OLINGO-821] Verify Enum and TypeDef
support
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
index b5da9ae..7761b1d 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -301,15 +301,68 @@ public class ODataJsonSerializerTest {
final String expectedResult = "{\"@odata.context\":\"$metadata#ESMixPrimCollComp/$entity\","
+ "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":null,\"PropertyComp\":null,\"CollPropertyComp\":null}";
+ + "\"CollPropertyString\":[],\"PropertyComp\":null,\"CollPropertyComp\":[]}";
Assert.assertEquals(expectedResult, resultString);
}
@Test
+ public void nullCollectionButInDataMap() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixEnumDefCollComp");
+ Entity entity = new Entity();
+ entity.addProperty(new Property(null, "PropertyEnumString", ValueType.ENUM, 6));
+ entity.addProperty(new Property(null, "CollPropertyEnumString", ValueType.COLLECTION_ENUM, null));
+ entity.addProperty(new Property(null, "PropertyDefString", ValueType.PRIMITIVE, "Test"));
+ entity.addProperty(new Property(null, "CollPropertyDefString", ValueType.COLLECTION_PRIMITIVE, null));
+ ComplexValue complexValue = new ComplexValue();
+ complexValue.getValue().add(entity.getProperty("PropertyEnumString"));
+ complexValue.getValue().add(entity.getProperty("CollPropertyEnumString"));
+ complexValue.getValue().add(entity.getProperty("PropertyDefString"));
+ complexValue.getValue().add(entity.getProperty("CollPropertyDefString"));
+ entity.addProperty(new Property(null, "PropertyCompMixedEnumDef", ValueType.COMPLEX, complexValue));
+ entity.addProperty(new Property(null, "CollPropertyCompMixedEnumDef", ValueType.COLLECTION_COMPLEX, null));
+ final String resultString = IOUtils.toString(serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent());
+ Assert.assertEquals("{\"@odata.context\":\"$metadata#ESMixEnumDefCollComp/$entity\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"PropertyEnumString\":\"String2,String3\","
+ + "\"CollPropertyEnumString\":[],"
+ + "\"PropertyDefString\":\"Test\","
+ + "\"CollPropertyDefString\":[],"
+ + "\"PropertyCompMixedEnumDef\":{\"PropertyEnumString\":\"String2,String3\","
+ + "\"CollPropertyEnumString\":[],"
+ + "\"PropertyDefString\":\"Test\",\"CollPropertyDefString\":[]},"
+ + "\"CollPropertyCompMixedEnumDef\":[]}",
+ resultString);
+ }
+
+ @Test
+ public void nullComplexValueButInDataMapAndNullCollectionsNotInDataMap() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixEnumDefCollComp");
+ Entity entity = new Entity();
+ entity.addProperty(new Property(null, "PropertyEnumString", ValueType.ENUM, 6));
+ entity.addProperty(new Property(null, "PropertyDefString", ValueType.PRIMITIVE, "Test"));
+ entity.addProperty(new Property(null, "PropertyCompMixedEnumDef", ValueType.COMPLEX, null));
+ final String resultString = IOUtils.toString(serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent());
+ Assert.assertEquals("{\"@odata.context\":\"$metadata#ESMixEnumDefCollComp/$entity\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"PropertyEnumString\":\"String2,String3\","
+ + "\"CollPropertyEnumString\":[],"
+ + "\"PropertyDefString\":\"Test\","
+ + "\"CollPropertyDefString\":[],"
+ + "\"PropertyCompMixedEnumDef\":null,"
+ + "\"CollPropertyCompMixedEnumDef\":[]}",
+ resultString);
+ }
+
+ @Test
public void enumAndTypeDefinition() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixEnumDefCollComp");
Entity entity = new Entity();
- entity.addProperty(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 1));
entity.addProperty(new Property(null, "PropertyEnumString", ValueType.ENUM, 6));
entity.addProperty(new Property(null, "CollPropertyEnumString", ValueType.COLLECTION_ENUM,
Arrays.asList(2, 4, 6)));
@@ -330,7 +383,6 @@ public class ODataJsonSerializerTest {
.build()).getContent());
Assert.assertEquals("{\"@odata.context\":\"$metadata#ESMixEnumDefCollComp/$entity\","
+ "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
- + "\"PropertyInt16\":1,"
+ "\"PropertyEnumString\":\"String2,String3\","
+ "\"CollPropertyEnumString\":[\"String2\",\"String3\",\"String2,String3\"],"
+ "\"PropertyDefString\":\"Test\","
@@ -431,7 +483,7 @@ public class ODataJsonSerializerTest {
+ "\"CollPropertyBoolean\":[true,null,false],\"CollPropertyByte\":[50,null,249],"
+ "\"CollPropertySByte\":[-120,null,126],\"CollPropertyInt16\":[1000,null,30112],"
+ "\"CollPropertyInt32\":[23232323,null,10000001],\"CollPropertyInt64\":[929292929292,null,444444444444],"
- + "\"CollPropertySingle\":[1790.0,null,3210.0],\"CollPropertyDouble\":[-17900.0,null,3210.0],"
+ + "\"CollPropertySingle\":[1790.0,null,3210.0],\"CollPropertyDouble\":[-17900.0,null,3210.0],"
+ "\"CollPropertyDecimal\":"
+ "[12,null,1234],\"CollPropertyBinary\":[\"q83v\",null,\"VGeJ\"],\"CollPropertyDate\":"
+ "[\"1958-12-03\",null,\"2013-06-25\"],\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",null,"
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
index 2e8ea14..9611500 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
@@ -561,7 +561,6 @@ public class ODataXmlSerializerTest {
public void enumAndTypeDefinition() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixEnumDefCollComp");
Entity entity = new Entity();
- entity.addProperty(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 1));
entity.addProperty(new Property(null, "PropertyEnumString", ValueType.ENUM, 6));
entity.addProperty(new Property(null, "CollPropertyEnumString", ValueType.COLLECTION_ENUM,
Arrays.asList(2, 4, 6)));
@@ -593,7 +592,6 @@ public class ODataXmlSerializerTest {
+ " term=\"#olingo.odata.test1.ETMixEnumDefCollComp\" />\n"
+ " <a:content type=\"application/xml\">\n"
+ " <m:properties>\n"
- + " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n"
+ " <d:PropertyEnumString m:type=\"#olingo.odata.test1.ENString\">String2,String3"
+ "</d:PropertyEnumString>\n"
+ " <d:CollPropertyEnumString m:type=\"#Collection(olingo.odata.test1.ENString)\">\n"
[4/5] olingo-odata4 git commit: [OLINGO-821] Verify Enum and TypeDef
support
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
index ccc7de5..5c60b38 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
@@ -74,6 +74,7 @@ public class DataCreator {
data.put("ESFourKeyAlias", createESFourKeyAlias(edm, odata));
data.put("ESBase", createESBase(edm, odata));
data.put("ESCompMixPrimCollComp", createESCompMixPrimCollComp(edm, odata));
+ data.put("ESMixEnumDefCollComp", createESMixEnumDefCollComp(edm, odata));
linkESTwoPrim(data);
linkESAllPrim(data);
@@ -81,62 +82,83 @@ public class DataCreator {
linkESTwoKeyNav(data);
}
+ private EntityCollection createESMixEnumDefCollComp(Edm edm, OData odata) {
+ final EntityCollection entityCollection = new EntityCollection();
+
+ entityCollection.getEntities().add(createETMixEnumDefCollComp("key1", (short) 1));
+ entityCollection.getEntities().add(createETMixEnumDefCollComp("key1", (short) 3));
+ entityCollection.getEntities().add(createETMixEnumDefCollComp("key1", (short) 4));
+
+ setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETMixEnumDefCollComp));
+ createEntityId(edm, odata, "ESMixEnumDefCollComp", entityCollection);
+
+ return entityCollection;
+ }
+
+ private Entity createETMixEnumDefCollComp(String typeDefString, Short enumValue) {
+ return new Entity()
+ .addProperty(createPrimitive("PropertyEnumString", enumValue))
+ .addProperty(createPrimitive("PropertyDefString", typeDefString))
+ .addProperty(createPrimitiveCollection("CollPropertyEnumString", enumValue))
+ .addProperty(createPrimitiveCollection("CollPropertyDefString", typeDefString));
+ }
+
private EntityCollection createESCompMixPrimCollComp(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
-
+
entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 1));
entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 2));
entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 3));
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETCompMixPrimCollComp));
createEntityId(edm, odata, "ESCompMixPrimCollComp", entityCollection);
-
+
return entityCollection;
}
@SuppressWarnings("unchecked")
private Entity createETCompMixPrimCollComp(final Short propertyInt16) {
return new Entity()
- .addProperty(createPrimitive("PropertyInt16", propertyInt16))
- .addProperty(createComplex("PropertyMixedPrimCollComp",
- createPrimitive("PropertyInt16",(short) 1),
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"
- ),
- createComplex("PropertyComp",
- createPrimitive("PropertyInt16",(short) 333),
- createPrimitive("PropertyString", "TEST123")
- ),
- createComplexCollection("CollPropertyComp",
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16",(short) 222),
- createPrimitive("PropertyString", "TEST9876")
- }),
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16",(short) 333),
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ .addProperty(createComplex("PropertyMixedPrimCollComp",
+ createPrimitive("PropertyInt16", (short) 1),
+ createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"
+ ),
+ createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 333),
createPrimitive("PropertyString", "TEST123")
- })
- )
- ));
+ ),
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(new Property[] {
+ createPrimitive("PropertyInt16", (short) 222),
+ createPrimitive("PropertyString", "TEST9876")
+ }),
+ Arrays.asList(new Property[] {
+ createPrimitive("PropertyInt16", (short) 333),
+ createPrimitive("PropertyString", "TEST123")
+ })
+ )
+ ));
}
private EntityCollection createESBase(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
-
+
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 111))
+ .addProperty(createPrimitive("PropertyInt16", (short) 111))
.addProperty(createPrimitive("PropertyString", "TEST A"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815")));
-
+
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 222))
+ .addProperty(createPrimitive("PropertyInt16", (short) 222))
.addProperty(createPrimitive("PropertyString", "TEST B"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815")));
-
+
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 333))
+ .addProperty(createPrimitive("PropertyInt16", (short) 333))
.addProperty(createPrimitive("PropertyString", "TEST C"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815")));
@@ -148,21 +170,21 @@ public class DataCreator {
private EntityCollection createESFourKeyAlias(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
-
+
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 1))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyInt16",(short) 11),
- createPrimitive("PropertyString", "Num11")
- ))
- .addProperty(createComplex("PropertyCompComp",
- createComplex("PropertyComp",
- createPrimitive("PropertyInt16",(short) 111),
- createPrimitive("PropertyString", "Num111")
- )
- ))
- );
-
+ .addProperty(createPrimitive("PropertyInt16", (short) 1))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 11),
+ createPrimitive("PropertyString", "Num11")
+ ))
+ .addProperty(createComplex("PropertyCompComp",
+ createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 111),
+ createPrimitive("PropertyString", "Num111")
+ )
+ ))
+ );
+
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETFourKeyAlias));
createEntityId(edm, odata, "ESFourKeyAlias", entityCollection);
@@ -171,114 +193,114 @@ public class DataCreator {
private EntityCollection createESCompCollAllPrim(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
-
+
entityCollection.getEntities().add(createETCompCollAllPrim((short) 5678));
entityCollection.getEntities().add(createETCompCollAllPrim((short) 12326));
-
+
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETCompCollAllPrim));
createEntityId(edm, odata, "ESCompCollAllPrim", entityCollection);
return entityCollection;
}
private Entity createETCompCollAllPrim(short propertyInt16) {
- return new Entity()
- .addProperty(createPrimitive("PropertyInt16", propertyInt16))
- .addProperty(createComplex("PropertyComp",
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"),
- createPrimitiveCollection("CollPropertyBoolean",
- true,
- false,
- true),
- createPrimitiveCollection("CollPropertyByte",
- (short) 50,
- (short) 200,
- (short) 249),
- createPrimitiveCollection("CollPropertySByte",
- (byte) -120,
- (byte) 120,
- (byte) 126),
- createPrimitiveCollection("CollPropertyInt16",
- (short) 1000,
- (short) 2000,
- (short) 30112),
- createPrimitiveCollection("CollPropertyInt32",
- 23232323,
- 11223355,
- 10000001),
- createPrimitiveCollection("CollPropertyInt64",
- 929292929292L,
- 333333333333L,
- 444444444444L),
- createPrimitiveCollection("CollPropertySingle",
- (float) 1790,
- (float) 26600,
- (float) 3210),
- createPrimitiveCollection("CollPropertyDouble",
- -17900D,
- -27800000D,
- 3210D),
- createPrimitiveCollection("CollPropertyDecimal",
- BigDecimal.valueOf(12),
- BigDecimal.valueOf(-2),
- BigDecimal.valueOf(1234)),
- createPrimitiveCollection("CollPropertyByte",
- (short) 50,
- (short) 200,
- (short) 249),
- createPrimitiveCollection("CollPropertyBinary",
- new byte[] { -85, -51, -17 },
- new byte[] { 1, 35, 69 },
- new byte[] { 84, 103, -119 }
- ),
- createPrimitiveCollection("CollPropertyDate",
- getDateTime(1958, 12, 3, 0, 0, 0),
- getDateTime(1999, 8, 5, 0, 0, 0),
- getDateTime(2013, 6, 25, 0, 0, 0)
- ),
- createPrimitiveCollection("CollPropertyDateTimeOffset",
- getDateTime(2015, 8, 12, 3, 8, 34),
- getDateTime(1970, 3, 28, 12, 11, 10),
- getDateTime(1948, 2, 17, 9, 9, 9)
- ),
- createPrimitiveCollection("CollPropertyDuration",
- getDuration(0, 0, 0, 13),
- getDuration(0, 5, 28, 20),
- getDuration(0, 1, 0, 0)
- ),
- createPrimitiveCollection("CollPropertyGuid",
- UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
- UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
- UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")
- ),
- createPrimitiveCollection("CollPropertyTimeOfDay",
- getTime(4, 14, 13),
- getTime(23, 59, 59),
- getTime(1, 12, 33)
- )
- ));
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"),
+ createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ false,
+ true),
+ createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249),
+ createPrimitiveCollection("CollPropertySByte",
+ (byte) -120,
+ (byte) 120,
+ (byte) 126),
+ createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
+ (short) 30112),
+ createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ 11223355,
+ 10000001),
+ createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ 333333333333L,
+ 444444444444L),
+ createPrimitiveCollection("CollPropertySingle",
+ (float) 1790,
+ (float) 26600,
+ (float) 3210),
+ createPrimitiveCollection("CollPropertyDouble",
+ -17900D,
+ -27800000D,
+ 3210D),
+ createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ BigDecimal.valueOf(-2),
+ BigDecimal.valueOf(1234)),
+ createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249),
+ createPrimitiveCollection("CollPropertyBinary",
+ new byte[] { -85, -51, -17 },
+ new byte[] { 1, 35, 69 },
+ new byte[] { 84, 103, -119 }
+ ),
+ createPrimitiveCollection("CollPropertyDate",
+ getDateTime(1958, 12, 3, 0, 0, 0),
+ getDateTime(1999, 8, 5, 0, 0, 0),
+ getDateTime(2013, 6, 25, 0, 0, 0)
+ ),
+ createPrimitiveCollection("CollPropertyDateTimeOffset",
+ getDateTime(2015, 8, 12, 3, 8, 34),
+ getDateTime(1970, 3, 28, 12, 11, 10),
+ getDateTime(1948, 2, 17, 9, 9, 9)
+ ),
+ createPrimitiveCollection("CollPropertyDuration",
+ getDuration(0, 0, 0, 13),
+ getDuration(0, 5, 28, 20),
+ getDuration(0, 1, 0, 0)
+ ),
+ createPrimitiveCollection("CollPropertyGuid",
+ UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
+ UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
+ UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")
+ ),
+ createPrimitiveCollection("CollPropertyTimeOfDay",
+ getTime(4, 14, 13),
+ getTime(23, 59, 59),
+ getTime(1, 12, 33)
+ )
+ ));
}
-
+
private EntityCollection createESBaseTwoKeyNav(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(
createESTwoKeyNavEntity((short) 1, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
-
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+
entityCollection.getEntities().add(
createESTwoKeyNavEntity((short) 1, "2")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
-
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+
entityCollection.getEntities().add(
createESTwoKeyNavEntity((short) 2, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
-
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+
entityCollection.getEntities().add(
createESTwoKeyNavEntity((short) 3, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
-
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav));
createEntityId(edm, odata, "ESBaseTwoKeyNav", entityCollection);
@@ -288,19 +310,19 @@ public class DataCreator {
private EntityCollection createESTwoBase(final Edm edm, final OData odata) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 111))
+ .addProperty(createPrimitive("PropertyInt16", (short) 111))
.addProperty(createPrimitive("PropertyString", "TEST A"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST B 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 222))
+ .addProperty(createPrimitive("PropertyInt16", (short) 222))
.addProperty(createPrimitive("PropertyString", "TEST B"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST D 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 333))
+ .addProperty(createPrimitive("PropertyInt16", (short) 333))
.addProperty(createPrimitive("PropertyString", "TEST C"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST F 0815")));
@@ -315,89 +337,89 @@ public class DataCreator {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(
new Entity()
- .addProperty(createPrimitive("PropertyKey",(short) 1))
- .addProperty(createPrimitive("PropertyInt16", null))
- .addProperty(createPrimitive("PropertyString", null))
- .addProperty(createPrimitive("PropertyBoolean", null))
- .addProperty(createPrimitive("PropertyByte", null))
- .addProperty(createPrimitive("PropertySByte", null))
- .addProperty(createPrimitive("PropertyInt32", null))
- .addProperty(createPrimitive("PropertyInt64", null))
- .addProperty(createPrimitive("PropertySingle", null))
- .addProperty(createPrimitive("PropertyDouble", null))
- .addProperty(createPrimitive("PropertyDecimal", null))
- .addProperty(createPrimitive("PropertyBinary", null))
- .addProperty(createPrimitive("PropertyDate", null))
- .addProperty(createPrimitive("PropertyDateTimeOffset", null))
- .addProperty(createPrimitive("PropertyDuration", null))
- .addProperty(createPrimitive("PropertyGuid", null))
- .addProperty(createPrimitive("PropertyTimeOfDay", null))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "spiderman@comic.com",
- null,
- "spidergirl@comic.com"))
- .addProperty(createPrimitiveCollection("CollPropertyBoolean",
- true,
- null,
- false))
- .addProperty(createPrimitiveCollection("CollPropertyByte",
- (short) 50,
- null,
- (short) 249))
- .addProperty(createPrimitiveCollection("CollPropertySByte",
- (byte) -120,
- null,
- (byte) 126))
- .addProperty(createPrimitiveCollection("CollPropertyInt16",
- (short) 1000,
- null,
- (short) 30112))
- .addProperty(createPrimitiveCollection("CollPropertyInt32",
- 23232323,
- null,
- 10000001))
- .addProperty(createPrimitiveCollection("CollPropertyInt64",
- 929292929292L,
- null,
- 444444444444L))
- .addProperty(createPrimitiveCollection("CollPropertySingle",
- (float) 1790,
- null,
- (float) 3210))
- .addProperty(createPrimitiveCollection("CollPropertyDouble",
- -17900D,
- null,
- 3210D))
- .addProperty(createPrimitiveCollection("CollPropertyDecimal",
- BigDecimal.valueOf(12),
- null,
- BigDecimal.valueOf(1234)))
- .addProperty(createPrimitiveCollection("CollPropertyBinary",
- new byte[] { -85, -51, -17 },
- null,
- new byte[] { 84, 103, -119 } ))
- .addProperty(createPrimitiveCollection("CollPropertyDate",
- getDateTime(1958, 12, 3, 0, 0, 0),
- null,
- getDateTime(2013, 6, 25, 0, 0, 0)))
- .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
- getDateTime(2015, 8, 12, 3, 8, 34),
- null,
- getDateTime(1948, 2, 17, 9, 9, 9)))
- .addProperty(createPrimitiveCollection("CollPropertyDuration",
- getDuration(0, 0, 0, 13),
- null,
- getDuration(0, 1, 0, 0)))
- .addProperty(createPrimitiveCollection("CollPropertyGuid",
- UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
- null,
- UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
- .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
- getTime(4, 14, 13),
- null,
- getTime(0, 37, 13))
- ));
-
+ .addProperty(createPrimitive("PropertyKey", (short) 1))
+ .addProperty(createPrimitive("PropertyInt16", null))
+ .addProperty(createPrimitive("PropertyString", null))
+ .addProperty(createPrimitive("PropertyBoolean", null))
+ .addProperty(createPrimitive("PropertyByte", null))
+ .addProperty(createPrimitive("PropertySByte", null))
+ .addProperty(createPrimitive("PropertyInt32", null))
+ .addProperty(createPrimitive("PropertyInt64", null))
+ .addProperty(createPrimitive("PropertySingle", null))
+ .addProperty(createPrimitive("PropertyDouble", null))
+ .addProperty(createPrimitive("PropertyDecimal", null))
+ .addProperty(createPrimitive("PropertyBinary", null))
+ .addProperty(createPrimitive("PropertyDate", null))
+ .addProperty(createPrimitive("PropertyDateTimeOffset", null))
+ .addProperty(createPrimitive("PropertyDuration", null))
+ .addProperty(createPrimitive("PropertyGuid", null))
+ .addProperty(createPrimitive("PropertyTimeOfDay", null))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "spiderman@comic.com",
+ null,
+ "spidergirl@comic.com"))
+ .addProperty(createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ null,
+ false))
+ .addProperty(createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ null,
+ (short) 249))
+ .addProperty(createPrimitiveCollection("CollPropertySByte",
+ (byte) -120,
+ null,
+ (byte) 126))
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ null,
+ (short) 30112))
+ .addProperty(createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ null,
+ 10000001))
+ .addProperty(createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ null,
+ 444444444444L))
+ .addProperty(createPrimitiveCollection("CollPropertySingle",
+ (float) 1790,
+ null,
+ (float) 3210))
+ .addProperty(createPrimitiveCollection("CollPropertyDouble",
+ -17900D,
+ null,
+ 3210D))
+ .addProperty(createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ null,
+ BigDecimal.valueOf(1234)))
+ .addProperty(createPrimitiveCollection("CollPropertyBinary",
+ new byte[] { -85, -51, -17 },
+ null,
+ new byte[] { 84, 103, -119 }))
+ .addProperty(createPrimitiveCollection("CollPropertyDate",
+ getDateTime(1958, 12, 3, 0, 0, 0),
+ null,
+ getDateTime(2013, 6, 25, 0, 0, 0)))
+ .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
+ getDateTime(2015, 8, 12, 3, 8, 34),
+ null,
+ getDateTime(1948, 2, 17, 9, 9, 9)))
+ .addProperty(createPrimitiveCollection("CollPropertyDuration",
+ getDuration(0, 0, 0, 13),
+ null,
+ getDuration(0, 1, 0, 0)))
+ .addProperty(createPrimitiveCollection("CollPropertyGuid",
+ UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
+ null,
+ UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
+ .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
+ getTime(4, 14, 13),
+ null,
+ getTime(0, 37, 13))
+ ));
+
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETAllNullable));
createEntityId(edm, odata, "ESAllNullable", entityCollection);
return entityCollection;
@@ -456,36 +478,36 @@ public class DataCreator {
@SuppressWarnings("unchecked")
private Entity createETKeyNavEntity(final short propertyInt16, final String propertyString) {
return new Entity()
- .addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createPrimitive("PropertyString", propertyString))
- .addProperty(createComplex("PropertyCompNav",
+ .addProperty(createComplex("PropertyCompNav",
createPrimitive("PropertyInt16", 1)))
.addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim"))
- .addProperty(createComplex("PropertyCompTwoPrim",
- createPrimitive("PropertyInt16",(short) 16),
+ .addProperty(createComplex("PropertyCompTwoPrim",
+ createPrimitive("PropertyInt16", (short) 16),
createPrimitive("PropertyString", "Test123")))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
"Employee2@company.example",
"Employee3@company.example"))
- .addProperty(createPrimitiveCollection("CollPropertyInt16",
- (short) 1000,
- (short) 2000,
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
(short) 30112))
.addProperty(createComplexCollection("CollPropertyComp",
Arrays.asList(
- createPrimitive("PropertyInt16",(short) 1),
+ createPrimitive("PropertyInt16", (short) 1),
createKeyNavAllPrimComplexValue("PropertyComp")),
Arrays.asList(
- createPrimitive("PropertyInt16",(short) 2),
+ createPrimitive("PropertyInt16", (short) 2),
createKeyNavAllPrimComplexValue("PropertyComp")),
Arrays.asList(
- createPrimitive("PropertyInt16",(short) 3),
+ createPrimitive("PropertyInt16", (short) 3),
createKeyNavAllPrimComplexValue("PropertyComp"))))
- .addProperty(createComplex("PropertyCompCompNav",
- createPrimitive("PropertyString", "1"),
- createComplex("PropertyCompNav",
- createPrimitive("PropertyInt16",(short) 1))));
+ .addProperty(createComplex("PropertyCompCompNav",
+ createPrimitive("PropertyString", "1"),
+ createComplex("PropertyCompNav",
+ createPrimitive("PropertyInt16", (short) 1))));
}
private EntityCollection createESTwoKeyNav(final Edm edm, final OData odata) {
@@ -507,50 +529,50 @@ public class DataCreator {
return new Entity()
.addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createPrimitive("PropertyString", propertyString))
- .addProperty(createComplex("PropertyComp",
+ .addProperty(createComplex("PropertyComp",
createPrimitive("PropertyInt16", 11),
- createComplex("PropertyComp",
+ createComplex("PropertyComp",
createPrimitive("PropertyString", "StringValue"),
createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }),
- createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyBoolean", true),
createPrimitive("PropertyByte", (short) 255),
createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
- createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)),
createPrimitive("PropertySingle", (float) 179000000000000000000D),
- createPrimitive("PropertyDouble", -179000000000000000000D),
+ createPrimitive("PropertyDouble", -179000000000000000000D),
createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
createPrimitive("PropertyInt16", Short.MAX_VALUE),
createPrimitive("PropertyInt32", Integer.MAX_VALUE),
- createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
createPrimitive("PropertySByte", Byte.MAX_VALUE),
createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)))))
- .addProperty(createComplex("PropertyCompNav",
+ .addProperty(createComplex("PropertyCompNav",
createPrimitive("PropertyInt16", (short) 1),
createKeyNavAllPrimComplexValue("PropertyComp")))
.addProperty(createComplexCollection("CollPropertyComp"))
- .addProperty(createComplexCollection("CollPropertyCompNav",
+ .addProperty(createComplexCollection("CollPropertyCompNav",
Arrays.asList(
createPrimitive("PropertyInt16", (short) 1))))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "1",
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "1",
"2"))
- .addProperty(createComplex("PropertyCompTwoPrim",
- createPrimitive("PropertyInt16", (short) 11),
+ .addProperty(createComplex("PropertyCompTwoPrim",
+ createPrimitive("PropertyInt16", (short) 11),
createPrimitive("PropertyString", "11")));
}
protected Property createKeyNavAllPrimComplexValue(final String name) {
- return createComplex(name,
+ return createComplex(name,
createPrimitive("PropertyString", "First Resource - positive values"),
createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }),
- createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyBoolean", true),
createPrimitive("PropertyByte", (short) 255),
createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 12, 3, 7, 16, 23, 0)),
- createPrimitive("PropertyDecimal", 34),
+ createPrimitive("PropertyDecimal", 34),
createPrimitive("PropertySingle", (float) 179000000000000000000D),
- createPrimitive("PropertyDouble", -179000000000000000000D),
+ createPrimitive("PropertyDouble", -179000000000000000000D),
createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
createPrimitive("PropertyInt16", Short.MAX_VALUE), createPrimitive("PropertyInt32", Integer.MAX_VALUE),
@@ -563,32 +585,32 @@ public class DataCreator {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createComplex("PropertyComp",
- createComplexCollection("CollPropertyComp",
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 555),
- createPrimitive("PropertyString", "1 Test Complex in Complex Property")),
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 666),
- createPrimitive("PropertyString", "2 Test Complex in Complex Property")),
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 777),
- createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createComplex("PropertyComp",
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 555),
+ createPrimitive("PropertyString", "1 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 666),
+ createPrimitive("PropertyString", "2 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 777),
+ createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 12345))
- .addProperty(createComplex("PropertyComp",
- createComplexCollection("CollPropertyComp",
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 888),
- createPrimitive("PropertyString", "11 Test Complex in Complex Property")),
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 999),
- createPrimitive("PropertyString", "12 Test Complex in Complex Property")),
- Arrays.asList(
- createPrimitive("PropertyInt16",(short) 0),
- createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
+ .addProperty(createPrimitive("PropertyInt16", 12345))
+ .addProperty(createComplex("PropertyComp",
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 888),
+ createPrimitive("PropertyString", "11 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 999),
+ createPrimitive("PropertyString", "12 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 0),
+ createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETCompCollComp));
createEntityId(edm, odata, "ESCompCollComp", entityCollection);
@@ -600,20 +622,20 @@ public class DataCreator {
EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 32766))
- .addProperty(createPrimitive("PropertyString", "Test String1")));
+ .addProperty(createPrimitive("PropertyInt16", (short) 32766))
+ .addProperty(createPrimitive("PropertyString", "Test String1")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) -365))
- .addProperty(createPrimitive("PropertyString", "Test String2")));
+ .addProperty(createPrimitive("PropertyInt16", (short) -365))
+ .addProperty(createPrimitive("PropertyString", "Test String2")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) -32766))
- .addProperty(createPrimitive("PropertyString", null)));
+ .addProperty(createPrimitive("PropertyInt16", (short) -32766))
+ .addProperty(createPrimitive("PropertyString", null)));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "Test String4")));
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyString", "Test String4")));
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETTwoPrim));
createEntityId(edm, odata, "ESTwoPrim", entityCollection);
@@ -630,26 +652,26 @@ public class DataCreator {
EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "First Resource - positive values"))
- .addProperty(createPrimitive("PropertyBoolean", true))
- .addProperty(createPrimitive("PropertyByte", (short) 255))
- .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
- .addProperty(createPrimitive("PropertySingle", (float) 1.79000000E+20))
- .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+19))
- .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)))
- .addProperty(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
- .addProperty(createPrimitive("PropertyGuid", GUID))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(3, 26, 5))));
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyString", "First Resource - positive values"))
+ .addProperty(createPrimitive("PropertyBoolean", true))
+ .addProperty(createPrimitive("PropertyByte", (short) 255))
+ .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
+ .addProperty(createPrimitive("PropertySingle", (float) 1.79000000E+20))
+ .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+19))
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)))
+ .addProperty(createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
+ .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
+ .addProperty(createPrimitive("PropertyGuid", GUID))
+ .addProperty(createPrimitive("PropertyTimeOfDay", getTime(3, 26, 5))));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE))
+ .addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE))
.addProperty(createPrimitive("PropertyString", "Second Resource - negative values"))
.addProperty(createPrimitive("PropertyBoolean", false))
.addProperty(createPrimitive("PropertyByte", (short) 0))
@@ -668,7 +690,7 @@ public class DataCreator {
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(23, 49, 14))));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 0))
+ .addProperty(createPrimitive("PropertyInt16", (short) 0))
.addProperty(createPrimitive("PropertyString", ""))
.addProperty(createPrimitive("PropertyBoolean", false))
.addProperty(createPrimitive("PropertyByte", (short) 0))
@@ -695,93 +717,93 @@ public class DataCreator {
EntityCollection entityCollection = new EntityCollection();
Entity entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyString", "First Resource - first"),
- createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true),
- createPrimitive("PropertyByte", (short) 255),
- createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)),
- createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)),
- createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
- createPrimitive("PropertySingle", (float) 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+19),
- createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
- createPrimitive("PropertyGuid", GUID),
- createPrimitive("PropertyInt16", Short.MAX_VALUE),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE),
- createPrimitive("PropertyInt64", Long.MAX_VALUE),
- createPrimitive("PropertySByte", Byte.MAX_VALUE),
- createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1))));
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "First Resource - first"),
+ createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
+ createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)),
+ createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
+ createPrimitive("PropertySingle", (float) 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+19),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", Short.MAX_VALUE),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1))));
entity.setETag("W/\"" + Short.MAX_VALUE + '\"');
entityCollection.getEntities().add(entity);
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16",(short) 7))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyString", "Second Resource - second"),
- createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true),
- createPrimitive("PropertyByte", (short) 255),
- createPrimitive("PropertyDate", getDateTime(2013, 11, 4, 0, 0, 0)),
- createPrimitive("PropertyDateTimeOffset", getDateTime(2013, 11, 4, 7, 16, 23)),
- createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
- createPrimitive("PropertySingle", (float) 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+02),
- createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
- createPrimitive("PropertyGuid", GUID),
- createPrimitive("PropertyInt16", (short) 25),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE),
- createPrimitive("PropertyInt64", Long.MAX_VALUE),
- createPrimitive("PropertySByte", Byte.MAX_VALUE),
- createPrimitive("PropertyTimeOfDay", getTimestamp(1, 1, 1, 7, 45, 12, 765432100))));
+ .addProperty(createPrimitive("PropertyInt16", (short) 7))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "Second Resource - second"),
+ createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
+ createPrimitive("PropertyDate", getDateTime(2013, 11, 4, 0, 0, 0)),
+ createPrimitive("PropertyDateTimeOffset", getDateTime(2013, 11, 4, 7, 16, 23)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
+ createPrimitive("PropertySingle", (float) 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+02),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", (short) 25),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTimestamp(1, 1, 1, 7, 45, 12, 765432100))));
entity.setETag("W/\"7\"");
entityCollection.getEntities().add(entity);
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 0))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyString", "Third Resource - third"),
- createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true),
- createPrimitive("PropertyByte", (short) 255),
- createPrimitive("PropertyDate", getDateTime(2014, 12, 5, 0, 0, 0)),
- createPrimitive("PropertyDateTimeOffset", getTimestamp(2014, 12, 5, 8, 17, 45, 123456700)),
- createPrimitive("PropertyDecimal", BigDecimal.valueOf(17.98)),
- createPrimitive("PropertySingle", 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+02),
- createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
- createPrimitive("PropertyGuid", GUID),
- createPrimitive("PropertyInt16", (short) -25),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE),
- createPrimitive("PropertyInt64", Long.MAX_VALUE),
- createPrimitive("PropertySByte", Byte.MAX_VALUE),
- createPrimitive("PropertyTimeOfDay", getTime(13, 27, 45))));
+ .addProperty(createPrimitive("PropertyInt16", (short) 0))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "Third Resource - third"),
+ createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
+ createPrimitive("PropertyDate", getDateTime(2014, 12, 5, 0, 0, 0)),
+ createPrimitive("PropertyDateTimeOffset", getTimestamp(2014, 12, 5, 8, 17, 45, 123456700)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(17.98)),
+ createPrimitive("PropertySingle", 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+02),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", (short) -25),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTime(13, 27, 45))));
entity.setETag("W/\"0\"");
entityCollection.getEntities().add(entity);
-
+
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) -32768))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyString", null),
- createPrimitive("PropertyBinary", null),
- createPrimitive("PropertyBoolean", null),
- createPrimitive("PropertyByte", null),
- createPrimitive("PropertyDate", null),
- createPrimitive("PropertyDateTimeOffset", null),
- createPrimitive("PropertyDecimal", null),
- createPrimitive("PropertySingle", null),
- createPrimitive("PropertyDouble", null),
- createPrimitive("PropertyDuration", null),
- createPrimitive("PropertyGuid", null),
- createPrimitive("PropertyInt16", null),
- createPrimitive("PropertyInt32", null),
- createPrimitive("PropertyInt64", null),
- createPrimitive("PropertySByte", null),
- createPrimitive("PropertyTimeOfDay", null)));
+ .addProperty(createPrimitive("PropertyInt16", (short) -32768))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", null),
+ createPrimitive("PropertyBinary", null),
+ createPrimitive("PropertyBoolean", null),
+ createPrimitive("PropertyByte", null),
+ createPrimitive("PropertyDate", null),
+ createPrimitive("PropertyDateTimeOffset", null),
+ createPrimitive("PropertyDecimal", null),
+ createPrimitive("PropertySingle", null),
+ createPrimitive("PropertyDouble", null),
+ createPrimitive("PropertyDuration", null),
+ createPrimitive("PropertyGuid", null),
+ createPrimitive("PropertyInt16", null),
+ createPrimitive("PropertyInt32", null),
+ createPrimitive("PropertyInt64", null),
+ createPrimitive("PropertySByte", null),
+ createPrimitive("PropertyTimeOfDay", null)));
entity.setETag("W/\"-32768\"");
entityCollection.getEntities().add(entity);
@@ -803,73 +825,73 @@ public class DataCreator {
return entityCollection;
}
-
+
private Entity createETCollAllPrim(final Short propertyInt16) {
- return new Entity()
- .addProperty(createPrimitive("PropertyInt16", propertyInt16))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"))
- .addProperty(createPrimitiveCollection("CollPropertyBoolean",
- true,
- false,
- true))
- .addProperty(createPrimitiveCollection("CollPropertyByte",
- (short) 50,
- (short) 200,
- (short) 249))
- .addProperty(createPrimitiveCollection("CollPropertySByte",
- -120,
- 120,
- 126))
- .addProperty(createPrimitiveCollection("CollPropertyInt16",
- (short) 1000,
- (short) 2000,
- (short) 30112))
- .addProperty(createPrimitiveCollection("CollPropertyInt32",
- 23232323,
- 11223355,
- 10000001))
- .addProperty(createPrimitiveCollection("CollPropertyInt64",
- 929292929292L,
- 333333333333L,
- 444444444444L))
- .addProperty(createPrimitiveCollection("CollPropertySingle",
- 1.79000000E+03,
- 2.66000000E+04,
- 3.21000000E+03))
- .addProperty(createPrimitiveCollection("CollPropertyDouble",
- -1.7900000000000000E+04,
- -2.7800000000000000E+07,
- 3.2100000000000000E+03))
- .addProperty(createPrimitiveCollection("CollPropertyDecimal",
- BigDecimal.valueOf(12),
- BigDecimal.valueOf(-2),
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ false,
+ true))
+ .addProperty(createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249))
+ .addProperty(createPrimitiveCollection("CollPropertySByte",
+ -120,
+ 120,
+ 126))
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
+ (short) 30112))
+ .addProperty(createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ 11223355,
+ 10000001))
+ .addProperty(createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ 333333333333L,
+ 444444444444L))
+ .addProperty(createPrimitiveCollection("CollPropertySingle",
+ 1.79000000E+03,
+ 2.66000000E+04,
+ 3.21000000E+03))
+ .addProperty(createPrimitiveCollection("CollPropertyDouble",
+ -1.7900000000000000E+04,
+ -2.7800000000000000E+07,
+ 3.2100000000000000E+03))
+ .addProperty(createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ BigDecimal.valueOf(-2),
BigDecimal.valueOf(1234)))
- .addProperty(createPrimitiveCollection("CollPropertyBinary",
- new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF },
- new byte[] { 0x01, 0x23, 0x45 },
+ .addProperty(createPrimitiveCollection("CollPropertyBinary",
+ new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF },
+ new byte[] { 0x01, 0x23, 0x45 },
new byte[] { 0x54, 0x67, (byte) 0x89 }))
- .addProperty(createPrimitiveCollection("CollPropertyDate",
- getDateTime(1958, 12, 3, 0, 0, 0),
- getDateTime(1999, 8, 5, 0, 0, 0),
+ .addProperty(createPrimitiveCollection("CollPropertyDate",
+ getDateTime(1958, 12, 3, 0, 0, 0),
+ getDateTime(1999, 8, 5, 0, 0, 0),
getDateTime(2013, 6, 25, 0, 0, 0)))
- .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
- getDateTime(2015, 8, 12, 3, 8, 34),
- getDateTime(1970, 3, 28, 12, 11, 10),
+ .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
+ getDateTime(2015, 8, 12, 3, 8, 34),
+ getDateTime(1970, 3, 28, 12, 11, 10),
getDateTime(1948, 2, 17, 9, 9, 9)))
- .addProperty(createPrimitiveCollection("CollPropertyDuration",
- BigDecimal.valueOf(13),
- BigDecimal.valueOf(19680),
- BigDecimal.valueOf(3600)))
- .addProperty(createPrimitiveCollection("CollPropertyGuid",
- UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
+ .addProperty(createPrimitiveCollection("CollPropertyDuration",
+ BigDecimal.valueOf(13),
+ BigDecimal.valueOf(19680),
+ BigDecimal.valueOf(3600)))
+ .addProperty(createPrimitiveCollection("CollPropertyGuid",
+ UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
- .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
- getTime(4, 14, 13),
- getTime(23, 59, 59),
+ .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
+ getTime(4, 14, 13),
+ getTime(23, 59, 59),
getTime(1, 12, 33)));
}
@@ -877,63 +899,63 @@ public class DataCreator {
EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
"Employee3@company.example"))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyInt16", (short) 111),
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 111),
createPrimitive("PropertyString", "TEST A")))
.addProperty(createColPropertyComp()));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 7))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyInt16", (short) 222),
- createPrimitive("PropertyString", "TEST B")))
- .addProperty(createColPropertyComp()));
+ .addProperty(createPrimitive("PropertyInt16", (short) 7))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 222),
+ createPrimitive("PropertyString", "TEST B")))
+ .addProperty(createColPropertyComp()));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short)0))
- .addProperty(createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"))
- .addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyInt16", (short) 333),
- createPrimitive("PropertyString", "TEST C")))
- .addProperty(createColPropertyComp()));
+ .addProperty(createPrimitive("PropertyInt16", (short) 0))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 333),
+ createPrimitive("PropertyString", "TEST C")))
+ .addProperty(createColPropertyComp()));
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETMixPrimCollComp));
createEntityId(edm, odata, "ESMixPrimCollComp", entityCollection);
-
+
return entityCollection;
}
-
- @SuppressWarnings("unchecked")
- private Property createColPropertyComp() {
- return createComplexCollection("CollPropertyComp",
- Arrays.asList(
- createPrimitive("PropertyInt16", (short) 123),
- createPrimitive("PropertyString", "TEST 1")),
- Arrays.asList(
- createPrimitive("PropertyInt16", (short) 456),
- createPrimitive("PropertyString", "TEST 2")),
- Arrays.asList(
- createPrimitive("PropertyInt16", (short) 789),
- createPrimitive("PropertyString", "TEST 3")));
- }
-
- private EntityCollection createESAllKey(final Edm edm, final OData odata) {
+
+ @SuppressWarnings("unchecked")
+ private Property createColPropertyComp() {
+ return createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 123),
+ createPrimitive("PropertyString", "TEST 1")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 456),
+ createPrimitive("PropertyString", "TEST 2")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 789),
+ createPrimitive("PropertyString", "TEST 3")));
+ }
+
+ private EntityCollection createESAllKey(final Edm edm, final OData odata) {
EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyString", "First"))
+ .addProperty(createPrimitive("PropertyString", "First"))
.addProperty(createPrimitive("PropertyBoolean", true))
.addProperty(createPrimitive("PropertyByte", (short) 255))
.addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
@@ -948,7 +970,7 @@ public class DataCreator {
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyString", "Second"))
+ .addProperty(createPrimitive("PropertyString", "Second"))
.addProperty(createPrimitive("PropertyBoolean", true))
.addProperty(createPrimitive("PropertyByte", (short) 254))
.addProperty(createPrimitive("PropertySByte", (byte) 124))
@@ -961,7 +983,7 @@ public class DataCreator {
.addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
.addProperty(createPrimitive("PropertyGuid", GUID))
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
-
+
setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETAllKey));
createEntityId(edm, odata, "ESAllKey", entityCollection);
@@ -974,7 +996,7 @@ public class DataCreator {
Entity entity = new Entity();
entity.addProperty(createPrimitive("PropertyInt16", (short) 1));
entity.addProperty(createComplex("PropertyComp",
- createComplex("PropertyComp",
+ createComplex("PropertyComp",
createPrimitive("PropertyInt16", (short) 123),
createPrimitive("PropertyString", "String 1"))));
entityCollection.getEntities().add(entity);
@@ -982,7 +1004,7 @@ public class DataCreator {
entity = new Entity();
entity.addProperty(createPrimitive("PropertyInt16", (short) 2));
entity.addProperty(createComplex("PropertyComp",
- createComplex("PropertyComp",
+ createComplex("PropertyComp",
createPrimitive("PropertyInt16", (short) 987),
createPrimitive("PropertyString", "String 2"))));
entityCollection.getEntities().add(entity);
@@ -997,32 +1019,32 @@ public class DataCreator {
EntityCollection entityCollection = new EntityCollection();
Entity entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 1))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
+ .addProperty(createPrimitive("PropertyInt16", (short) 1))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"1\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(1)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 2))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
+ .addProperty(createPrimitive("PropertyInt16", (short) 2))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"2\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(2)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 3))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
+ .addProperty(createPrimitive("PropertyInt16", (short) 3))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"3\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(3)/$value"));
entityCollection.getEntities().add(entity);
entity = new Entity()
- .addProperty(createPrimitive("PropertyInt16", (short) 4))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
+ .addProperty(createPrimitive("PropertyInt16", (short) 4))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"4\"");
entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(4)/$value"));
@@ -1045,8 +1067,8 @@ public class DataCreator {
final EntityCollection entityCollection = data.get("ESTwoPrim");
final List<Entity> targetEntities = data.get("ESAllPrim").getEntities();
- setLinks(entityCollection.getEntities().get(1), "NavPropertyETAllPrimMany", targetEntities.get(1),
- targetEntities.get(2));
+ setLinks(entityCollection.getEntities().get(1), "NavPropertyETAllPrimMany", targetEntities.get(1),
+ targetEntities.get(2));
setLink(entityCollection.getEntities().get(3), "NavPropertyETAllPrimOne", targetEntities.get(0));
}
@@ -1057,9 +1079,9 @@ public class DataCreator {
setLinks(entityCollection.getEntities().get(0), "NavPropertyETTwoPrimMany", targetEntities.get(1));
setLink(entityCollection.getEntities().get(0), "NavPropertyETTwoPrimOne", targetEntities.get(3));
- setLinks(entityCollection.getEntities().get(2), "NavPropertyETTwoPrimMany", targetEntities.get(0),
- targetEntities.get(2),
- targetEntities.get(3));
+ setLinks(entityCollection.getEntities().get(2), "NavPropertyETTwoPrimMany", targetEntities.get(0),
+ targetEntities.get(2),
+ targetEntities.get(3));
}
private void linkESKeyNav(final Map<String, EntityCollection> data) {
@@ -1069,10 +1091,10 @@ public class DataCreator {
final List<Entity> esMediaTargets = data.get("ESMedia").getEntities();
// NavPropertyETKeyNavMany
- setLinks(entityCollection.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
- esKeyNavTargets.get(1));
- setLinks(entityCollection.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1),
- esKeyNavTargets.get(2));
+ setLinks(entityCollection.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
+ esKeyNavTargets.get(1));
+ setLinks(entityCollection.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1),
+ esKeyNavTargets.get(2));
// NavPropertyETKeyNavOne
setLink(entityCollection.getEntities().get(0), "NavPropertyETKeyNavOne", esKeyNavTargets.get(1));
@@ -1095,11 +1117,11 @@ public class DataCreator {
setLink(entityCollection.getEntities().get(2), "NavPropertyETMediaOne", esMediaTargets.get(2));
// NavPropertyETMediaMany
- setLinks(entityCollection.getEntities().get(0), "NavPropertyETMediaMany", esMediaTargets.get(0),
- esMediaTargets.get(2));
+ setLinks(entityCollection.getEntities().get(0), "NavPropertyETMediaMany", esMediaTargets.get(0),
+ esMediaTargets.get(2));
setLinks(entityCollection.getEntities().get(1), "NavPropertyETMediaMany", esMediaTargets.get(2));
- setLinks(entityCollection.getEntities().get(2), "NavPropertyETMediaMany", esMediaTargets.get(0),
- esMediaTargets.get(1));
+ setLinks(entityCollection.getEntities().get(2), "NavPropertyETMediaMany", esMediaTargets.get(0),
+ esMediaTargets.get(1));
}
private void linkESTwoKeyNav(final Map<String, EntityCollection> data) {
@@ -1114,12 +1136,12 @@ public class DataCreator {
setLink(entityCollection.getEntities().get(3), "NavPropertyETKeyNavOne", esKeyNavTargets.get(2));
// NavPropertyETKeyNavMany
- setLinks(entityCollection.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
- esKeyNavTargets.get(1));
- setLinks(entityCollection.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
- esKeyNavTargets.get(1));
- setLinks(entityCollection.getEntities().get(2), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1),
- esKeyNavTargets.get(2));
+ setLinks(entityCollection.getEntities().get(0), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
+ esKeyNavTargets.get(1));
+ setLinks(entityCollection.getEntities().get(1), "NavPropertyETKeyNavMany", esKeyNavTargets.get(0),
+ esKeyNavTargets.get(1));
+ setLinks(entityCollection.getEntities().get(2), "NavPropertyETKeyNavMany", esKeyNavTargets.get(1),
+ esKeyNavTargets.get(2));
// NavPropertyETTwoKeyNavOne
setLink(entityCollection.getEntities().get(0), "NavPropertyETTwoKeyNavOne", esTwoKeyNavTargets.get(0));
@@ -1172,10 +1194,10 @@ public class DataCreator {
}
protected static int getDuration(final int days, final int hours, final int minutes, final int seconds) {
- return days * 24 * 60 * 60
- + hours * 60 * 60
- + minutes * 60
- + seconds;
+ return days * 24 * 60 * 60
+ + hours * 60 * 60
+ + minutes * 60
+ + seconds;
}
protected static Calendar getTime(final int hour, final int minute, final int second) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
index 045360b..d91f923 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
@@ -41,6 +41,7 @@ import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmParameter;
@@ -50,6 +51,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -174,23 +176,28 @@ public class DataProvider {
throws DataProviderException {
// Weak key construction
final HashMap<String, Object> keys = new HashMap<String, Object>();
- for (final String keyName : entityType.getKeyPredicateNames()) {
- final FullQualifiedName typeName = entityType.getProperty(keyName).getType().getFullQualifiedName();
+ List<String> keyPredicateNames = entityType.getKeyPredicateNames();
+ for (final String keyName : keyPredicateNames) {
+ EdmType type = entityType.getProperty(keyName).getType();
+ FullQualifiedName typeName = type.getFullQualifiedName();
+ if (type instanceof EdmTypeDefinition) {
+ typeName = ((EdmTypeDefinition) type).getUnderlyingType().getFullQualifiedName();
+ }
Object newValue;
-
+
if (EdmPrimitiveTypeKind.Int16.getFullQualifiedName().equals(typeName)) {
- newValue = (short) KEY_INT_16.incrementAndGet();
-
- while(!isFree(newValue, keyName, entities)) {
- newValue = (short) KEY_INT_16.incrementAndGet();
- }
+ newValue = (short) KEY_INT_16.incrementAndGet();
+
+ while (!isFree(newValue, keyName, entities)) {
+ newValue = (short) KEY_INT_16.incrementAndGet();
+ }
} else if (EdmPrimitiveTypeKind.Int32.getFullQualifiedName().equals(typeName)) {
newValue = KEY_INT_32.incrementAndGet();
-
- while(!isFree(newValue, keyName, entities)) {
+
+ while (!isFree(newValue, keyName, entities)) {
newValue = KEY_INT_32.incrementAndGet();
}
- } else if(EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
+ } else if (EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
// Integer keys
newValue = KEY_INT_64.incrementAndGet();
@@ -204,6 +211,12 @@ public class DataProvider {
while (!isFree(newValue, keyName, entities)) {
newValue = String.valueOf(KEY_STRING.incrementAndGet());
}
+ } else if (type instanceof EdmEnumType) {
+ /* In case of an enum key we only support composite keys. This way we can 0 as a key */
+ if (keyPredicateNames.size() <= 1) {
+ throw new DataProviderException("Single Enum as key not supported", HttpStatusCode.NOT_IMPLEMENTED);
+ }
+ newValue = new Short((short) 1);
} else {
throw new DataProviderException("Key type not supported", HttpStatusCode.NOT_IMPLEMENTED);
}
@@ -583,21 +596,21 @@ public class DataProvider {
return ActionData.entityCollectionAction(name, actionParameters, odata, edm);
}
- public void createReference(final Entity entity, final EdmNavigationProperty navigationProperty, final URI entityId,
+ public void createReference(final Entity entity, final EdmNavigationProperty navigationProperty, final URI entityId,
final String rawServiceRoot) throws DataProviderException {
- setLink(navigationProperty, entity, getEntityByReference(entityId.toASCIIString(), rawServiceRoot));
+ setLink(navigationProperty, entity, getEntityByReference(entityId.toASCIIString(), rawServiceRoot));
}
- public void deleteReference(final Entity entity, final EdmNavigationProperty navigationProperty,
+ public void deleteReference(final Entity entity, final EdmNavigationProperty navigationProperty,
final String entityId, final String rawServiceRoot) throws DataProviderException {
if (navigationProperty.isCollection()) {
final Entity targetEntity = getEntityByReference(entityId, rawServiceRoot);
final Link navigationLink = entity.getNavigationLink(navigationProperty.getName());
-
- if (navigationLink != null && navigationLink.getInlineEntitySet() != null
+
+ if (navigationLink != null && navigationLink.getInlineEntitySet() != null
&& navigationLink.getInlineEntitySet().getEntities().contains(targetEntity)) {
-
+
// Remove partner single-valued navigation property
if (navigationProperty.getPartner() != null) {
final EdmNavigationProperty edmPartnerNavigationProperty = navigationProperty.getPartner();
@@ -614,7 +627,7 @@ public class DataProvider {
}
}
}
-
+
// Remove target entity from collection-valued navigation property
navigationLink.getInlineEntitySet().getEntities().remove(targetEntity);
} else {
@@ -629,7 +642,7 @@ public class DataProvider {
}
}
- protected Entity getEntityByReference(final String entityId, final String rawServiceRoot)
+ protected Entity getEntityByReference(final String entityId, final String rawServiceRoot)
throws DataProviderException {
try {
final UriResourceEntitySet uriResource = odata.createUriHelper().parseEntityId(edm, entityId, rawServiceRoot);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
index b3b9864..7db6fcf 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
@@ -179,7 +179,7 @@ public class ComplexTypeProvider {
return new CsdlComplexType()
.setName(nameCTMixEnumDef.getName())
.setProperties(Arrays.asList(
- PropertyProvider.propertyEnumString_ENString_Nullable,
+ PropertyProvider.propertyEnumString_ENString,
PropertyProvider.collPropertyEnumString_ENString,
PropertyProvider.propertyTypeDefinition_TDString,
PropertyProvider.collPropertyTypeDefinition_TDString));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
index a1067ca..1ba33c1 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
@@ -437,12 +437,12 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETMixEnumDefCollComp)) {
return new CsdlEntityType()
.setName(nameETMixEnumDefCollComp.getName())
- .setKey(Arrays.asList(new CsdlPropertyRef().setName("PropertyInt16")))
+ .setKey(Arrays.asList(new CsdlPropertyRef().setName("PropertyEnumString"),
+ new CsdlPropertyRef().setName("PropertyDefString")))
.setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyEnumString_ENString,
+ PropertyProvider.propertyEnumString_ENString_NonNullable,
PropertyProvider.collPropertyEnumString_ENString,
- PropertyProvider.propertyTypeDefinition_TDString,
+ PropertyProvider.propertyTypeDefinition_TDString_NonNullable,
PropertyProvider.collPropertyTypeDefinition_TDString,
PropertyProvider.propertyComp_CTMixEnumTypeDefColl,
PropertyProvider.propertyCompColl_CTMixEnumTypeDefColl));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
index c8c4549..05fb93a 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
@@ -760,12 +760,12 @@ public class PropertyProvider {
.setType(EntityTypeProvider.nameETTwoKeyNav);
// EnumProperties --------------------------------------------------------------------------------------------------
- public static final CsdlProperty propertyEnumString_ENString = new CsdlProperty()
+ public static final CsdlProperty propertyEnumString_ENString_NonNullable = new CsdlProperty()
.setName("PropertyEnumString")
.setType(EnumTypeProvider.nameENString)
.setNullable(false);
- public static final CsdlProperty propertyEnumString_ENString_Nullable = new CsdlProperty()
+ public static final CsdlProperty propertyEnumString_ENString = new CsdlProperty()
.setName("PropertyEnumString")
.setType(EnumTypeProvider.nameENString);
@@ -779,6 +779,11 @@ public class PropertyProvider {
.setName("PropertyDefString")
.setType(TypeDefinitionProvider.nameTDString);
+ public static final CsdlProperty propertyTypeDefinition_TDString_NonNullable = new CsdlProperty()
+ .setName("PropertyDefString")
+ .setType(TypeDefinitionProvider.nameTDString)
+ .setNullable(false);
+
public static final CsdlProperty collPropertyTypeDefinition_TDString = new CsdlProperty()
.setName("CollPropertyDefString")
.setType(TypeDefinitionProvider.nameTDString)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
index b528b28..01e61f3 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
@@ -471,6 +471,31 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
assertEquals("string", defProperty.getValue());
stream.close();
}
+
+ @Test
+ public void eTMixEnumDefCollCompTestWithEnumStrings() throws Exception {
+ InputStream stream = getFileAsStream("EntityETMixEnumDefCollCompWithEnumStrings.json");
+ final Entity entity = deserialize(stream, "ETMixEnumDefCollComp", ContentType.JSON);
+
+ assertEquals(6, entity.getProperties().size());
+
+ Property enumProperty = entity.getProperty("PropertyEnumString");
+ assertNotNull(enumProperty);
+ assertEquals((short) 2, enumProperty.getValue());
+
+ Property defProperty = entity.getProperty("PropertyDefString");
+ assertNotNull(defProperty);
+ assertEquals("def", defProperty.getValue());
+
+ Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
+ List<Property> value = complexProperty.asComplex().getValue();
+ assertEquals((short) 2, value.get(0).getValue());
+
+ defProperty = ((ComplexValue) entity.getProperty("CollPropertyCompMixedEnumDef").asCollection().get(1))
+ .getValue().get(2);
+ assertEquals("def", defProperty.getValue());
+ stream.close();
+ }
@Test
public void eTCollAllPrimWithNullValue() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/639362ca/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
index a257eaa..dcde3f2 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
@@ -349,7 +349,6 @@ public class ODataXmlDeserializerTest extends AbstractODataDeserializerTest {
+ " xmlns:m=\"" + Constants.NS_METADATA + "\" xmlns:d=\"" + Constants.NS_DATASERVICES + "\">\n"
+ " <a:content type=\"application/xml\">\n"
+ " <m:properties>\n"
- + " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n"
+ " <d:PropertyEnumString m:type=\"#olingo.odata.test1.ENString\">String2,String3"
+ "</d:PropertyEnumString>\n"
+ " <d:CollPropertyEnumString m:type=\"#Collection(olingo.odata.test1.ENString)\">\n"
@@ -398,9 +397,8 @@ public class ODataXmlDeserializerTest extends AbstractODataDeserializerTest {
final Entity result = deserializer.entity(new ByteArrayInputStream(payload.getBytes()),
edmEntitySet.getEntityType()).getEntity();
- Assert.assertEquals(7, result.getProperties().size());
+ Assert.assertEquals(6, result.getProperties().size());
- Assert.assertEquals((short) 1, result.getProperty("PropertyInt16").asPrimitive());
Assert.assertEquals((short) 6, result.getProperty("PropertyEnumString").asEnum());
Assert.assertEquals(3, result.getProperty("CollPropertyEnumString").asCollection().size());
Assert.assertEquals("Test", result.getProperty("PropertyDefString").asPrimitive());