You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/11/15 08:51:45 UTC
olingo-odata4 git commit: [OLINGO-811] Added support for XML and
fixed tests
Repository: olingo-odata4
Updated Branches:
refs/heads/OLINGO-811_CountForExpand e7f8ff84a -> 8bd685b6f
[OLINGO-811] Added support for XML and fixed tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8bd685b6
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8bd685b6
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8bd685b6
Branch: refs/heads/OLINGO-811_CountForExpand
Commit: 8bd685b6ffc72a3c62a8cbdfa5e5568d7cb4094e
Parents: e7f8ff8
Author: mibo <mi...@apache.org>
Authored: Sun Nov 15 08:20:15 2015 +0100
Committer: mibo <mi...@apache.org>
Committed: Sun Nov 15 08:51:28 2015 +0100
----------------------------------------------------------------------
.../org/apache/olingo/client/core/Customers.xml | 4 +-
.../apache/olingo/client/core/Products_5.xml | 9 ++-
.../apache/olingo/client/core/VipCustomer.xml | 2 +-
.../org/apache/olingo/client/core/annotated.xml | 2 +-
.../core/collectionOfEntityReferences.xml | 1 +
.../core/entity.withcomplexnavigation.xml | 2 +-
.../serializer/json/ODataJsonSerializer.java | 40 ++++++-----
.../core/serializer/xml/ODataXmlSerializer.java | 38 ++++++++++-
.../serializer/xml/ODataXmlSerializerTest.java | 71 ++++++++++++++++++++
9 files changed, 145 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
index a0adedd..2db3ec2 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
@@ -37,7 +37,7 @@
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
type="application/atom+xml;type=feed" title="Orders">
- <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline></link>
+ <m:inline><feed><m:count>1</m:count><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline></link>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company"/>
<title/>
<updated>2014-03-31T09:35:14Z</updated>
@@ -80,7 +80,7 @@
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed"
title="Orders">
- <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders"/></feed></m:inline>
+ <m:inline><feed><m:count>1</m:count><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders"/></feed></m:inline>
</link>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company"/>
<title/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml
index 409799e..884fe8d 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml
@@ -23,7 +23,14 @@
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)</id>
<category term="#Microsoft.Test.OData.Services.ODataWCFService.Product" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
<link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Details" type="application/atom+xml;type=feed" title="Details"><m:inline><feed><ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details"/></feed></m:inline></link>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Details" type="application/atom+xml;type=feed" title="Details">
+ <m:inline>
+ <feed>
+ <m:count>1</m:count>
+ <ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details"/>
+ </feed>
+ </m:inline>
+ </link>
<title />
<updated>2014-03-28T11:24:49Z</updated>
<author>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml
index cc5c04d..8888af1 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml
@@ -30,7 +30,7 @@
<category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
<link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer" />
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders"><m:inline><feed><ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders"/></feed></m:inline></link>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders"><m:inline><feed><m:count>1</m:count><ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders"/></feed></m:inline></link>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company" />
<title />
<updated>2014-03-28T13:03:32Z</updated>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
index a3b06a9..43225bd 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
@@ -26,7 +26,7 @@
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
type="application/atom+xml;type=feed" title="Orders">
- <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline>
+ <m:inline><feed><m:count>1</m:count><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline>
<m:annotation term="com.contoso.display.style" m:type="#com.contoso.display.styleType">
<d:order m:type="Int32">2</d:order>
</m:annotation>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml
index 9534270..82f7a45 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml
@@ -20,6 +20,7 @@ under the License.
<feed xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Collection($ref)"
xmlns="http://www.w3.org/2005/Atom">
+ <m:count>1</m:count>
<m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=5)"/>
<m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=6)"/>
</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
index 94cb766..ce3c2d3 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
@@ -34,7 +34,7 @@ under the License.
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
type="application/atom+xml;type=feed"
title="Orders">
- <m:inline><feed><m:ref id="Customers('ALFKI')/Orders"/></feed></m:inline> </link>
+ <m:inline><feed><m:count>1</m:count><m:ref id="Customers('ALFKI')/Orders"/></feed></m:inline> </link>
<link rel="http://docs.oasis-open.org/odata/ns/related/Supplier"
type="application/atom+xml;type=entry"
title="Supplier" href="Customers('ALFKI')/Supplier"/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/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 0253049..ea00ccd 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
@@ -357,22 +357,12 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
SerializerException.MessageKeys.NOT_IMPLEMENTED);
}
- boolean isNavigationPropertyCountOnly = false;
- if (innerOptions != null) {
- final UriInfoResource uriInfoResource = innerOptions.getResourcePath();
- final List<UriResource> uriResourceParts = uriInfoResource.getUriResourceParts();
- if (uriResourceParts.size() == 2 && uriResourceParts.get(0) instanceof UriResourceNavigation
- && uriResourceParts.get(1) instanceof UriResourceCount) {
- isNavigationPropertyCountOnly = true;
- }
- }
-
- if (isNavigationPropertyCountOnly) {
- writeNavigationPropertyCount(property, navigationLink.getInlineEntitySet().getCount(), json);
+ if (property.isCollection() && isNavigationPropertyCountOnly(innerOptions)) {
+ writeNavigationPropertyCount(property, getCount(navigationLink), json);
} else {
- if (innerOptions != null && innerOptions.getCountOption() != null
- && innerOptions.getCountOption().getValue()) {
- writeNavigationPropertyCount(property, navigationLink.getInlineEntitySet().getCount(), json);
+ if (property.isCollection() && innerOptions != null
+ && innerOptions.getCountOption() != null && innerOptions.getCountOption().getValue()) {
+ writeNavigationPropertyCount(property, getCount(navigationLink), json);
}
writeExpandedNavigationProperty(metadata, property, navigationLink,
@@ -384,6 +374,26 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
}
}
+ private Integer getCount(Link navigationLink) {
+ if(navigationLink.getInlineEntitySet() == null) {
+ return 0;
+ }
+ return navigationLink.getInlineEntitySet().getCount();
+ }
+
+ private boolean isNavigationPropertyCountOnly(ExpandItem innerOptions) {
+ if (innerOptions != null) {
+ final UriInfoResource uriInfoResource = innerOptions.getResourcePath();
+ final List<UriResource> uriResourceParts = uriInfoResource.getUriResourceParts();
+ if (uriResourceParts.size() == 2
+ && uriResourceParts.get(0) instanceof UriResourceNavigation
+ && uriResourceParts.get(1) instanceof UriResourceCount) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private void writeNavigationPropertyCount(final EdmNavigationProperty property, final int count,
final JsonGenerator json) throws IOException {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
index 2af8ede..1c4611a 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
@@ -62,6 +62,11 @@ import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOpti
import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceCount;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
+import org.apache.olingo.server.api.uri.queryoption.CountOption;
import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
@@ -528,6 +533,8 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
writeExpandedNavigationProperty(metadata, property, navigationLink,
innerOptions == null ? null : innerOptions.getExpandOption(),
innerOptions == null ? null : innerOptions.getSelectOption(),
+ innerOptions == null ? null : innerOptions.getCountOption(),
+ isNavigationPropertyCountOnly(innerOptions),
writer);
writer.writeEndElement();
writer.writeEndElement();
@@ -546,6 +553,19 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
}
}
+ private boolean isNavigationPropertyCountOnly(ExpandItem innerOptions) {
+ if (innerOptions != null) {
+ final UriInfoResource uriInfoResource = innerOptions.getResourcePath();
+ final List<UriResource> uriResourceParts = uriInfoResource.getUriResourceParts();
+ if (uriResourceParts.size() == 2
+ && uriResourceParts.get(0) instanceof UriResourceNavigation
+ && uriResourceParts.get(1) instanceof UriResourceCount) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected Link getOrCreateLink(final Linked linked, final String navigationPropertyName)
throws XMLStreamException {
Link link = linked.getNavigationLink(navigationPropertyName);
@@ -587,13 +607,25 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
protected void writeExpandedNavigationProperty(final ServiceMetadata metadata,
final EdmNavigationProperty property, final Link navigationLink,
- final ExpandOption innerExpand, final SelectOption innerSelect, final XMLStreamWriter writer)
+ final ExpandOption innerExpand, final SelectOption innerSelect,
+ final CountOption innerCount, boolean isNavigationPropertyCountOnly,
+ final XMLStreamWriter writer)
throws XMLStreamException, SerializerException {
if (property.isCollection()) {
if (navigationLink != null && navigationLink.getInlineEntitySet() != null) {
writer.writeStartElement(ATOM, Constants.ATOM_ELEM_FEED, NS_ATOM);
- writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
- innerSelect, writer);
+
+ if (isNavigationPropertyCountOnly) {
+ writeCount(navigationLink.getInlineEntitySet(), writer);
+ } else {
+ if (innerCount != null && innerCount.getValue()
+ && navigationLink.getInlineEntitySet().getCount() != null) {
+ writeCount(navigationLink.getInlineEntitySet(), writer);
+ }
+ writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
+ innerSelect, writer);
+ }
+
writer.writeEndElement();
}
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8bd685b6/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..23ed266 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
@@ -56,6 +56,7 @@ import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerResult;
import org.apache.olingo.server.api.uri.UriHelper;
+import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
@@ -1706,6 +1707,76 @@ public class ODataXmlSerializerTest {
}
@Test
+ public void expandWithCountUri() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(2);
+
+ String navName = "NavPropertyETTwoPrimMany";
+ final UriInfoResource resource = ExpandSelectMock.mockResourceWithCountOnNavigation(edmEntitySet, navName);
+ ExpandItem expandItem = Mockito.mock(ExpandItem.class);
+ Mockito.when(expandItem.getResourcePath()).thenReturn(resource);
+
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Collections.singletonList(expandItem));
+
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .build()).getContent();
+
+ final String resultString = IOUtils.toString(result);
+ final String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" " +
+ "xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" m:context=\"$metadata#ESAllPrim/$entity\" " +
+ "m:metadata-etag=\"metadataETag\">\n" +
+ " <a:id>ESAllPrim(0)</a:id>\n" +
+ " <a:title/><a:summary/>\n" +
+ " <a:updated>" + UPDATED_FORMAT.format(new Date()) + "</a:updated>" +
+ " <a:author><a:name/></a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(0)\"/>\n" +
+ " <a:link rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\" " +
+ " type=\"application/atom+xml;type=feed\" " +
+ " title=\"NavPropertyETTwoPrimOne\" " +
+ " href=\"ESAllPrim(0)/NavPropertyETTwoPrimOne\"/>\n" +
+ " <a:link rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\" " +
+ " type=\"application/atom+xml;type=feed\" " +
+ " title=\"NavPropertyETTwoPrimMany\" " +
+ " href=\"ESAllPrim(0)/NavPropertyETTwoPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed>\n" +
+ " <m:count>3</m:count>\n" +
+ " </a:feed>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" " +
+ " term=\"#olingo.odata.test1.ETAllPrim\"/>\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">0</d:PropertyInt16>\n" +
+ " <d:PropertyString>\n" +
+ " </d:PropertyString>\n" +
+ " <d:PropertyBoolean m:type=\"Boolean\">false</d:PropertyBoolean>\n" +
+ " <d:PropertyByte m:type=\"Byte\">0</d:PropertyByte>\n" +
+ " <d:PropertySByte m:type=\"SByte\">0</d:PropertySByte>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">0</d:PropertyInt32>\n" +
+ " <d:PropertyInt64 m:type=\"Int64\">0</d:PropertyInt64>\n" +
+ " <d:PropertySingle m:type=\"Single\">0.0</d:PropertySingle>\n" +
+ " <d:PropertyDouble m:type=\"Double\">0.0</d:PropertyDouble>\n" +
+ " <d:PropertyDecimal m:type=\"Decimal\">0</d:PropertyDecimal>\n" +
+ " <d:PropertyBinary m:type=\"Binary\">\n" +
+ " </d:PropertyBinary>\n" +
+ " <d:PropertyDate m:type=\"Date\">1970-01-01</d:PropertyDate>\n" +
+ " <d:PropertyDateTimeOffset m:type=\"DateTimeOffset\">2005-12-03T00:00:00Z</d:PropertyDateTimeOffset>\n" +
+ " <d:PropertyDuration m:type=\"Duration\">PT0S</d:PropertyDuration>\n" +
+ " <d:PropertyGuid m:type=\"Guid\">76543201-23ab-cdef-0123-456789cccddd</d:PropertyGuid>\n" +
+ " <d:PropertyTimeOfDay m:type=\"TimeOfDay\">00:01:01</d:PropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>\n";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
public void primitiveProperty() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");