Examples of EdmProperty


Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test
  public void readStringPropertyEmpty() throws Exception {
    final String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");

    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);

    assertTrue(resultMap.containsKey("EmployeeName"));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test
  public void readStringPropertyNull() throws Exception {
    final String xml = "<EntryDate xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");

    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);

    assertTrue(resultMap.containsKey("EntryDate"));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test
  public void readStringPropertyNullFalse() throws Exception {
    final String xml = "<EntryDate xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"false\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">1970-01-02T00:00:00</EntryDate>";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");

    final Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);

    assertEquals(86400000L, ((Calendar) resultMap.get("EntryDate")).getTimeInMillis());
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test(expected = EntityProviderException.class)
  public void invalidSimplePropertyName() throws Exception {
    final String xml = "<Invalid xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Invalid>";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");

    new XmlPropertyConsumer().readProperty(reader, property, false, null);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test(expected = EntityProviderException.class)
  public void invalidNullAttribute() throws Exception {
    final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"wrong\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");

    new XmlPropertyConsumer().readProperty(reader, property, false, null);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  @Test(expected = EntityProviderException.class)
  public void nullValueNotAllowed() throws Exception {
    final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    XMLStreamReader reader = createReaderForTest(xml, true);
    EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    when(property.getFacets()).thenReturn(facets);

    new XmlPropertyConsumer().readProperty(reader, property, false, null);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  }

  @Test(expected = EntityProviderException.class)
  public void violatedValidation() throws Exception {
    final String xml = "<Name xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">TooLongName</Name>";
    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Team")
        .getProperty("Name");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(10);
    when(property.getFacets()).thenReturn(facets);

    new XmlPropertyConsumer().readProperty(createReaderForTest(xml, true), property, false, null);
  }
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

  }

  @Test
  public void ignoringValidation() throws Exception {
    final String xml = "<Name xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">TooLongName</Name>";
    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Team")
        .getProperty("Name");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(10);
    when(property.getFacets()).thenReturn(facets);
    final EntityProviderReadProperties readProperties = mock(EntityProviderReadProperties.class);

    final Map<String, Object> resultMap = new XmlPropertyConsumer()
        .readProperty(createReaderForTest(xml, true), property, false, readProperties);
    assertTrue(resultMap.containsKey("Name"));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

            "<PostalCode>69124</PostalCode>" +
            "<CityName>Heidelberg</CityName>" +
            "</City>" +
            "</Location>";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");

    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);

    Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.EdmProperty

            "<CityName>Heidelberg</CityName>" +
            "</City>" +
            "</Location>" +
            "\n        \n ";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");

    Map<String, Object> resultMap = new XmlPropertyConsumer().readProperty(reader, property, false, null);

    Map<String, Object> locationMap = (Map<String, Object>) resultMap.get("Location");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.