You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2017/12/14 05:07:43 UTC
olingo-odata4 git commit: [OLINGO-1191] Code Improvements
Repository: olingo-odata4
Updated Branches:
refs/heads/master b86aa5d97 -> 387ba9c09
[OLINGO-1191] Code Improvements
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/387ba9c0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/387ba9c0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/387ba9c0
Branch: refs/heads/master
Commit: 387ba9c096cccd69436027b6dadaa4e83b5ea0d5
Parents: b86aa5d
Author: ramya vasanth <ra...@sap.com>
Authored: Thu Dec 14 10:37:35 2017 +0530
Committer: ramya vasanth <ra...@sap.com>
Committed: Thu Dec 14 10:37:35 2017 +0530
----------------------------------------------------------------------
.../core/serialization/ODataBinderImpl.java | 23 +--
.../olingo/client/core/EntitySetTest.java | 51 +++++++
.../apache/olingo/client/core/EntityTest.java | 51 +++++++
.../olingo/client/core/containmentNav.json | 33 +++++
.../olingo/client/core/containmentNav1.json | 36 +++++
.../olingo/client/core/containmentNav2.json | 33 +++++
.../olingo/client/core/containmentNav3.json | 33 +++++
.../olingo/client/core/containmentNav4.json | 68 +++++++++
.../olingo/client/core/metadata_sample.xml | 139 +++++++++++++++++++
9 files changed, 458 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
index 7d0b61c..7d35668 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
@@ -496,10 +496,10 @@ public class ODataBinderImpl implements ODataBinder {
inlineEntitySet)));
}
- private EdmEntityType findEntityType(
+ private EdmType findEntityType(
final String entitySetOrSingletonOrType, final EdmEntityContainer container) {
- EdmEntityType type = null;
+ EdmType type = null;
final String firstToken = StringUtils.substringBefore(entitySetOrSingletonOrType, "/");
EdmBindingTarget bindingTarget = container.getEntitySet(firstToken);
@@ -514,9 +514,14 @@ public class ODataBinderImpl implements ODataBinder {
final String[] splitted = entitySetOrSingletonOrType.split("/");
if (splitted.length > 1) {
for (int i = 1; i < splitted.length && type != null; i++) {
- final EdmNavigationProperty navProp = type.getNavigationProperty(splitted[i]);
+ final EdmNavigationProperty navProp = ((EdmStructuredType) type).getNavigationProperty(splitted[i]);
if (navProp == null) {
- type = null;
+ EdmProperty property = ((EdmStructuredType) type).getStructuralProperty(splitted[i]);
+ if (property != null) {
+ type = property.getType();
+ } else {
+ type = null;
+ }
} else {
type = navProp.getType();
}
@@ -548,17 +553,17 @@ public class ODataBinderImpl implements ODataBinder {
for (EdmSchema schema : edm.getSchemas()) {
final EdmEntityContainer container = schema.getEntityContainer();
if (container != null) {
- final EdmEntityType entityType = findEntityType(contextURL.getEntitySetOrSingletonOrType(), container);
+ final EdmType structuredType = findEntityType(contextURL.getEntitySetOrSingletonOrType(), container);
- if (entityType != null) {
+ if (structuredType != null) {
if (contextURL.getNavOrPropertyPath() == null) {
- type = entityType;
+ type = structuredType;
} else {
final EdmNavigationProperty navProp =
- entityType.getNavigationProperty(contextURL.getNavOrPropertyPath());
+ ((EdmStructuredType) structuredType).getNavigationProperty(contextURL.getNavOrPropertyPath());
type = navProp == null
- ? entityType
+ ? structuredType
: navProp.getType();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java
index b968c5f..6ea256b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java
@@ -26,16 +26,39 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Test;
public class EntitySetTest extends AbstractTest {
+private EdmEnabledODataClient getEdmEnabledClient1() {
+ return new EdmEnabledODataClientImpl(null, null, null) {
+
+ private Edm edm;
+
+ @Override
+ public Edm getEdm(final String metadataETag) {
+ return getCachedEdm();
+ }
+
+ @Override
+ public Edm getCachedEdm() {
+ if (edm == null) {
+ edm = getReader().readMetadata(getClass().getResourceAsStream("metadata_sample.xml"));
+ }
+ return edm;
+ }
+
+ };
+ }
+
private void read(final ContentType contentType) throws IOException, ODataDeserializerException {
final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(contentType));
final ClientEntitySet entitySet = client.getBinder().getODataEntitySet(
@@ -102,4 +125,32 @@ public class EntitySetTest extends AbstractTest {
public void jsonRef() throws Exception {
ref(ContentType.JSON);
}
+
+ @Test
+ public void testContainmentNav() throws Exception {
+ final InputStream input = getClass().getResourceAsStream("containmentNav1." +
+ getSuffix(ContentType.JSON_FULL_METADATA));
+ final ClientEntitySet entity = getEdmEnabledClient1().getBinder().
+ getODataEntitySet(client.getDeserializer(
+ ContentType.JSON_FULL_METADATA).toEntitySet(input));
+ assertNotNull(entity);
+ assertEquals("olingo.odata.test1.ETTwoCont",
+ entity.getEntities().get(0).getTypeName().getFullQualifiedNameAsString());
+ assertEquals("olingo.odata.test1.ETTwoCont",
+ entity.getEntities().get(1).getTypeName().getFullQualifiedNameAsString());
+ }
+
+ @Test
+ public void testContainmentNavOnSingleton() throws Exception {
+ final InputStream input = getClass().getResourceAsStream("containmentNav4." +
+ getSuffix(ContentType.JSON_FULL_METADATA));
+ final ClientEntitySet entity = getEdmEnabledClient1().getBinder().
+ getODataEntitySet(client.getDeserializer(
+ ContentType.JSON_FULL_METADATA).toEntitySet(input));
+ assertNotNull(entity);
+ assertEquals("olingo.odata.test1.ETCont",
+ entity.getEntities().get(0).getTypeName().getFullQualifiedNameAsString());
+ assertEquals("olingo.odata.test1.ETCont",
+ entity.getEntities().get(1).getTypeName().getFullQualifiedNameAsString());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
index d80846b..bc08918 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
@@ -76,6 +76,27 @@ public class EntityTest extends AbstractTest {
};
}
+
+ private EdmEnabledODataClient getEdmEnabledClient1() {
+ return new EdmEnabledODataClientImpl(null, null, null) {
+
+ private Edm edm;
+
+ @Override
+ public Edm getEdm(final String metadataETag) {
+ return getCachedEdm();
+ }
+
+ @Override
+ public Edm getCachedEdm() {
+ if (edm == null) {
+ edm = getReader().readMetadata(getClass().getResourceAsStream("metadata_sample.xml"));
+ }
+ return edm;
+ }
+
+ };
+ }
private void singleton(final ContentType contentType) throws Exception {
final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(contentType));
@@ -404,4 +425,34 @@ public class EntityTest extends AbstractTest {
assertTrue(property.isPrimitive());
assertEquals(property.getValueType(), ValueType.PRIMITIVE);
}
+
+ @Test
+ public void testContainmentNav() throws Exception {
+ final InputStream input = getClass().getResourceAsStream(
+ "containmentNav." + getSuffix(ContentType.JSON_FULL_METADATA));
+ final ClientEntity entity = getEdmEnabledClient1().getBinder().getODataEntity(
+ client.getDeserializer(ContentType.JSON_FULL_METADATA).toEntity(input));
+ assertNotNull(entity);
+ assertEquals("olingo.odata.test1.ETCont", entity.getTypeName().getFullQualifiedNameAsString());
+ }
+
+ @Test
+ public void testContainmentNavOnComplexType() throws Exception {
+ final InputStream input = getClass().getResourceAsStream(
+ "containmentNav2." + getSuffix(ContentType.JSON_FULL_METADATA));
+ final ClientEntity entity = getEdmEnabledClient1().getBinder().getODataEntity(
+ client.getDeserializer(ContentType.JSON_FULL_METADATA).toEntity(input));
+ assertNotNull(entity);
+ assertEquals("olingo.odata.test1.ETCont", entity.getTypeName().getFullQualifiedNameAsString());
+ }
+
+ @Test
+ public void testContainmentNavOnSingleton() throws Exception {
+ final InputStream input = getClass().getResourceAsStream(
+ "containmentNav3." + getSuffix(ContentType.JSON_FULL_METADATA));
+ final ClientEntity entity = getEdmEnabledClient1().getBinder().getODataEntity(
+ client.getDeserializer(ContentType.JSON_FULL_METADATA).toEntity(input));
+ assertNotNull(entity);
+ assertEquals("olingo.odata.test1.ETCont", entity.getTypeName().getFullQualifiedNameAsString());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav.json
new file mode 100644
index 0000000..b864163
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav.json
@@ -0,0 +1,33 @@
+{
+ "@odata.context": "../../$metadata#ESKeyNavCont(-32766)/NavPropertyETBaseContMany(-32768)/olingo.odata.test1.ETCont/$entity",
+ "@odata.metadataEtag": "W/\"c32f78fd-8c2d-44a1-a602-2c6527d44930\"",
+ "PropertyInt16@odata.type": "#Int16",
+ "PropertyInt16": -32768,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32@odata.type": "#Int32",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64@odata.type": "#Int64",
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle@odata.type": "#Single",
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal@odata.type": "#Decimal",
+ "PropertyDecimal": -34,
+ "PropertyBinary@odata.type": "#Binary",
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate@odata.type": "#Date",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset@odata.type": "#DateTimeOffset",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration@odata.type": "#Duration",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid@odata.type": "#Guid",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay@odata.type": "#TimeOfDay",
+ "PropertyTimeOfDay": "23:49:14",
+ "PropertyBoolean": false,
+ "PropertyByte@odata.type": "#Byte",
+ "PropertyByte": 0,
+ "PropertySByte@odata.type": "#SByte",
+ "PropertySByte": -128
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav1.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav1.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav1.json
new file mode 100644
index 0000000..f752e0d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav1.json
@@ -0,0 +1,36 @@
+{
+ "@odata.context": "../../$metadata#ESKeyNavCont(-32766)/NavPropertyETBaseContMany(0)/NavPropertyETBaseContTwoContMany",
+ "@odata.metadataEtag": "W/\"c32f78fd-8c2d-44a1-a602-2c6527d44930\"",
+ "value": [
+ {
+ "PropertyInt16": -32768,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal": -34,
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay": "23:49:14"
+ },
+ {
+ "PropertyInt16": 0,
+ "PropertyString": "",
+ "PropertyInt32": 0,
+ "PropertyInt64": 0,
+ "PropertySingle": 0,
+ "PropertyDouble": 0,
+ "PropertyDecimal": 0,
+ "PropertyBinary": "",
+ "PropertyDate": "1970-01-01",
+ "PropertyDateTimeOffset": "2005-12-03T00:00:00Z",
+ "PropertyDuration": "PT0S",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789cccddd",
+ "PropertyTimeOfDay": "00:01:01"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav2.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav2.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav2.json
new file mode 100644
index 0000000..bc7113b
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav2.json
@@ -0,0 +1,33 @@
+{
+ "@odata.context": "../../$metadata#ESKeyNavCont(-32766)/PropertyCompNavCont/NavPropertyETTwoKeyNavETContOne/$entity",
+ "@odata.metadataEtag": "W/\"c32f78fd-8c2d-44a1-a602-2c6527d44930\"",
+ "PropertyInt16@odata.type": "#Int16",
+ "PropertyInt16": -32768,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32@odata.type": "#Int32",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64@odata.type": "#Int64",
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle@odata.type": "#Single",
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal@odata.type": "#Decimal",
+ "PropertyDecimal": -34,
+ "PropertyBinary@odata.type": "#Binary",
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate@odata.type": "#Date",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset@odata.type": "#DateTimeOffset",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration@odata.type": "#Duration",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid@odata.type": "#Guid",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay@odata.type": "#TimeOfDay",
+ "PropertyTimeOfDay": "23:49:14",
+ "PropertyBoolean": false,
+ "PropertyByte@odata.type": "#Byte",
+ "PropertyByte": 0,
+ "PropertySByte@odata.type": "#SByte",
+ "PropertySByte": -128
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav3.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav3.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav3.json
new file mode 100644
index 0000000..bd17c0e
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav3.json
@@ -0,0 +1,33 @@
+{
+ "@odata.context": "../../$metadata#SI/PropertyCompNavCont/NavPropertyETTwoKeyNavETContOne/$entity",
+ "@odata.metadataEtag": "W/\"c32f78fd-8c2d-44a1-a602-2c6527d44930\"",
+ "PropertyInt16@odata.type": "#Int16",
+ "PropertyInt16": -32768,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32@odata.type": "#Int32",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64@odata.type": "#Int64",
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle@odata.type": "#Single",
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal@odata.type": "#Decimal",
+ "PropertyDecimal": -34,
+ "PropertyBinary@odata.type": "#Binary",
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate@odata.type": "#Date",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset@odata.type": "#DateTimeOffset",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration@odata.type": "#Duration",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid@odata.type": "#Guid",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay@odata.type": "#TimeOfDay",
+ "PropertyTimeOfDay": "23:49:14",
+ "PropertyBoolean": false,
+ "PropertyByte@odata.type": "#Byte",
+ "PropertyByte": 0,
+ "PropertySByte@odata.type": "#SByte",
+ "PropertySByte": -128
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav4.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav4.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav4.json
new file mode 100644
index 0000000..d317ef1
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/containmentNav4.json
@@ -0,0 +1,68 @@
+{
+ "@odata.context": "../../$metadata#SI/NavPropertyETContMany",
+ "@odata.metadataEtag": "W/\"c32f78fd-8c2d-44a1-a602-2c6527d44930\"",
+ "value": [
+ {
+ "PropertyInt16@odata.type": "#Int16",
+ "PropertyInt16": -32768,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32@odata.type": "#Int32",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64@odata.type": "#Int64",
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle@odata.type": "#Single",
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal@odata.type": "#Decimal",
+ "PropertyDecimal": -34,
+ "PropertyBinary@odata.type": "#Binary",
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate@odata.type": "#Date",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset@odata.type": "#DateTimeOffset",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration@odata.type": "#Duration",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid@odata.type": "#Guid",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay@odata.type": "#TimeOfDay",
+ "PropertyTimeOfDay": "23:49:14",
+ "PropertyBoolean": false,
+ "PropertyByte@odata.type": "#Byte",
+ "PropertyByte": 0,
+ "PropertySByte@odata.type": "#SByte",
+ "PropertySByte": -128
+ },
+ {
+ "PropertyInt16@odata.type": "#Int16",
+ "PropertyInt16": -365,
+ "PropertyString": "Second Resource - negative values",
+ "PropertyInt32@odata.type": "#Int32",
+ "PropertyInt32": -2147483648,
+ "PropertyInt64@odata.type": "#Int64",
+ "PropertyInt64": -9223372036854775808,
+ "PropertySingle@odata.type": "#Single",
+ "PropertySingle": -179000000,
+ "PropertyDouble": -179000,
+ "PropertyDecimal@odata.type": "#Decimal",
+ "PropertyDecimal": -34,
+ "PropertyBinary@odata.type": "#Binary",
+ "PropertyBinary": "ASNFZ4mrze8=",
+ "PropertyDate@odata.type": "#Date",
+ "PropertyDate": "2015-11-05",
+ "PropertyDateTimeOffset@odata.type": "#DateTimeOffset",
+ "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
+ "PropertyDuration@odata.type": "#Duration",
+ "PropertyDuration": "PT9S",
+ "PropertyGuid@odata.type": "#Guid",
+ "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
+ "PropertyTimeOfDay@odata.type": "#TimeOfDay",
+ "PropertyTimeOfDay": "23:49:14",
+ "PropertyBoolean": false,
+ "PropertyByte@odata.type": "#Byte",
+ "PropertyByte": 0,
+ "PropertySByte@odata.type": "#SByte",
+ "PropertySByte": -128
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/387ba9c0/lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata_sample.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata_sample.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata_sample.xml
new file mode 100644
index 0000000..4be77ab
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata_sample.xml
@@ -0,0 +1,139 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:Reference Uri="../v4.0/cs02/vocabularies/Org.OData.Core.V1.xml">
+ <edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
+ </edmx:Reference>
+ <edmx:DataServices>
+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm"
+ Namespace="olingo.odata.test1" Alias="Namespace1_Alias">
+ <EntityType Name="ETKeyNavCont">
+ <Key>
+ <PropertyRef Name="PropertyInt16" />
+ </Key>
+ <Property Name="PropertyInt16" Type="Edm.Int16" Nullable="false" />
+ <Property Name="PropertyString" Type="Edm.String" Nullable="false" />
+ <Property Name="PropertyCompNavCont" Type="Namespace1_Alias.CTNavCont" />
+ <NavigationProperty Name="NavPropertyETContOne"
+ Type="Namespace1_Alias.ETCont" ContainsTarget="true" />
+ <NavigationProperty Name="NavPropertyETContMany"
+ Type="Collection(Namespace1_Alias.ETCont)" ContainsTarget="true" />
+ <NavigationProperty Name="NavPropertyETBaseContMany"
+ Type="Collection(Namespace1_Alias.ETBaseCont)" ContainsTarget="true" />
+ </EntityType>
+ <EntityType Name="ETBaseCont">
+ <Key>
+ <PropertyRef Name="PropertyInt16" />
+ </Key>
+ <Property Name="PropertyInt16" Type="Edm.Int16" Nullable="false" />
+ <Property Name="PropertyString" Type="Edm.String" />
+ <Property Name="PropertyInt32" Type="Edm.Int32" />
+ <Property Name="PropertyInt64" Type="Edm.Int64" />
+ <Property Name="PropertySingle" Type="Edm.Single" />
+ <Property Name="PropertyDouble" Type="Edm.Double" />
+ <Property Name="PropertyDecimal" Type="Edm.Decimal" Scale="10" />
+ <Property Name="PropertyBinary" Type="Edm.Binary" />
+ <Property Name="PropertyDate" Type="Edm.Date" />
+ <Property Name="PropertyDateTimeOffset" Type="Edm.DateTimeOffset" />
+ <Property Name="PropertyDuration" Type="Edm.Duration" />
+ <Property Name="PropertyGuid" Type="Edm.Guid" />
+ <Property Name="PropertyTimeOfDay" Type="Edm.TimeOfDay" />
+ <NavigationProperty Name="NavPropertyETBaseContTwoContMany"
+ Type="Collection(Namespace1_Alias.ETTwoCont)" ContainsTarget="true" />
+ <NavigationProperty Name="NavPropertyETBaseContTwoContOne"
+ Type="Namespace1_Alias.ETTwoCont" Nullable="false" ContainsTarget="true" />
+ </EntityType>
+ <EntityType Name="ETCont" BaseType="Namespace1_Alias.ETBaseCont">
+ <Property Name="PropertyBoolean" Type="Edm.Boolean" />
+ <Property Name="PropertyByte" Type="Edm.Byte" />
+ <Property Name="PropertySByte" Type="Edm.SByte" />
+ </EntityType>
+ <EntityType Name="ETTwoCont">
+ <Key>
+ <PropertyRef Name="PropertyInt16" />
+ <PropertyRef Name="PropertyString" />
+ </Key>
+ <Property Name="PropertyInt16" Type="Edm.Int16" Nullable="false" />
+ <Property Name="PropertyString" Type="Edm.String" Nullable="false" />
+ <Property Name="PropertyInt32" Type="Edm.Int32" />
+ <Property Name="PropertyInt64" Type="Edm.Int64" />
+ <Property Name="PropertySingle" Type="Edm.Single" />
+ <Property Name="PropertyDouble" Type="Edm.Double" />
+ <Property Name="PropertyDecimal" Type="Edm.Decimal" Scale="10" />
+ <Property Name="PropertyBinary" Type="Edm.Binary" />
+ <Property Name="PropertyDate" Type="Edm.Date" />
+ <Property Name="PropertyDateTimeOffset" Type="Edm.DateTimeOffset" />
+ <Property Name="PropertyDuration" Type="Edm.Duration" />
+ <Property Name="PropertyGuid" Type="Edm.Guid" />
+ <Property Name="PropertyTimeOfDay" Type="Edm.TimeOfDay" />
+ </EntityType>
+ <ComplexType Name="CTNavCont">
+ <NavigationProperty Name="NavPropertyETTwoKeyNavETContOne"
+ Type="Namespace1_Alias.ETCont" ContainsTarget="true" />
+ <NavigationProperty Name="NavPropertyETTwoKeyNavETContMany"
+ Type="Collection(Namespace1_Alias.ETBaseCont)" ContainsTarget="true" />
+ </ComplexType>
+ <EntityType Name="ETTwoPrim">
+ <Key>
+ <PropertyRef Name="PropertyInt16" />
+ </Key>
+ <Property Name="PropertyInt16" Type="Edm.Int16" Nullable="false" />
+ <Property Name="PropertyString" Type="Edm.String" />
+ <Property Name="PropertyCompNavCont" Type="Namespace1_Alias.CTNavCont" />
+ <NavigationProperty Name="NavPropertyETContOne"
+ Type="Namespace1_Alias.ETCont" ContainsTarget="true" />
+ <NavigationProperty Name="NavPropertyETContMany"
+ Type="Collection(Namespace1_Alias.ETCont)" ContainsTarget="true" />
+ </EntityType>
+ <EntityContainer Name="Container">
+ <EntitySet Name="ESKeyNavCont" EntityType="Namespace1_Alias.ETKeyNavCont">
+ <NavigationPropertyBinding
+ Path="NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne" Target="ESKeyNav" />
+ <NavigationPropertyBinding
+ Path="NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne" Target="ESKeyNav" />
+ <NavigationPropertyBinding Path="NavPropertyETTwoKeyNavContOne"
+ Target="ESTwoKeyNavCont" />
+ <NavigationPropertyBinding Path="NavPropertyETTwoKeyNavContMany"
+ Target="ESTwoKeyNavCont" />
+ <NavigationPropertyBinding
+ Path="PropertyCompNavCont/NavPropertyETKeyNavOne/NavPropertyETKeyNavOne"
+ Target="ESKeyNav" />
+ <NavigationPropertyBinding
+ Path="PropertyCompNavCont/NavPropertyETKeyNavMany/NavPropertyETKeyNavOne"
+ Target="ESKeyNav" />
+ <NavigationPropertyBinding
+ Path="PropertyCompNavCont/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne"
+ Target="ESKeyNav" />
+ <NavigationPropertyBinding
+ Path="PropertyCompNavCont/NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne"
+ Target="ESKeyNav" />
+ <Annotation Term="Core.Description">
+ <String>Contains entities with containment navigation properties
+ </String>
+ </Annotation>
+ <Annotation Term="Namespace1_Alias.Data">
+ <Bool>false</Bool>
+ </Annotation>
+ </EntitySet>
+ <Singleton Name="SI" Type="Namespace1_Alias.ETTwoPrim" />
+ </EntityContainer>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file