[OLINGO-200] V3/V4 specialization for ODataEntitySetIterator
This commit is contained in:
parent
a884ad128d
commit
cd7ede00e2
|
@ -74,10 +74,13 @@ public interface CommonRetrieveRequestFactory extends Serializable {
|
||||||
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
|
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
|
||||||
* the entire entity set.
|
* the entire entity set.
|
||||||
*
|
*
|
||||||
|
* @param <ES> concreate ODataEntitySet implementation.
|
||||||
|
* @param <E> concrete ODataEntity implementation.
|
||||||
* @param uri request URI.
|
* @param uri request URI.
|
||||||
* @return new {@link ODataEntitySetIteratorRequest} instance.
|
* @return new {@link ODataEntitySetIteratorRequest} instance.
|
||||||
*/
|
*/
|
||||||
ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri);
|
<ES extends CommonODataEntitySet, E extends CommonODataEntity>
|
||||||
|
ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a query request returning a single OData entity.
|
* Gets a query request returning a single OData entity.
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
package org.apache.olingo.client.api.communication.request.retrieve;
|
package org.apache.olingo.client.api.communication.request.retrieve;
|
||||||
|
|
||||||
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
||||||
|
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
||||||
|
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements an OData EntitySet query request.
|
* This class implements an OData EntitySet query request.
|
||||||
*/
|
*/
|
||||||
public interface ODataEntitySetIteratorRequest extends ODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat> {
|
public interface ODataEntitySetIteratorRequest<ES extends CommonODataEntitySet, E extends CommonODataEntity>
|
||||||
|
extends ODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||||
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||||
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
||||||
|
@ -33,6 +34,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
|
||||||
@Override
|
@Override
|
||||||
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
|
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v4;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||||
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||||
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||||
|
@ -33,6 +34,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
|
||||||
@Override
|
@Override
|
||||||
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
|
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@ import org.slf4j.LoggerFactory;
|
||||||
* <br/>
|
* <br/>
|
||||||
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
|
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
|
||||||
*/
|
*/
|
||||||
public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
|
public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity>
|
||||||
|
implements Iterator<E> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger.
|
* Logger.
|
||||||
|
@ -59,7 +60,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
|
||||||
|
|
||||||
private Entry cached;
|
private Entry cached;
|
||||||
|
|
||||||
private CommonODataEntitySet entitySet;
|
private ES entitySet;
|
||||||
|
|
||||||
private final ByteArrayOutputStream osFeed;
|
private final ByteArrayOutputStream osFeed;
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
|
||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
if (available && cached == null) {
|
if (available && cached == null) {
|
||||||
if (format == ODataPubFormat.ATOM) {
|
if (format == ODataPubFormat.ATOM) {
|
||||||
|
@ -114,7 +116,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
|
||||||
|
|
||||||
if (cached == null) {
|
if (cached == null) {
|
||||||
available = false;
|
available = false;
|
||||||
entitySet = odataClient.getReader().
|
entitySet = (ES) odataClient.getReader().
|
||||||
readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format);
|
readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -127,9 +129,10 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
|
||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CommonODataEntity next() {
|
public E next() {
|
||||||
if (hasNext()) {
|
if (hasNext()) {
|
||||||
final CommonODataEntity res = odataClient.getBinder().getODataEntity(cached);
|
@SuppressWarnings("unchecked")
|
||||||
|
final E res = (E) odataClient.getBinder().getODataEntity(cached);
|
||||||
cached = null;
|
cached = null;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.olingo.client.core.communication.request.retrieve;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.olingo.client.api.CommonODataClient;
|
import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
|
||||||
|
@ -39,11 +38,6 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI query) {
|
|
||||||
return new ODataEntitySetIteratorRequestImpl(client, query);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataValueRequest getValueRequest(final URI query) {
|
public ODataValueRequest getValueRequest(final URI query) {
|
||||||
return new ODataValueRequestImpl(client, query);
|
return new ODataValueRequestImpl(client, query);
|
||||||
|
|
|
@ -25,14 +25,16 @@ import org.apache.olingo.client.api.CommonODataClient;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||||
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
||||||
|
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
||||||
|
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements an OData EntitySet query request.
|
* This class implements an OData EntitySet query request.
|
||||||
*/
|
*/
|
||||||
public class ODataEntitySetIteratorRequestImpl
|
public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet, E extends CommonODataEntity>
|
||||||
extends AbstractODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat>
|
extends AbstractODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat>
|
||||||
implements ODataEntitySetIteratorRequest {
|
implements ODataEntitySetIteratorRequest<ES, E> {
|
||||||
|
|
||||||
private ODataEntitySetIterator feedIterator = null;
|
private ODataEntitySetIterator feedIterator = null;
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ public class ODataEntitySetIteratorRequestImpl
|
||||||
* @param odataClient client instance getting this request
|
* @param odataClient client instance getting this request
|
||||||
* @param query query to be executed.
|
* @param query query to be executed.
|
||||||
*/
|
*/
|
||||||
ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
|
public ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
|
||||||
super(odataClient, ODataPubFormat.class, query);
|
super(odataClient, ODataPubFormat.class, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ public class ODataEntitySetIteratorRequestImpl
|
||||||
* {@inheritDoc }
|
* {@inheritDoc }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ODataRetrieveResponse<ODataEntitySetIterator> execute() {
|
public ODataRetrieveResponse<ODataEntitySetIterator<ES, E>> execute() {
|
||||||
final HttpResponse res = doExecute();
|
final HttpResponse res = doExecute();
|
||||||
return new ODataEntitySetIteratorResponseImpl(httpClient, res);
|
return new ODataEntitySetIteratorResponseImpl(httpClient, res);
|
||||||
}
|
}
|
||||||
|
@ -75,9 +77,9 @@ public class ODataEntitySetIteratorRequestImpl
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public ODataEntitySetIterator getBody() {
|
public ODataEntitySetIterator<ES, E> getBody() {
|
||||||
if (feedIterator == null) {
|
if (feedIterator == null) {
|
||||||
feedIterator = new ODataEntitySetIterator(
|
feedIterator = new ODataEntitySetIterator<ES, E>(
|
||||||
odataClient, getRawResponse(), ODataPubFormat.fromString(getContentType()));
|
odataClient, getRawResponse(), ODataPubFormat.fromString(getContentType()));
|
||||||
}
|
}
|
||||||
return feedIterator;
|
return feedIterator;
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v3;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||||
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||||
|
@ -28,6 +29,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkC
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
|
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
|
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
|
||||||
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
|
||||||
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
||||||
|
@ -60,6 +62,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
|
||||||
return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
|
return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
|
||||||
|
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
|
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v4;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||||
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||||
|
@ -27,6 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRe
|
||||||
import org.apache.olingo.client.api.v4.ODataClient;
|
import org.apache.olingo.client.api.v4.ODataClient;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
|
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
|
||||||
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
|
||||||
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
|
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
|
||||||
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||||
|
@ -54,6 +56,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
|
||||||
return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
|
return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
|
||||||
|
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
|
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.it.v3;
|
package org.apache.olingo.client.core.it.v3;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
|
@ -29,12 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
||||||
import org.apache.olingo.client.api.uri.CommonURIBuilder;
|
import org.apache.olingo.client.api.uri.CommonURIBuilder;
|
||||||
import org.apache.olingo.client.core.uri.URIUtils;
|
import org.apache.olingo.client.core.uri.URIUtils;
|
||||||
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
||||||
|
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
|
||||||
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
|
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
import org.apache.olingo.commons.core.op.ResourceFactory;
|
import org.apache.olingo.commons.core.op.ResourceFactory;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,12 +117,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
|
||||||
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
|
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
|
||||||
uriBuilder.appendEntitySetSegment("Customer");
|
uriBuilder.appendEntitySetSegment("Customer");
|
||||||
|
|
||||||
final ODataEntitySetIteratorRequest req =
|
final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
|
||||||
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
|
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
|
||||||
req.setFormat(format);
|
req.setFormat(format);
|
||||||
|
|
||||||
final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
|
final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
|
||||||
final ODataEntitySetIterator feedIterator = res.getBody();
|
final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
|
||||||
|
|
||||||
assertNotNull(feedIterator);
|
assertNotNull(feedIterator);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.client.core.it.v4;
|
package org.apache.olingo.client.core.it.v4;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||||
|
@ -29,13 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
|
||||||
import org.apache.olingo.client.api.uri.CommonURIBuilder;
|
import org.apache.olingo.client.api.uri.CommonURIBuilder;
|
||||||
import org.apache.olingo.client.core.uri.URIUtils;
|
import org.apache.olingo.client.core.uri.URIUtils;
|
||||||
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
|
||||||
|
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||||
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
|
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
|
||||||
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
import org.apache.olingo.commons.api.format.ODataPubFormat;
|
||||||
import org.apache.olingo.commons.core.op.ResourceFactory;
|
import org.apache.olingo.commons.core.op.ResourceFactory;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -124,11 +125,11 @@ public class EntitySetTestITCase extends AbstractTestITCase {
|
||||||
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
|
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
|
||||||
uriBuilder.appendEntitySetSegment("People");
|
uriBuilder.appendEntitySetSegment("People");
|
||||||
|
|
||||||
final ODataEntitySetIteratorRequest req =
|
final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
|
||||||
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
|
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
|
||||||
req.setFormat(format);
|
req.setFormat(format);
|
||||||
|
|
||||||
final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
|
final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
|
||||||
final ODataEntitySetIterator feedIterator = res.getBody();
|
final ODataEntitySetIterator feedIterator = res.getBody();
|
||||||
|
|
||||||
assertNotNull(feedIterator);
|
assertNotNull(feedIterator);
|
||||||
|
|
Loading…
Reference in New Issue