@SuppressWarnings("unchecked") @Test public void testReadEntryWithLargeProperty() throws Exception { EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"); String newName = StringHelper.generateData(81920); InputStream contentBody = createContentAsStream(EMPLOYEE_1_XML.replaceAll("Walter Winter", newName)); XmlEntityConsumer xec = new XmlEntityConsumer(); ODataEntry result = xec.readEntry(entitySet, contentBody, EntityProviderReadProperties.init().mergeSemantic(false).build()); Map<String, Object> properties = result.getProperties(); assertEquals(9, properties.size()); assertEquals("1", properties.get("EmployeeId")); assertEquals(newName, properties.get("EmployeeName")); assertEquals("1", properties.get("ManagerId")); assertEquals("1", properties.get("RoomId")); assertEquals("1", properties.get("TeamId")); Map<String, Object> location = (Map<String, Object>) properties.get("Location"); assertEquals(2, location.size()); assertEquals("Germany", location.get("Country")); Map<String, Object> city = (Map<String, Object>) location.get("City"); assertEquals(2, city.size()); assertEquals("69124", city.get("PostalCode")); assertEquals("Heidelberg", city.get("CityName")); assertEquals(Integer.valueOf(52), properties.get("Age")); Calendar entryDate = (Calendar) properties.get("EntryDate"); assertEquals(915148800000L, entryDate.getTimeInMillis()); assertEquals(TimeZone.getTimeZone("GMT"), entryDate.getTimeZone()); assertEquals("/SAP/PUBLIC/BC/NWDEMO_MODEL/IMAGES/Employee_1.png", properties.get("ImageUrl")); }
public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(content); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryConsumer().readEntry(reader, eia, properties, 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); } } } } }
XmlEntityConsumer { public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(content); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryConsumer().readEntry(reader, eia, properties, 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); } } } } } }
XmlEntityConsumer { public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(content); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryConsumer().readEntry(reader, eia, properties, 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); } } } } } XmlEntityConsumer(); }
XmlEntityConsumer { public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(content); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryConsumer().readEntry(reader, eia, properties, 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); } } } } } XmlEntityConsumer(); ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EdmProperty edmProperty, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EntityPropertyInfo propertyInfo, final InputStream content,
      final EntityProviderReadProperties readProperties); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content, final Class<?> typeMapping); Object readCollection(final EntityPropertyInfo info, InputStream content,
      final EntityProviderReadProperties properties); String readLink(final EdmEntitySet entitySet, final Object content); List<String> readLinks(final EdmEntitySet entitySet, final Object content); }
XmlEntityConsumer { public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = XmlHelper.createStreamReader(content); EntityInfoAggregator eia = EntityInfoAggregator.create(entitySet); return new XmlEntryConsumer().readEntry(reader, eia, properties, 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); } } } } } XmlEntityConsumer(); ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EdmProperty edmProperty, final InputStream content,
      final EntityProviderReadProperties properties); Map<String, Object> readProperty(final EntityPropertyInfo propertyInfo, final InputStream content,
      final EntityProviderReadProperties readProperties); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content); Object readPropertyValue(final EdmProperty edmProperty, final InputStream content, final Class<?> typeMapping); Object readCollection(final EntityPropertyInfo info, InputStream content,
      final EntityProviderReadProperties properties); String readLink(final EdmEntitySet entitySet, final Object content); List<String> readLinks(final EdmEntitySet entitySet, final Object content);  }