@Test public void testComplexPropertyPathExp() throws Exception { final String entitySetName = "ESName"; final String keyPropertyName = "a"; final String complexPropertyName = "comp"; final String propertyName = "prop"; EdmProperty keyProperty = mockProperty(keyPropertyName, OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String)); EdmKeyPropertyRef keyPropertyRef = mockKeyPropertyRef(keyPropertyName, keyProperty); EdmProperty property = mockProperty(propertyName, OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String)); EdmComplexType complexType = mockComplexType(propertyName, property); EdmProperty complexProperty = mockProperty(complexPropertyName, complexType); EdmEntityType entityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(entityType.getPropertyNames()).thenReturn(Arrays.asList(keyPropertyName, complexPropertyName)); Mockito.when(entityType.getProperty(keyPropertyName)).thenReturn(keyProperty); Mockito.when(entityType.getProperty(complexPropertyName)).thenReturn(complexProperty); 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("comp/prop eq \'abc\'"); Expression expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); assertNotNull(expression); assertEquals("{[comp, prop] EQ \'abc\'}", expression.toString()); tokenizer = new UriTokenizer("comp/prop in (\'abc\','xyz')"); expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); assertNotNull(expression); assertEquals("{[comp, prop] IN [\'abc\', \'xyz\']}", expression.toString()); }
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);  }