Repository: olingo-odata4 Updated Branches: refs/heads/master 280bc019c -> b7005b774
OLINGO-865: fixing the bug with extended complex types during serilization Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8468308a Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8468308a Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8468308a Branch: refs/heads/master Commit: 8468308aeb2920e52d56b23101e59b3cf6b0e6f8 Parents: 280bc01 Author: Ramesh Reddy <[email protected]> Authored: Sun Feb 7 17:06:22 2016 -0600 Committer: Ramesh Reddy <[email protected]> Committed: Sun Feb 7 17:06:22 2016 -0600 ---------------------------------------------------------------------- .../serializer/json/ODataJsonSerializer.java | 42 +++++++---- .../core/serializer/xml/ODataXmlSerializer.java | 18 +++-- .../olingo/server/tecsvc/data/DataCreator.java | 17 ++++- .../tecsvc/provider/ComplexTypeProvider.java | 8 ++ .../json/ODataJsonSerializerTest.java | 34 ++++++++- .../serializer/xml/ODataXmlSerializerTest.java | 77 +++++++++++++++++++- 6 files changed, 166 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 a912862..3f3ba26 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 @@ -264,7 +264,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { if (!isODataMetadataNone && !resolvedType.equals(entityType)) { json.writeStringField(Constants.JSON_TYPE, "#" + entity.getType()); } - writeProperties(resolvedType, entity.getProperties(), select, json); + writeProperties(metadata, resolvedType, entity.getProperties(), select, json); writeNavigationProperties(metadata, resolvedType, entity, expand, json); json.writeEndObject(); } @@ -318,7 +318,8 @@ public class ODataJsonSerializer extends AbstractODataSerializer { .getFullQualifiedName().getFullQualifiedNameAsString()); } - protected void writeProperties(final EdmStructuredType type, final List<Property> properties, + protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type, + final List<Property> properties, final SelectOption select, final JsonGenerator json) throws IOException, SerializerException { final boolean all = ExpandSelectHelper.isAll(select); @@ -330,7 +331,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { final Property property = findProperty(propertyName, properties); final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName); - writeProperty(edmProperty, property, selectedPaths, json); + writeProperty(metadata, edmProperty, property, selectedPaths, json); } } } @@ -382,7 +383,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } } - protected void writeProperty(final EdmProperty edmProperty, final Property property, + protected void writeProperty(final ServiceMetadata metadata, final EdmProperty edmProperty, final Property property, final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException { json.writeFieldName(edmProperty.getName()); @@ -399,11 +400,11 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } } } else { - writePropertyValue(edmProperty, property, selectedPaths, json); + writePropertyValue(metadata, edmProperty, property, selectedPaths, json); } } - private void writePropertyValue(final EdmProperty edmProperty, + private void writePropertyValue(final ServiceMetadata metadata, final EdmProperty edmProperty, final Property property, final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException { final EdmType type = edmProperty.getType(); @@ -421,9 +422,10 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } } else if (property.isComplex()) { if (edmProperty.isCollection()) { - writeComplexCollection((EdmComplexType) type, property, selectedPaths, json); + writeComplexCollection(metadata, (EdmComplexType) type, property, selectedPaths, json); } else { - writeComplexValue((EdmComplexType) type, property.asComplex().getValue(), selectedPaths, json); + writeComplexValue(metadata, property, (EdmComplexType) type, property.asComplex().getValue(), selectedPaths, + json); } } else { throw new SerializerException("Property type not yet supported!", @@ -464,14 +466,15 @@ public class ODataJsonSerializer extends AbstractODataSerializer { json.writeEndArray(); } - private void writeComplexCollection(final EdmComplexType type, final Property property, + private void writeComplexCollection(final ServiceMetadata metadata, final EdmComplexType type, + final Property property, final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException { json.writeStartArray(); for (Object value : property.asCollection()) { switch (property.getValueType()) { case COLLECTION_COMPLEX: - writeComplexValue(type, ((ComplexValue) value).getValue(), selectedPaths, json); + writeComplexValue(metadata, property, type, ((ComplexValue) value).getValue(), selectedPaths, json); break; default: throw new SerializerException("Property type not yet supported!", @@ -524,14 +527,23 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } } - protected void writeComplexValue(final EdmComplexType type, final List<Property> properties, + protected void writeComplexValue(final ServiceMetadata metadata, final Property complexProperty, + final EdmComplexType type, final List<Property> properties, final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException { json.writeStartObject(); - for (final String propertyName : type.getPropertyNames()) { + + final EdmComplexType resolvedType = resolveComplexType(metadata, + type, complexProperty.getType()); + if (!isODataMetadataNone && !resolvedType.equals(type)) { + json.writeStringField(Constants.JSON_TYPE, + "#" + complexProperty.getType()); + } + + for (final String propertyName : resolvedType.getPropertyNames()) { final Property property = findProperty(propertyName, properties); if (selectedPaths == null || ExpandSelectHelper.isSelected(selectedPaths, propertyName)) { - writeProperty((EdmProperty) type.getProperty(propertyName), property, + writeProperty(metadata, (EdmProperty) resolvedType.getProperty(propertyName), property, selectedPaths == null ? null : ExpandSelectHelper.getReducedSelectedPaths(selectedPaths, propertyName), json); } @@ -610,7 +622,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } final List<Property> values = property.isNull() ? Collections.<Property> emptyList() : property.asComplex().getValue(); - writeProperties(type, values, options == null ? null : options.getSelect(), json); + writeProperties(metadata, type, values, options == null ? null : options.getSelect(), json); if (!property.isNull() && property.isComplex()) { writeNavigationProperties(metadata, type, property.asComplex(), options == null ? null : options.getExpand(), json); @@ -677,7 +689,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { writeContextURL(contextURL, json); writeMetadataETag(metadata, json); json.writeFieldName(Constants.VALUE); - writeComplexCollection(type, property, null, json); + writeComplexCollection(metadata, type, property, null, json); json.writeEndObject(); json.close(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 52d12e4..0057db4 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 @@ -635,8 +635,8 @@ public class ODataXmlSerializer extends AbstractODataSerializer { private String derivedComplexType(final EdmComplexType baseType, final String definedType) throws SerializerException { - String derived = baseType.getFullQualifiedName().getFullQualifiedNameAsString(); - if (derived.equals(definedType)) { + String base = baseType.getFullQualifiedName().getFullQualifiedNameAsString(); + if (base.equals(definedType)) { return null; } return definedType; @@ -671,7 +671,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer { } else { writer.writeAttribute(METADATA, NS_METADATA, Constants.ATTR_TYPE, "#" + complexType(metadata, (EdmComplexType) edmProperty.getType(), property.getType())); - writeComplexValue(metadata, (EdmComplexType) edmProperty.getType(), property.asComplex().getValue(), + writeComplexValue(metadata, property, (EdmComplexType) edmProperty.getType(), property.asComplex().getValue(), selectedPaths, writer); } } else { @@ -717,7 +717,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer { } switch (property.getValueType()) { case COLLECTION_COMPLEX: - writeComplexValue(metadata, type, ((ComplexValue) value).getValue(), selectedPaths, writer); + writeComplexValue(metadata, property, type, ((ComplexValue) value).getValue(), selectedPaths, writer); break; default: throw new SerializerException("Property type not yet supported!", @@ -767,13 +767,17 @@ public class ODataXmlSerializer extends AbstractODataSerializer { } } - protected void writeComplexValue(final ServiceMetadata metadata, final EdmComplexType type, + protected void writeComplexValue(final ServiceMetadata metadata, Property complexProperty, final EdmComplexType type, final List<Property> properties, final Set<List<String>> selectedPaths, final XMLStreamWriter writer) throws XMLStreamException, SerializerException { - for (final String propertyName : type.getPropertyNames()) { + + final EdmComplexType resolvedType = resolveComplexType(metadata, + type, complexProperty.getType()); + + for (final String propertyName : resolvedType.getPropertyNames()) { final Property property = findProperty(propertyName, properties); if (selectedPaths == null || ExpandSelectHelper.isSelected(selectedPaths, propertyName)) { - writeProperty(metadata, (EdmProperty) type.getProperty(propertyName), property, + writeProperty(metadata, (EdmProperty) resolvedType.getProperty(propertyName), property, selectedPaths == null ? null : ExpandSelectHelper.getReducedSelectedPaths(selectedPaths, propertyName), writer); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 5c60b38..80a3146 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 @@ -44,6 +44,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.serializer.SerializerException; import org.apache.olingo.server.api.uri.UriHelper; +import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider; import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider; public class DataCreator { @@ -1003,10 +1004,12 @@ public class DataCreator { entity = new Entity(); entity.addProperty(createPrimitive("PropertyInt16", (short) 2)); - entity.addProperty(createComplex("PropertyComp", - createComplex("PropertyComp", + entity.addProperty(createComplex("PropertyComp", + ComplexTypeProvider.nameCTCompCompExtended.getFullQualifiedNameAsString(), + createComplex("PropertyComp", createPrimitive("PropertyInt16", (short) 987), - createPrimitive("PropertyString", "String 2")))); + createPrimitive("PropertyString", "String 2")), + createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))); entityCollection.getEntities().add(entity); setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETCompComp)); @@ -1174,6 +1177,14 @@ public class DataCreator { } return new Property(null, name, ValueType.COMPLEX, complexValue); } + + protected static Property createComplex(final String name, final String type, final Property... properties) { + ComplexValue complexValue = new ComplexValue(); + for (final Property property : properties) { + complexValue.getValue().add(property); + } + return new Property(type, name, ValueType.COMPLEX, complexValue); + } protected static Property createComplexCollection(final String name, final List<Property>... propertiesList) { List<ComplexValue> complexCollection = new ArrayList<ComplexValue>(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 502f83a..7d539b6 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 @@ -38,6 +38,8 @@ public class ComplexTypeProvider { public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompCollComp"); public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompComp"); + public static final FullQualifiedName nameCTCompCompExtended = new FullQualifiedName( + SchemaProvider.NAMESPACE, "CTCompCompExtended"); public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompNav"); public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE, @@ -125,6 +127,12 @@ public class ComplexTypeProvider { .setName("CTCompComp") .setProperties(Arrays.asList(PropertyProvider.propertyComp_CTTwoPrim)); + } else if (complexTypeName.equals(nameCTCompCompExtended)) { + return new CsdlComplexType() + .setName("CTCompCompExtended") + .setBaseType(nameCTCompComp) + .setProperties(Arrays.asList(PropertyProvider.propertyDate)); + } else if (complexTypeName.equals(nameCTCompCollComp)) { return new CsdlComplexType() .setName("CTCompCollComp") http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 7761b1d..0ad7ac5 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 @@ -560,9 +560,38 @@ public class ODataJsonSerializerTest { + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\"," + "\"value\":[" + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyString\":\"String 1\"}}}," - + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyString\":\"String 2\"}}}]}", + + "{\"PropertyComp\":{\"@odata.type\":\"#olingo.odata.test1.CTCompCompExtended\"," + + "\"PropertyComp\":{\"PropertyString\":\"String 2\"}}}]}", resultString); } + + @Test + public void selectExtendedComplexType() throws Exception { + final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp"); + final EdmEntityType entityType = edmEntitySet.getEntityType(); + final EntityCollection entitySet = data.readAll(edmEntitySet); + InputStream result = serializer + .entityCollection(metadata, entityType, entitySet, + EntityCollectionSerializerOptions.with() + .contextURL(ContextURL.with().entitySet(edmEntitySet) + .selectList(helper.buildContextURLSelectList(entityType, null, null)) + .build()) + .build()).getContent(); + final String resultString = IOUtils.toString(result); + + String expected = "{" + + "\"@odata.context\":\"$metadata#ESCompComp\"," + + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\"," + + "\"value\":[" + + "{\"PropertyInt16\":1," + + "\"PropertyComp\":{\"PropertyComp\":{" + + "\"PropertyInt16\":123,\"PropertyString\":\"String 1\"}}}," + + "{\"PropertyInt16\":2," + + "\"PropertyComp\":{\"@odata.type\":\"#olingo.odata.test1.CTCompCompExtended\"," + + "\"PropertyComp\":{\"PropertyInt16\":987,\"PropertyString\":\"String 2\"},\"PropertyDate\":\"2012-12-03\"}}]}"; + Assert.assertEquals(expected, resultString); + + } @Test public void selectComplexTwice() throws Exception { @@ -585,7 +614,8 @@ public class ODataJsonSerializerTest { + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\"," + "\"value\":[" + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyInt16\":123,\"PropertyString\":\"String 1\"}}}," - + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyInt16\":987,\"PropertyString\":\"String 2\"}}}]}", + + "{\"PropertyComp\":{\"@odata.type\":\"#olingo.odata.test1.CTCompCompExtended\"," + + "\"PropertyComp\":{\"PropertyInt16\":987,\"PropertyString\":\"String 2\"}}}]}", resultString); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8468308a/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 9611500..c904ea7 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 @@ -1044,7 +1044,7 @@ public class ODataXmlSerializerTest { " term=\"#olingo.odata.test1.ETCompComp\" />\n" + " <a:content type=\"application/xml\">\n" + " <m:properties>\n" + - " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompCompExtended\">\n" + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" + " <d:PropertyString>String 2</d:PropertyString>\n" + " </d:PropertyComp>\n" + @@ -1057,6 +1057,77 @@ public class ODataXmlSerializerTest { } @Test + public void selectComplexExtended() throws Exception { + final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp"); + final EdmEntityType entityType = edmEntitySet.getEntityType(); + final EntityCollection entitySet = data.readAll(edmEntitySet); + long currentTimeMillis = System.currentTimeMillis(); + InputStream result = serializer + .entityCollection(metadata, entityType, entitySet, + EntityCollectionSerializerOptions.with() + .contextURL(ContextURL.with().entitySet(edmEntitySet) + .selectList(helper.buildContextURLSelectList(entityType, null, null)) + .build()) + .id("http://host/svc/ESCompComp") + .build()).getContent(); + final String resultString = IOUtils.toString(result); + String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\" xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" " + + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" m:context=\"$metadata#ESCompComp\" " + + "m:metadata-etag=\"metadataETag\">\n" + + " <a:id>http://host/svc/ESCompComp</a:id>\n" + + " <a:entry>\n" + + " <a:id>ESCompComp(1)</a:id>\n" + + " <a:title />\n" + + " <a:summary />\n" + + " <a:updated>"+ UPDATED_FORMAT.format(new Date(currentTimeMillis)) +"</a:updated>\n" + + " <a:author>\n" + + " <a:name />\n" + + " </a:author>\n" + + " <a:link rel=\"edit\" href=\"ESCompComp(1)\" />\n" + + " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" " + + "term=\"#olingo.odata.test1.ETCompComp\" />\n" + + " <a:content type=\"application/xml\">\n" + + " <m:properties>\n" + + " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" + + " <d:PropertyInt16 m:type=\"Int16\">123</d:PropertyInt16>\n" + + " <d:PropertyString>String 1</d:PropertyString>\n" + + " </d:PropertyComp>\n" + + " </d:PropertyComp>\n" + + " </m:properties>\n" + + " </a:content>\n" + + " </a:entry>\n" + + " <a:entry>\n" + + " <a:id>ESCompComp(2)</a:id>\n" + + " <a:title />\n" + + " <a:summary />\n" + + " <a:updated>"+ UPDATED_FORMAT.format(new Date(currentTimeMillis)) +"</a:updated>\n" + + " <a:author>\n" + + " <a:name />\n" + + " </a:author>\n" + + " <a:link rel=\"edit\" href=\"ESCompComp(2)\" />\n" + + " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" " + + "term=\"#olingo.odata.test1.ETCompComp\" />\n" + + " <a:content type=\"application/xml\">\n" + + " <m:properties>\n" + + " <d:PropertyInt16 m:type=\"Int16\">2</d:PropertyInt16>\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompCompExtended\">\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" + + " <d:PropertyInt16 m:type=\"Int16\">987</d:PropertyInt16>\n" + + " <d:PropertyString>String 2</d:PropertyString>\n" + + " </d:PropertyComp>\n" + + " <d:PropertyDate m:type=\"Date\">2012-12-03</d:PropertyDate>\n" + + " </d:PropertyComp>\n" + + " </m:properties>\n" + + " </a:content>\n" + + " </a:entry>\n" + + "</a:feed>"; + checkXMLEqual(expected, resultString); + } + + @Test public void selectComplexTwice() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp"); final EdmEntityType entityType = edmEntitySet.getEntityType(); @@ -1117,7 +1188,7 @@ public class ODataXmlSerializerTest { " term=\"#olingo.odata.test1.ETCompComp\" />\n" + " <a:content type=\"application/xml\">\n" + " <m:properties>\n" + - " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" + + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompCompExtended\">\n" + " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" + " <d:PropertyInt16 m:type=\"Int16\">987</d:PropertyInt16>\n" + " <d:PropertyString>String 2</d:PropertyString>\n" + @@ -1127,7 +1198,7 @@ public class ODataXmlSerializerTest { " </a:content>\n" + " </a:entry>\n" + "</a:feed>\n"; - checkXMLEqual(expected, resultString); + checkXMLEqual(resultString, expected); } @Test
