diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/FilterParserTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/FilterParserTest.java new file mode 100644 index 000000000..882b312de --- /dev/null +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/FilterParserTest.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.core.uri.parser; + +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.commons.api.edmx.EdmxReference; +import org.apache.olingo.server.api.OData; +import org.apache.olingo.server.api.uri.UriInfo; +import org.apache.olingo.server.api.uri.UriInfoKind; +import org.apache.olingo.server.api.uri.UriResource; +import org.apache.olingo.server.api.uri.queryoption.ApplyItem; +import org.apache.olingo.server.api.uri.queryoption.ApplyOption; +import org.apache.olingo.server.api.uri.queryoption.FilterOption; +import org.apache.olingo.server.api.uri.queryoption.OrderByItem; +import org.apache.olingo.server.api.uri.queryoption.apply.*; +import org.apache.olingo.server.api.uri.queryoption.apply.AggregateExpression.StandardMethod; +import org.apache.olingo.server.api.uri.queryoption.apply.BottomTop.Method; +import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; +import org.apache.olingo.server.core.uri.UriInfoImpl; +import org.apache.olingo.server.core.uri.testutil.*; +import org.apache.olingo.server.core.uri.validator.UriValidationException; +import org.apache.olingo.server.tecsvc.provider.*; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.*; + +/** Tests of the $apply parser inspired by the ABNF test cases. */ +public class FilterParserTest { + + private static final OData odata = OData.newInstance(); + private static final Edm edm = odata.createServiceMetadata( + new EdmTechProvider(), Collections. emptyList()).getEdm(); + + @Test + public void testFilterCountWithFilter() throws Exception { + final UriInfo uriInfo = new Parser(edm, odata).parseUri( + "ESTwoKeyNav", "$filter=NavPropertyETKeyNavMany/$count($filter=PropertyString eq 'hola') gt 1" , null, null); + + Assert.assertNotNull(uriInfo.getFilterOption()); + } + + + + + + +}