[OLINGO-832] Fix in xml serialization for streamed entity set/iterator

This commit is contained in:
Michael Bolz 2016-02-26 08:02:39 +01:00
parent a44f38d70d
commit 40ff7be0f3
3 changed files with 4 additions and 17 deletions

View File

@ -74,11 +74,10 @@ public class BasicStreamITCase extends AbstractBaseTestITCase {
assertTrue(content.contains("<m:element>Streamed-Employee1@company.example</m:element>" +
"<m:element>Streamed-Employee2@company.example</m:element>" +
"<m:element>Streamed-Employee3@company.example</m:element>"));
assertTrue(content.contains("<d:PropertyString>TEST 1</d:PropertyString>"));
assertTrue(content.contains("<d:PropertyString>TEST 2</d:PropertyString>"));
assertTrue(content.contains("<d:PropertyString>TEST 1->streamed</d:PropertyString>"));
assertTrue(content.contains("<d:PropertyString>TEST 2->streamed</d:PropertyString>"));
}
@Override
protected ODataClient getClient() {
return null;

View File

@ -286,16 +286,8 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
EntityCollectionSerializerOptions options, OutputStream outputStream) throws SerializerException {
final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
// if (options != null && options.getWriteOnlyReferences()) {
// ReferenceCollectionSerializerOptions rso = ReferenceCollectionSerializerOptions.with()
// .contextURL(contextURL).build();
// return entityReferenceCollection(entitySet, rso);
// }
SerializerException cachedException = null;
SerializerException cachedException;
try {
CircleStreamBuffer buffer = new CircleStreamBuffer();
outputStream = buffer.getOutputStream();
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
writer.writeStartDocument(DEFAULT_CHARSET, "1.0");
writer.writeStartElement(ATOM, Constants.ATOM_ELEM_FEED, NS_ATOM);
@ -317,9 +309,6 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
&& entitySet.getCount() != null) {
writeCount(entitySet, writer);
}
if (entitySet.getNext() != null) {
writeNextLink(entitySet, writer);
}
if (options == null) {
writeEntitySet(metadata, entityType, entitySet, null, null, null, writer);

View File

@ -567,8 +567,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
* otherwise <code>FALSE</code>.
*/
private boolean isStreaming(EdmEntitySet edmEntitySet, ContentType contentType) {
return contentType.isCompatible(ContentType.APPLICATION_JSON)
&& ContainerProvider.ES_STREAM.equalsIgnoreCase(edmEntitySet.getName());
return ContainerProvider.ES_STREAM.equalsIgnoreCase(edmEntitySet.getName());
}
private SerializerResult serializeEntityCollection(final ODataRequest request, final EntityCollection