[OLINGO-1004] Delete FilterFactoryTestITCase

Duplicated in FilterSystemQueryITCase
This commit is contained in:
Christian Amend 2016-08-12 14:34:37 +02:00
parent 2def64edb9
commit deb1d2036f
2 changed files with 32 additions and 62 deletions

View File

@ -1,62 +0,0 @@
/*
* 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.fit.base;
import static org.junit.Assert.assertEquals;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.uri.FilterArgFactory;
import org.apache.olingo.client.api.uri.FilterFactory;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Test;
public class FilterFactoryTestITCase extends AbstractTestITCase {
private FilterFactory getFilterFactory() {
return getClient().getFilterFactory();
}
private FilterArgFactory getFilterArgFactory() {
return getFilterFactory().getArgFactory();
}
@Test
public void crossjoin() {
final URIFilter filter = getFilterFactory().eq(
getFilterArgFactory().property("Orders/OrderID"), getFilterArgFactory().property("Customers/Order"));
final URIBuilder uriBuilder =
client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter);
final ODataEntitySetRequest<ClientEntitySet> req =
client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
req.setFormat(ContentType.JSON_FULL_METADATA);
final ClientEntitySet feed = req.execute().getBody();
assertEquals(3, feed.getEntities().size());
for (ClientEntity entity : feed.getEntities()) {
assertEquals(2, entity.getNavigationLinks().size());
}
}
}

View File

@ -31,6 +31,10 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.uri.FilterArgFactory;
import org.apache.olingo.client.api.uri.FilterFactory;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@ -44,6 +48,34 @@ public class FilterSystemQueryITCase extends AbstractParamTecSvcITCase {
private static final String ES_ALL_PRIM = "ESAllPrim";
private static final String ES_MIX_ENUM_DEF_COLL_COMP = "ESMixEnumDefCollComp";
@Test
public void useFilterFactory() {
final URIFilter filter = getFilterFactory().eq(
getFilterArgFactory().property("PropertyInt16"), getFilterArgFactory().literal(new Integer(0)));
final URIBuilder uriBuilder =
getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).filter(filter);
final ODataEntitySetRequest<ClientEntitySet> req =
getClient().getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
final ODataRetrieveResponse<ClientEntitySet> result = req.execute();
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
private FilterFactory getFilterFactory() {
return getClient().getFilterFactory();
}
private FilterArgFactory getFilterArgFactory() {
return getFilterFactory().getArgFactory();
}
@Test
public void timeOfDayLiteral() {
ODataRetrieveResponse<ClientEntitySet> result = sendRequest(ES_ALL_PRIM, "PropertyTimeOfDay eq 03:26:05");