@Test public void testDerivedPathExp() throws Exception { final String derivedEntitySetName = "ESName"; final String keyPropertyName = "a"; final String propertyName = "navProp"; EdmProperty keyProperty = mockProperty(keyPropertyName, OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String)); EdmKeyPropertyRef keyPropertyRef = mockKeyPropertyRef(keyPropertyName, keyProperty); EdmEntityType navEntityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(navEntityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("test.navET")); Mockito.when(navEntityType.getNamespace()).thenReturn("test"); Mockito.when(navEntityType.getPropertyNames()).thenReturn( Arrays.asList(keyPropertyName)); Mockito.when(navEntityType.getProperty(keyPropertyName)).thenReturn(keyProperty); EdmEntityType baseEntityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(baseEntityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("test.baseET")); Mockito.when(baseEntityType.getNamespace()).thenReturn("test"); Mockito.when(baseEntityType.getPropertyNames()).thenReturn( Arrays.asList(keyPropertyName)); Mockito.when(baseEntityType.getProperty(keyPropertyName)).thenReturn(keyProperty); Mockito.when(navEntityType.getBaseType()).thenReturn(baseEntityType); Mockito.when(baseEntityType.compatibleTo(navEntityType)).thenReturn(true); EdmEntityType entityType = mockEntityType(keyPropertyName, keyPropertyRef); Mockito.when(entityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("test.derivedET")); Mockito.when(entityType.getNamespace()).thenReturn("test"); Mockito.when(entityType.getPropertyNames()).thenReturn(Arrays.asList(keyPropertyName, propertyName)); EdmNavigationProperty navProperty = mockNavigationProperty(propertyName, navEntityType); Mockito.when(entityType.getProperty(propertyName)).thenReturn(navProperty); EdmEntitySet entitySet = mockEntitySet(derivedEntitySetName, entityType); EdmEntityContainer container = mockContainer(derivedEntitySetName, entitySet); Edm mockedEdm = Mockito.mock(Edm.class); Mockito.when(mockedEdm.getEntityContainer()).thenReturn(container); Mockito.when(mockedEdm.getEntityType(new FullQualifiedName("test.baseET"))).thenReturn(baseEntityType); UriTokenizer tokenizer = new UriTokenizer("navProp/test.baseET"); Expression expression = new ExpressionParser(mockedEdm, odata).parse(tokenizer, entityType, null, null); assertNotNull(expression); assertEquals("[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);  }