Examples of KeyPredicate


Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

      HashMap<String, String> options = new HashMap<String, String>();
      List<KeyPredicate> keyPredicates = uriInfo.getNavigationSegments().get(0).getKeyPredicates();
      StringBuffer condition = new StringBuffer();
      String literal = null;
      KeyPredicate keyPredicate = null;
      int size = keyPredicates.size();
      for (int i = 0; i < size; i++) {
        keyPredicate = keyPredicates.get(i);

        literal = ((EdmSimpleType) keyPredicate.getProperty().getType()).toUriLiteral(keyPredicate.getLiteral());
        condition.append(keyPredicate.getProperty().getName()).append(SPACE);
        condition.append(ODATA_OPERATOR_NE).append(SPACE);
        condition.append(literal).append(SPACE);
        if (i != size - 1) {
          condition.append(ODATA_OPERATOR_AND).append(SPACE);
        }
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    EasyMock.replay(edmMapping, edmMapping1, edmEntityType, associationEnd, association, navigationProperty);
    return navigationProperty;
  }

  private List<KeyPredicate> createKeyPredicates(final boolean toThrowException) throws EdmException {
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid");
    EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
    EasyMock.expect(edmProperty.getName()).andStubReturn("soid");
    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    if (toThrowException) {
      EasyMock.expect(edmProperty.getType()).andStubThrow(new EdmException(null));
    } else {
      EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
    }
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty);

    EasyMock.replay(edmType, edmMapping, edmProperty, keyPredicate);
    List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
    keyPredicates.add(keyPredicate);
    return keyPredicates;
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
    EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
    List<SelectItem> selectItemList = null;

    // Setting up the expected value
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1");
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    try {
      EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);

      EasyMock.expect(kpProperty.getMapping()).andStubReturn(edmMapping);

    } catch (EdmException e2) {
      fail("this should not happen");
    }
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
    EasyMock.replay(edmMapping, edmType, kpProperty, keyPredicate);
    EasyMock.expect(getEntityView.getTargetEntitySet()).andStubReturn(edmEntitySet);
    EasyMock.expect(getEntityView.getSelect()).andStubReturn(selectItemList);

    EasyMock.expect(edmEntitySet.getEntityType()).andStubReturn(edmEntityType);
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    keyPredicates = new ArrayList<KeyPredicate>();
    GetEntitySetUriInfo resultsView = EasyMock.createMock(GetEntitySetUriInfo.class);

    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
    EdmType edmType1 = EasyMock.createMock(EdmType.class);
    EdmMapping mapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    try {
      EasyMock.expect(mapping.getInternalName()).andStubReturn("Field1");
      EasyMock.expect(kpProperty.getMapping()).andStubReturn(mapping);
      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType1);

    } catch (EdmException e2) {
      fail("this should not happen");
    }
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
    EasyMock.replay(mapping, edmType1, kpProperty, keyPredicate);
    keyPredicates.add(keyPredicate);
    int i = 0;
    List<OrderExpression> orderList = new ArrayList<OrderExpression>(2);
    do {
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    EasyMock.expect(getEntitySetView.getOrderBy()).andStubReturn(orderByExpression);
    EasyMock.expect(getEntitySetView.getSelect()).andStubReturn(null);
    EasyMock.expect(getEntitySetView.getFilter()).andStubReturn(null);
    List<NavigationSegment> navigationSegments = new ArrayList<NavigationSegment>();
    EasyMock.expect(getEntitySetView.getNavigationSegments()).andStubReturn(navigationSegments);
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1");
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    try {
      EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);

      EasyMock.expect(kpProperty.getMapping()).andStubReturn(edmMapping);

    } catch (EdmException e2) {
      fail("this should not happen");
    }
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
    EasyMock.replay(edmMapping, edmType, kpProperty, keyPredicate);
    List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
    keyPredicates.add(keyPredicate);
    EasyMock.expect(getEntitySetView.getKeyPredicates()).andStubReturn(keyPredicates);
    EasyMock.replay(getEntitySetView);
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

  }

  @Test
  public void testParseKeyPredicates() {
    // Setting up the expected value
    KeyPredicate keyPredicate1 = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty1 = EasyMock.createMock(EdmProperty.class);
    EasyMock.expect(keyPredicate1.getLiteral()).andStubReturn("1");
    KeyPredicate keyPredicate2 = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty2 = EasyMock.createMock(EdmProperty.class);
    EasyMock.expect(keyPredicate2.getLiteral()).andStubReturn("abc");
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    try {
      EasyMock.expect(kpProperty1.getName()).andStubReturn(SAMPLE_DATA_FIELD1);
      EasyMock.expect(kpProperty1.getType()).andStubReturn(EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance());
      EasyMock.expect(kpProperty2.getName()).andStubReturn(SAMPLE_DATA_FIELD2);
      EasyMock.expect(kpProperty2.getType()).andStubReturn(EdmSimpleTypeKind.String.getEdmSimpleTypeInstance());
      EasyMock.expect(keyPredicate1.getProperty()).andStubReturn(kpProperty1);
      EasyMock.expect(kpProperty1.getMapping()).andReturn(edmMapping);
      EasyMock.expect(edmMapping.getInternalName()).andReturn(SAMPLE_DATA_FIELD1);
      EasyMock.expect(keyPredicate2.getProperty()).andStubReturn(kpProperty2);
      EasyMock.expect(kpProperty2.getMapping()).andReturn(edmMapping);
    } catch (EdmException e) {
      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
    }
    EasyMock.expect(edmMapping.getInternalName()).andReturn(SAMPLE_DATA_FIELD2);
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    }

  }

  private List<KeyPredicate> createKeyPredicates() throws EdmException {
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid");
    EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty);

    EasyMock.replay(edmType, edmMapping, edmProperty, keyPredicate);
    List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
    keyPredicates.add(keyPredicate);
    return keyPredicates;
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    when(keyProperty.isSimple()).thenReturn(true);
    EdmMapping mapping = mock(EdmMapping.class);
    when(mapping.getInternalName()).thenReturn("getId");
    when(keyProperty.getMapping()).thenReturn(mapping);

    KeyPredicate key = mock(KeyPredicate.class);
    when(key.getProperty()).thenReturn(keyProperty);
    when(key.getLiteral()).thenReturn(keyValue);

    ArrayList<KeyPredicate> keys = new ArrayList<KeyPredicate>();
    keys.add(key);

    EdmEntityType entityType = mock(EdmEntityType.class);
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    EasyMock.replay(edmMapping, edmMapping1, edmEntityType, associationEnd, association, navigationProperty);
    return navigationProperty;
  }

  private List<KeyPredicate> createKeyPredicates() throws EdmException {
    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid");
    EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
    EasyMock.expect(edmProperty.getName()).andStubReturn("soid");
    EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
    EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty);

    EasyMock.replay(edmType, edmMapping, edmProperty, keyPredicate);
    List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
    keyPredicates.add(keyPredicate);
    return keyPredicates;
View Full Code Here

Examples of org.apache.olingo.odata2.api.uri.KeyPredicate

    GetEntityUriInfo resultsView = EasyMock.createMock(GetEntityUriInfo.class);

    EdmEntitySet entitySet = EasyMock.createMock(EdmEntitySet.class);
    EdmEntityType entityType = EasyMock.createMock(EdmEntityType.class);

    KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
    EdmProperty kpProperty = EasyMock.createMock(EdmProperty.class);
    EdmType edmType = EasyMock.createMock(EdmType.class);
    EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
    try {
      EasyMock.expect(kpProperty.getName()).andStubReturn("Field1");
      EasyMock.expect(kpProperty.getType()).andStubReturn(edmType);

    } catch (EdmException e2) {
      fail("this should not happen");
    }
    EasyMock.expect(keyPredicate.getProperty()).andStubReturn(kpProperty);
    EasyMock.replay(edmType, kpProperty, keyPredicate);
    keyPredicates.add(keyPredicate);
    int i = 0;
    try {
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.