@Test @SuppressWarnings("unchecked") public void readComplexPropertyWithMappings() throws Exception { String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\"" + " xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" m:type=\"RefScenario.c_Location\">" + "<Country>Germany</Country>" + "<City m:type=\"RefScenario.c_City\">" + " <PostalCode>69124</PostalCode>" + " <CityName>Heidelberg</CityName>" + "</City>" + "</Location>"; XMLStreamReader reader = createReaderForTest(xml, true); EdmProperty locationComplexProperty = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location"); EdmProperty cityProperty = (EdmProperty) ((EdmComplexType) locationComplexProperty.getType()).getProperty("City"); EdmProperty postalCodeProperty = (EdmProperty) ((EdmComplexType) cityProperty.getType()).getProperty("PostalCode"); when(postalCodeProperty.getType()).thenReturn(EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance()); EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class); when(readProperties.getTypeMappings()).thenReturn( createTypeMappings("Location", createTypeMappings("City", createTypeMappings("CityName", String.class, "PostalCode", Long.class)))); Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, locationComplexProperty, readProperties); Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location"); assertEquals("Germany", locationMap.get("Country")); Map<String, Object> cityMap = (Map<String, Object>) locationMap.get("City"); assertEquals(Long.valueOf("69124"), cityMap.get("PostalCode")); assertEquals("Heidelberg", cityMap.get("CityName")); }
public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { return readProperty(reader, EntityInfoAggregator.create(property), readProperties); }
XmlPropertyConsumer { public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { return readProperty(reader, EntityInfoAggregator.create(property), readProperties); } }
XmlPropertyConsumer { public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { return readProperty(reader, EntityInfoAggregator.create(property), readProperties); }  }
XmlPropertyConsumer { public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { return readProperty(reader, EntityInfoAggregator.create(property), readProperties); }  Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property,
      final EntityProviderReadProperties readProperties); Map<String, Object> readProperty(final XMLStreamReader reader, final EntityPropertyInfo propertyInfo,
      final EntityProviderReadProperties readProperties); List<?> readCollection(XMLStreamReader reader, final EntityPropertyInfo info,
      final EntityProviderReadProperties properties); }
XmlPropertyConsumer { public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { return readProperty(reader, EntityInfoAggregator.create(property), readProperties); }  Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property,
      final EntityProviderReadProperties readProperties); Map<String, Object> readProperty(final XMLStreamReader reader, final EntityPropertyInfo propertyInfo,
      final EntityProviderReadProperties readProperties); List<?> readCollection(XMLStreamReader reader, final EntityPropertyInfo info,
      final EntityProviderReadProperties properties);  }