Package org.apache.olingo.odata2.api.uri.expression

Examples of org.apache.olingo.odata2.api.uri.expression.PropertyExpression


        EasyMock.replay(edmType);
      } catch (EdmException e2) {
        fail("Exception not Expected");
      }

      PropertyExpression commonExpression = EasyMock.createMock(PropertyExpression.class);
      EasyMock.expect(commonExpression.getEdmType()).andStubReturn(edmType);

      EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
      EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
      EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
      try {
        EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
      } catch (EdmException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      EasyMock.expect(commonExpression.getEdmProperty()).andStubReturn(edmTyped);
      OrderExpression order = EasyMock.createMock(OrderExpression.class);
      EasyMock.expect(order.getExpression()).andStubReturn(commonExpression);
      EasyMock.expect(order.getSortOrder()).andStubReturn(orderType[i]);
      EasyMock.replay(edmMapping, edmTyped, commonExpression);
      EasyMock.replay(order);
View Full Code Here


    EasyMock.replay(filterExpression);
    return filterExpression;
  }

  private PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andReturn(ExpressionKind.PROPERTY);
    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andReturn(propertyName);
    EdmProperty edmtTyped = EasyMock.createMock(EdmProperty.class);
    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(mapping.getInternalName()).andStubReturn("field");
    try {
      EasyMock.expect(edmtTyped.getMapping()).andStubReturn(mapping);
    } catch (EdmException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andReturn(edmtTyped);
    EasyMock.replay(mapping, edmtTyped, leftOperandPropertyExpresion);
    return leftOperandPropertyExpresion;
  }
View Full Code Here

    EasyMock.replay(facets);
    return facets;
  }

  private PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andStubReturn(ExpressionKind.PROPERTY);
    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andStubReturn(propertyName);
    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andStubReturn(getEdmTypedMockedObj(propertyName));
    EasyMock.replay(leftOperandPropertyExpresion);
    return leftOperandPropertyExpresion;
  }
View Full Code Here

      final EdmSimpleType propertyType = (EdmSimpleType) property.getType();
      return propertyType.valueToString(getPropertyValue(data, property), EdmLiteralKind.DEFAULT, property.getFacets());

    case MEMBER:
      final MemberExpression memberExpression = (MemberExpression) expression;
      final PropertyExpression propertyExpression = (PropertyExpression) memberExpression.getProperty();
      final EdmProperty memberProperty = (EdmProperty) propertyExpression.getEdmProperty();
      final EdmSimpleType memberType = (EdmSimpleType) memberExpression.getEdmType();
      List<EdmProperty> propertyPath = new ArrayList<EdmProperty>();
      CommonExpression currentExpression = memberExpression;
      while (currentExpression != null) {
        final PropertyExpression currentPropertyExpression =
            (PropertyExpression) (currentExpression.getKind() == ExpressionKind.MEMBER ?
                ((MemberExpression) currentExpression).getProperty() : currentExpression);
        final EdmTyped currentProperty = currentPropertyExpression.getEdmProperty();
        final EdmTypeKind kind = currentProperty.getType().getKind();
        if (kind == EdmTypeKind.SIMPLE || kind == EdmTypeKind.COMPLEX) {
          propertyPath.add(0, (EdmProperty) currentProperty);
        } else {
          throw new ODataNotImplementedException();
View Full Code Here

    EasyMock.replay(facets);
    return facets;
  }

  private PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andStubReturn(ExpressionKind.PROPERTY);
    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andStubReturn(propertyName);
    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andStubReturn(getEdmTypedMockedObj(propertyName));
    EasyMock.replay(leftOperandPropertyExpresion);
    return leftOperandPropertyExpresion;
  }
