@Test public void testPropertyPathExp() throws Exception { final String entitySetName = "ESName"; final String keyPropertyName = "a"; EdmProperty keyProperty = mockProperty(keyPropertyName, OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String)); EdmKeyPropertyRef keyPropertyRef = mockKeyPropertyRef(keyPropertyName, keyProperty); EdmEntityType entityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(entityType.getPropertyNames()).thenReturn(Collections.singletonList(keyPropertyName)); Mockito.when(entityType.getProperty(keyPropertyName)).thenReturn(keyProperty); EdmEntitySet entitySet = mockEntitySet(entitySetName, entityType); EdmEntityContainer container = mockContainer(entitySetName, entitySet); Edm mockedEdm = Mockito.mock(Edm.class); Mockito.when(mockedEdm.getEntityContainer()).thenReturn(container); UriTokenizer tokenizer = new UriTokenizer("a eq \'abc\'"); Expression expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); assertNotNull(expression); assertEquals("{[a] EQ \'abc\'}", expression.toString()); tokenizer = new UriTokenizer("a in (\'abc\', \'xyz\')"); expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); assertNotNull(expression); assertEquals("{[a] IN [\'abc\', \'xyz\']}", expression.toString()); try { tokenizer = new UriTokenizer("a in (\'abc\', 10)"); expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); } catch (UriParserSemanticException e) { assertEquals("Incompatible types.", e.getMessage()); } }
public Expression parse(UriTokenizer tokenizer, final EdmType referringType, final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException { this.tokenizer = tokenizer; this.referringType = referringType; this.crossjoinEntitySetNames = crossjoinEntitySetNames; this.aliases = aliases; final Expression expression = parseExpression(); checkNoCollection(expression); return expression; }
ExpressionParser { public Expression parse(UriTokenizer tokenizer, final EdmType referringType, final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException { this.tokenizer = tokenizer; this.referringType = referringType; this.crossjoinEntitySetNames = crossjoinEntitySetNames; this.aliases = aliases; final Expression expression = parseExpression(); checkNoCollection(expression); return expression; } }
ExpressionParser { public Expression parse(UriTokenizer tokenizer, final EdmType referringType, final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException { this.tokenizer = tokenizer; this.referringType = referringType; this.crossjoinEntitySetNames = crossjoinEntitySetNames; this.aliases = aliases; final Expression expression = parseExpression(); checkNoCollection(expression); return expression; } ExpressionParser(final Edm edm, final OData odata); }
ExpressionParser { public Expression parse(UriTokenizer tokenizer, final EdmType referringType, final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException { this.tokenizer = tokenizer; this.referringType = referringType; this.crossjoinEntitySetNames = crossjoinEntitySetNames; this.aliases = aliases; final Expression expression = parseExpression(); checkNoCollection(expression); return expression; } ExpressionParser(final Edm edm, final OData odata); Expression parse(UriTokenizer tokenizer, final EdmType referringType,
      final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases); }
ExpressionParser { public Expression parse(UriTokenizer tokenizer, final EdmType referringType, final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException { this.tokenizer = tokenizer; this.referringType = referringType; this.crossjoinEntitySetNames = crossjoinEntitySetNames; this.aliases = aliases; final Expression expression = parseExpression(); checkNoCollection(expression); return expression; } ExpressionParser(final Edm edm, final OData odata); Expression parse(UriTokenizer tokenizer, final EdmType referringType,
      final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases);  }