@Test public void testNavigationPropertyPathExp() throws Exception { final String entitySetName = "ESName"; final String keyPropertyName = "a"; final String complexPropertyName = "comp"; final String propertyName = "navProp"; EdmProperty keyProperty = mockProperty(keyPropertyName, OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String)); EdmKeyPropertyRef keyPropertyRef = mockKeyPropertyRef(keyPropertyName, keyProperty); EdmEntityType targetEntityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(targetEntityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("test.TargetET")); EdmNavigationProperty navProperty = mockNavigationProperty(propertyName, targetEntityType); EdmComplexType complexType = mockComplexType(propertyName, navProperty); EdmProperty complexProperty = mockProperty(complexPropertyName, complexType); EdmEntityType startEntityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(startEntityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("test.StartET")); Mockito.when(startEntityType.getPropertyNames()).thenReturn( Arrays.asList(keyPropertyName, complexPropertyName)); Mockito.when(startEntityType.getProperty(keyPropertyName)).thenReturn(keyProperty); Mockito.when(startEntityType.getProperty(complexPropertyName)).thenReturn(complexProperty); EdmEntitySet entitySet = mockEntitySet(entitySetName, startEntityType); EdmEntityContainer container = mockContainer(entitySetName, entitySet); Edm mockedEdm = Mockito.mock(Edm.class); Mockito.when(mockedEdm.getEntityContainer()).thenReturn(container); UriTokenizer tokenizer = new UriTokenizer("comp/navProp"); final Expression expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, startEntityType, null, null); assertNotNull(expression); assertEquals("[comp, navProp]", 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);  }