@Test public void readIncompleteEntryMerge() throws Exception { XmlEntityDeserializer xec = new XmlEntityDeserializer(); EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); InputStream reqContent = createContentAsStream(ROOM_1_XML); EntityStream stream = new EntityStream(); stream.setContent(reqContent); stream.setReadProperties(DeserializerProperties.init().build()); ODataEntry result = xec.readEntry(entitySet, stream); EntryMetadata entryMetadata = result.getMetadata(); assertEquals("http: assertEquals("W/\"1\"", entryMetadata.getEtag()); assertEquals(null, entryMetadata.getUri()); MediaMetadata mediaMetadata = result.getMediaMetadata(); assertEquals("application/xml", mediaMetadata.getContentType()); assertEquals(null, mediaMetadata.getSourceLink()); assertEquals(null, mediaMetadata.getEditLink()); assertEquals(null, mediaMetadata.getEtag()); Map<String, Object> properties = result.getProperties(); assertEquals(1, properties.size()); assertEquals("1", properties.get("Id")); assertEquals("Rooms('1')/nr_Building", result.getMetadata().getAssociationUris("nr_Building").get(0)); assertEquals("Rooms('1')/nr_Employees", result.getMetadata().getAssociationUris("nr_Employees").get(0)); }
public ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(entity.getContent()); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryDeserializer().readEntry(reader, eia, entity.getReadProperties(), false); } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED. addContent(e.getClass() .getSimpleName()), e); } } } } }
XmlEntityDeserializer { public ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(entity.getContent()); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryDeserializer().readEntry(reader, eia, entity.getReadProperties(), false); } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED. addContent(e.getClass() .getSimpleName()), e); } } } } } }
XmlEntityDeserializer { public ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(entity.getContent()); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryDeserializer().readEntry(reader, eia, entity.getReadProperties(), false); } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED. addContent(e.getClass() .getSimpleName()), e); } } } } } XmlEntityDeserializer(); }
XmlEntityDeserializer { public ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(entity.getContent()); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryDeserializer().readEntry(reader, eia, entity.getReadProperties(), false); } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED. addContent(e.getClass() .getSimpleName()), e); } } } } } XmlEntityDeserializer(); ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final EntityStream entity); ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity); Object readCollection(final EntityPropertyInfo info, EntityStream entityStream); Map<String, Object> readProperty(final EntityPropertyInfo propertyInfo, final EntityStream entityStream); }
XmlEntityDeserializer { public ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(entity.getContent()); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryDeserializer().readEntry(reader, eia, entity.getReadProperties(), false); } catch (EntityProviderException e) { cachedException = e; throw cachedException; } finally { if (reader != null) { try { reader.close(); } catch (XMLStreamException e) { if (cachedException != null) { throw cachedException; } else { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED. addContent(e.getClass() .getSimpleName()), e); } } } } } XmlEntityDeserializer(); ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final EntityStream entity); ODataEntry readEntry(final EdmEntitySet entitySet, final EntityStream entity); Object readCollection(final EntityPropertyInfo info, EntityStream entityStream); Map<String, Object> readProperty(final EntityPropertyInfo propertyInfo, final EntityStream entityStream);  }