Examples of EdmProperty


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

  @Test
  public void complexPropertyNullValueNotAllowedButNotValidated() throws Exception {
    final String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" />";
    EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee")
        .getProperty("Location");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.isNullable()).thenReturn(false);
    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);
    assertFalse(resultMap.isEmpty());
View Full Code Here

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

    String xml = "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08
        + "\" m:null=\"true\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">"
        + "<City><PostalCode/><CityName/></City><Country>Germany</Country>"
        + "</Location>";
    XMLStreamReader reader = createReaderForTest(xml, true);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");

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

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

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

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

    assertNotNull(resultMap.get("Location"));
View Full Code Here

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

    EasyMock.replay(edmEntityContainer);
    return edmEntityContainer;
  }

  private EdmTyped getEdmTypedMockedObj(final String propertyName) {
    EdmProperty mockedEdmProperty = EasyMock.createMock(EdmProperty.class);
    try {
      EasyMock.expect(mockedEdmProperty.getMapping()).andStubReturn(getEdmMappingMockedObj(propertyName));
      EdmType edmType = EasyMock.createMock(EdmType.class);
      EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
      EasyMock.replay(edmType);
      EasyMock.expect(mockedEdmProperty.getName()).andStubReturn("identifier");
      EasyMock.expect(mockedEdmProperty.getType()).andStubReturn(edmType);
      EasyMock.expect(mockedEdmProperty.getFacets()).andStubReturn(getEdmFacetsMockedObj());

      EasyMock.replay(mockedEdmProperty);
    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
View Full Code Here

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

            "    </m:properties>" +
            "  </content>" +
            "</entry>";

    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
    final EdmProperty property = (EdmProperty) entitySet.getEntityType().getProperty("Version");
    EdmFacets facets = property.getFacets();
    Mockito.when(facets.isNullable()).thenReturn(false);

    InputStream reqContent = createContentAsStream(roomWithValidNamespaces);
    final ODataEntry result =
        new XmlEntityConsumer().readEntry(entitySet, reqContent, EntityProviderReadProperties.init().mergeSemantic(
View Full Code Here

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

    assertEquals("Rooms('1')/nr_Employees", result.getMetadata().getAssociationUris("nr_Employees").get(0));
  }

  @Test
  public void readProperty() throws Exception {
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");

    String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>";
    InputStream content = createContentAsStream(xml);
    Map<String, Object> value =
View Full Code Here

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

  @Test
  public void readStringPropertyValue() throws Exception {
    String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>";
    InputStream content = createContentAsStream(xml);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");

    Object result = new XmlEntityConsumer().readPropertyValue(property, content, String.class);

    assertEquals("Max Mustermann", result);
View Full Code Here

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

  @Test
  public void readLargeStringPropertyValue() throws Exception {
    String name = StringHelper.generateData(77777);
    String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">" + name + "</EmployeeName>";
    InputStream content = createContentAsStream(xml);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");

    Object result = new XmlEntityConsumer().readPropertyValue(property, content, String.class);

    assertEquals(name, result);
View Full Code Here

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

    assertEquals(name, result);
  }

  @Test
  public void testReadIntegerPropertyAsLong() throws Exception {
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age");

    String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">42</Age>";
    InputStream content = createContentAsStream(xml);
    Map<String, Object> value =
View Full Code Here

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

  @Test(expected = EntityProviderException.class)
  public void readStringPropertyValueWithInvalidMapping() throws Exception {
    String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>";
    InputStream content = createContentAsStream(xml);
    final EdmProperty property =
        (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EmployeeName");

    new XmlEntityConsumer().readPropertyValue(property, content, Integer.class);
  }
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.