View Full Code Here

        EasyMock.replay(edmType);
      } catch (EdmException e2) {
        fail("Exception not Expected");
      }

      PropertyExpression commonExpression = EasyMock.createMock(PropertyExpression.class);
      EasyMock.expect(commonExpression.getEdmType()).andStubReturn(edmType);

      EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);
      EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
      EasyMock.expect(edmMapping.getInternalName()).andStubReturn(fields[i]);
      try {
        EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);
      } catch (EdmException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      EasyMock.expect(commonExpression.getEdmProperty()).andStubReturn(edmTyped);
      OrderExpression order = EasyMock.createMock(OrderExpression.class);
      EasyMock.expect(order.getExpression()).andStubReturn(commonExpression);
      EasyMock.expect(order.getSortOrder()).andStubReturn(orderType[i]);
      EasyMock.replay(edmMapping, edmTyped, commonExpression);
      EasyMock.replay(order);
View Full Code Here

    EasyMock.replay(filterExpression);
    return filterExpression;
  }

  private PropertyExpression getPropertyExpressionMockedObj(final ExpressionKind expKind, final String propertyName) {
    PropertyExpression leftOperandPropertyExpresion = EasyMock.createMock(PropertyExpression.class);
    EasyMock.expect(leftOperandPropertyExpresion.getKind()).andReturn(ExpressionKind.PROPERTY);
    EasyMock.expect(leftOperandPropertyExpresion.getPropertyName()).andReturn(propertyName);
    EdmProperty edmtTyped = EasyMock.createMock(EdmProperty.class);
    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(mapping.getInternalName()).andStubReturn("field");
    try {
      EasyMock.expect(edmtTyped.getMapping()).andStubReturn(mapping);
    } catch (EdmException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    EasyMock.expect(leftOperandPropertyExpresion.getEdmProperty()).andReturn(edmtTyped);
    EasyMock.replay(mapping, edmtTyped, leftOperandPropertyExpresion);
    return leftOperandPropertyExpresion;
  }
View Full Code Here

      return propertyType.valueToString(valueAccess.getPropertyValue(data, property), EdmLiteralKind.DEFAULT,
          property.getFacets());

    case MEMBER:
      final MemberExpression memberExpression = (MemberExpression) expression;
      final PropertyExpression propertyExpression = (PropertyExpression) memberExpression.getProperty();
      final EdmProperty memberProperty = (EdmProperty) propertyExpression.getEdmProperty();
      final EdmSimpleType memberType = (EdmSimpleType) memberExpression.getEdmType();
      List<EdmProperty> propertyPath = new ArrayList<EdmProperty>();
      CommonExpression currentExpression = memberExpression;
      while (currentExpression != null) {
        final PropertyExpression currentPropertyExpression =
            (PropertyExpression) (currentExpression.getKind() == ExpressionKind.MEMBER ?
                ((MemberExpression) currentExpression).getProperty() : currentExpression);
        final EdmTyped currentProperty = currentPropertyExpression.getEdmProperty();
        final EdmTypeKind kind = currentProperty.getType().getKind();
        if (kind == EdmTypeKind.SIMPLE || kind == EdmTypeKind.COMPLEX) {
          propertyPath.add(0, (EdmProperty) currentProperty);
        } else {
          throw new ODataNotImplementedException();
View Full Code Here

      return propertyType.valueToString(valueAccess.getPropertyValue(data, property), EdmLiteralKind.DEFAULT,
          property.getFacets());

    case MEMBER:
      final MemberExpression memberExpression = (MemberExpression) expression;
      final PropertyExpression propertyExpression = (PropertyExpression) memberExpression.getProperty();
      final EdmProperty memberProperty = (EdmProperty) propertyExpression.getEdmProperty();
      final EdmSimpleType memberType = (EdmSimpleType) memberExpression.getEdmType();
      List<EdmProperty> propertyPath = new ArrayList<EdmProperty>();
      CommonExpression currentExpression = memberExpression;
      while (currentExpression != null) {
        final PropertyExpression currentPropertyExpression =
            (PropertyExpression) (currentExpression.getKind() == ExpressionKind.MEMBER ?
                ((MemberExpression) currentExpression).getProperty() : currentExpression);
        final EdmTyped currentProperty = currentPropertyExpression.getEdmProperty();
        final EdmTypeKind kind = currentProperty.getType().getKind();
        if (kind == EdmTypeKind.SIMPLE || kind == EdmTypeKind.COMPLEX) {
          propertyPath.add(0, (EdmProperty) currentProperty);
        } else {
          throw new ODataNotImplementedException();
View Full Code Here

  /*
   * This Unit is supposed to test the building of Entity Provider Properties for query with $expand
   */
  @Test
  public void testGetEntityProviderPropertiesQuery() {
    GetEntitySetUriInfo getEntitySetUriInfo = mockEntitySetUriInfoForExpand();
    ODataJPAContext oDataJPAContext = getODataJPAContext();
    // Building the edm entity
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    Map<String, Object> edmEntity = new HashMap<String, Object>();
    edmEntity.put("ID", 1);
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.uri.expression.PropertyExpression

Copyright © 2018 www.massapicom. 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.