From c37d4da5710eb7919c601aaae9a80de1ff83cba9 Mon Sep 17 00:00:00 2001 From: Michael Bolz Date: Tue, 28 Apr 2015 23:11:55 +0200 Subject: [PATCH] [OLINGO-564] Renamed 'OData*' to 'Client*' classes --- .../AbstractCollectionInvocationHandler.java | 14 +- ...ractEntityCollectionInvocationHandler.java | 26 +- .../commons/AbstractInvocationHandler.java | 8 +- .../commons/AbstractPersistenceManager.java | 38 +- .../AbstractStructuredInvocationHandler.java | 38 +- .../commons/AnnotatableInvocationHandler.java | 26 +- .../ComplexCollectionInvocationHandler.java | 22 +- .../commons/ComplexInvocationHandler.java | 46 +- .../EntityContainerInvocationHandler.java | 4 +- .../commons/EntityInvocationHandler.java | 44 +- .../commons/EntitySetInvocationHandler.java | 14 +- .../ext/proxy/commons/EntitySetIterator.java | 4 +- .../commons/InvokerInvocationHandler.java | 38 +- .../commons/OperationInvocationHandler.java | 18 +- .../PrimitiveCollectionInvocationHandler.java | 19 +- ...redComposableInvokerInvocationHandler.java | 4 +- .../ext/proxy/context/EntityLinkDesc.java | 10 +- .../olingo/ext/proxy/utils/CoreUtils.java | 94 +-- .../olingo/ext/proxy/utils/ProxyUtils.java | 14 +- .../olingo/fit/AbstractBaseTestITCase.java | 12 +- .../fit/tecsvc/client/ActionImportITCase.java | 128 +-- .../BasicHttpExceptionHandlingITCase.java | 2 +- .../olingo/fit/tecsvc/client/BasicITCase.java | 795 +++++++++--------- .../fit/tecsvc/client/BatchClientITCase.java | 128 +-- .../fit/tecsvc/client/BindingITCase.java | 228 ++--- .../fit/tecsvc/client/DeepInsertITCase.java | 255 +++--- .../fit/tecsvc/client/ExpandSelectITCase.java | 72 +- .../ExpandWithSystemQueryOptionsITCase.java | 290 +++---- .../client/FilterSystemQueryITCase.java | 534 ++++++------ .../tecsvc/client/FunctionImportITCase.java | 92 +- .../olingo/fit/tecsvc/client/MediaITCase.java | 32 +- .../fit/tecsvc/client/NavigationITCase.java | 52 +- .../client/OrderBySystemQueryITCase.java | 91 +- .../tecsvc/client/PrimitiveComplexITCase.java | 94 +-- .../client/SystemQueryOptionITCase.java | 49 +- .../olingo/fit/v4/AbstractTestITCase.java | 76 +- .../apache/olingo/fit/v4/AsyncTestITCase.java | 63 +- .../olingo/fit/v4/AuthBatchTestITCase.java | 24 +- .../apache/olingo/fit/v4/BatchTestITCase.java | 124 +-- .../v4/BoundOperationInvokeTestITCase.java | 208 ++--- .../olingo/fit/v4/ConformanceTestITCase.java | 109 +-- .../apache/olingo/fit/v4/DeltaTestITCase.java | 30 +- .../olingo/fit/v4/DerivedTypeTestITCase.java | 44 +- .../olingo/fit/v4/EntityCreateTestITCase.java | 51 +- .../fit/v4/EntityRetrieveTestITCase.java | 141 ++-- .../olingo/fit/v4/EntitySetTestITCase.java | 36 +- .../olingo/fit/v4/EntityUpdateTestITCase.java | 48 +- .../fit/v4/ErrorResponseTestITCase.java | 24 +- .../fit/v4/FilterFactoryTestITCase.java | 26 +- .../v4/JSONFormatConformanceTestITCase.java | 218 ++--- .../olingo/fit/v4/KeyAsSegmentTestITCase.java | 49 +- .../olingo/fit/v4/MediaEntityTestITCase.java | 44 +- .../olingo/fit/v4/MetadataTestITCase.java | 34 +- .../olingo/fit/v4/OAuth2TestITCase.java | 35 +- .../olingo/fit/v4/OpenTypeTestITCase.java | 32 +- .../v4/OperationImportInvokeTestITCase.java | 160 ++-- .../olingo/fit/v4/PropertyTestITCase.java | 52 +- .../fit/v4/PropertyValueTestITCase.java | 36 +- .../olingo/fit/v4/QueryOptionsTestITCase.java | 83 +- .../fit/v4/ServiceDocumentTestITCase.java | 22 +- .../olingo/fit/v4/SingletonTestITCase.java | 43 +- .../apache/olingo/client/api/ODataClient.java | 4 +- .../ODataClientErrorException.java | 10 +- .../request/cud/CUDRequestFactory.java | 35 +- .../request/cud/ODataEntityCreateRequest.java | 4 +- .../request/cud/ODataEntityUpdateRequest.java | 4 +- ...ataNoContent.java => ClientNoContent.java} | 4 +- .../EdmEnabledInvokeRequestFactory.java | 28 +- .../request/invoke/InvokeRequestFactory.java | 20 +- .../request/invoke/ODataInvokeRequest.java | 8 +- .../request/retrieve/ODataDeltaRequest.java | 4 +- .../request/retrieve/ODataEntityRequest.java | 4 +- .../ODataEntitySetIteratorRequest.java | 6 +- .../retrieve/ODataEntitySetRequest.java | 4 +- .../retrieve/ODataPropertyRequest.java | 4 +- .../retrieve/ODataServiceDocumentRequest.java | 4 +- .../request/retrieve/ODataValueRequest.java | 4 +- .../retrieve/RetrieveRequestFactory.java | 18 +- .../MediaEntityCreateStreamManager.java | 4 +- .../MediaEntityUpdateStreamManager.java | 4 +- .../ODataMediaEntityCreateRequest.java | 4 +- .../ODataMediaEntityUpdateRequest.java | 4 +- .../response/ODataEntityCreateResponse.java | 4 +- .../response/ODataEntityUpdateResponse.java | 4 +- .../response/ODataInvokeResponse.java | 4 +- .../ODataMediaEntityCreateResponse.java | 4 +- .../ODataMediaEntityUpdateResponse.java | 4 +- .../response/ODataPropertyUpdateResponse.java | 4 +- .../response/ODataValueUpdateResponse.java | 4 +- .../client/api/data/ServiceDocument.java | 2 +- .../api/domain/ODataEntitySetIterator.java | 6 +- .../client/api/serialization/ODataBinder.java | 38 +- .../client/api/serialization/ODataReader.java | 20 +- .../client/api/serialization/ODataWriter.java | 14 +- .../olingo/client/core/ODataClientImpl.java | 8 +- .../header/ODataErrorResponseChecker.java | 8 +- .../request/cud/CUDRequestFactoryImpl.java | 34 +- .../cud/ODataEntityCreateRequestImpl.java | 4 +- .../cud/ODataEntityUpdateRequestImpl.java | 4 +- .../cud/ODataPropertyUpdateRequestImpl.java | 10 +- .../cud/ODataValueUpdateRequestImpl.java | 10 +- ...bstractEdmEnabledInvokeRequestFactory.java | 28 +- .../invoke/AbstractInvokeRequestFactory.java | 34 +- .../invoke/AbstractODataInvokeRequest.java | 38 +- .../EdmEnabledInvokeRequestFactoryImpl.java | 8 +- .../invoke/InvokeRequestFactoryImpl.java | 8 +- .../invoke/ODataInvokeRequestImpl.java | 4 +- .../retrieve/ODataDeltaRequestImpl.java | 10 +- .../retrieve/ODataEntityRequestImpl.java | 4 +- .../ODataEntitySetIteratorRequestImpl.java | 6 +- .../retrieve/ODataEntitySetRequestImpl.java | 4 +- .../retrieve/ODataPropertyRequestImpl.java | 4 +- .../ODataServiceDocumentRequestImpl.java | 10 +- .../retrieve/ODataValueRequestImpl.java | 10 +- .../retrieve/RetrieveRequestFactoryImpl.java | 28 +- .../ODataMediaEntityCreateRequestImpl.java | 4 +- .../ODataMediaEntityUpdateRequestImpl.java | 4 +- .../ClientODataDeserializerImpl.java | 4 +- .../core/serialization/ODataBinderImpl.java | 174 ++-- .../core/serialization/ODataReaderImpl.java | 36 +- .../core/serialization/ODataWriterImpl.java | 18 +- .../olingo/client/core/uri/URIUtils.java | 6 +- .../olingo/client/core/v4/EntitySetTest.java | 14 +- .../olingo/client/core/v4/EntityTest.java | 88 +- .../olingo/client/core/v4/ErrorTest.java | 8 +- .../olingo/client/core/v4/JSONTest.java | 16 +- .../client/core/v4/PrimitiveValueTest.java | 6 +- .../olingo/client/core/v4/PropertyTest.java | 38 +- .../client/core/v4/ServiceDocumentTest.java | 6 +- .../olingo/commons/api/data/Entity.java | 6 +- ...ayload.java => AbstractClientPayload.java} | 4 +- ...ataValue.java => AbstractClientValue.java} | 22 +- ...nnotatable.java => ClientAnnotatable.java} | 4 +- ...aAnnotation.java => ClientAnnotation.java} | 2 +- ...nValue.java => ClientCollectionValue.java} | 4 +- ...plexValue.java => ClientComplexValue.java} | 6 +- ...edEntity.java => ClientDeletedEntity.java} | 2 +- .../{ODataDelta.java => ClientDelta.java} | 8 +- ...ataDeltaLink.java => ClientDeltaLink.java} | 2 +- .../{ODataEntity.java => ClientEntity.java} | 14 +- ...ataEntitySet.java => ClientEntitySet.java} | 4 +- ...ataEnumValue.java => ClientEnumValue.java} | 2 +- .../{ODataError.java => ClientError.java} | 16 +- ...rrorDetail.java => ClientErrorDetail.java} | 8 +- ...ineEntity.java => ClientInlineEntity.java} | 12 +- ...itySet.java => ClientInlineEntitySet.java} | 14 +- ...okeResult.java => ClientInvokeResult.java} | 8 +- .../{ODataItem.java => ClientItem.java} | 14 +- .../{ODataLink.java => ClientLink.java} | 30 +- ...ODataLinkType.java => ClientLinkType.java} | 16 +- .../{ODataLinked.java => ClientLinked.java} | 14 +- ...tFactory.java => ClientObjectFactory.java} | 44 +- ...ataOperation.java => ClientOperation.java} | 2 +- ...veValue.java => ClientPrimitiveValue.java} | 22 +- ...ODataProperty.java => ClientProperty.java} | 2 +- ...pertyType.java => ClientPropertyType.java} | 2 +- ...cument.java => ClientServiceDocument.java} | 2 +- ...ataSingleton.java => ClientSingleton.java} | 2 +- ...ODataValuable.java => ClientValuable.java} | 12 +- .../{ODataValue.java => ClientValue.java} | 10 +- .../EdmConstantAnnotationExpression.java | 4 +- .../api/serialization/ODataDeserializer.java | 4 +- ...ySet.java => AbstractClientEntitySet.java} | 10 +- ...ionImpl.java => ClientAnnotationImpl.java} | 32 +- ...pl.java => ClientCollectionValueImpl.java} | 20 +- ...eImpl.java => ClientComplexValueImpl.java} | 54 +- ...Impl.java => ClientDeletedEntityImpl.java} | 8 +- ...ataDeltaImpl.java => ClientDeltaImpl.java} | 24 +- ...LinkImpl.java => ClientDeltaLinkImpl.java} | 14 +- ...aEntityImpl.java => ClientEntityImpl.java} | 70 +- ...ySetImpl.java => ClientEntitySetImpl.java} | 20 +- ...alueImpl.java => ClientEnumValueImpl.java} | 10 +- .../core/domain/ClientObjectFactoryImpl.java | 155 ++++ ...mpl.java => ClientPrimitiveValueImpl.java} | 38 +- ...pertyImpl.java => ClientPropertyImpl.java} | 42 +- ...uableImpl.java => ClientValuableImpl.java} | 30 +- .../core/domain/ODataObjectFactoryImpl.java | 155 ---- .../EdmConstantAnnotationExpressionImpl.java | 26 +- .../core/serialization/AtomDeserializer.java | 46 +- .../core/serialization/AtomSerializer.java | 4 +- .../core/serialization/JsonDeserializer.java | 46 +- .../serialization/JsonEntityDeserializer.java | 8 +- .../serialization/JsonEntitySerializer.java | 4 +- .../JsonODataErrorDeserializer.java | 10 +- .../JsonODataErrorDetailDeserializer.java | 8 +- .../core/serialization/JsonSerializer.java | 8 +- ...erverError.java => ClientServerError.java} | 22 +- .../api/processor/DefaultProcessor.java | 4 +- .../server/api/processor/ErrorProcessor.java | 4 +- .../api/serializer/ODataSerializer.java | 4 +- .../olingo/server/core/ErrorHandler.java | 26 +- .../server/core/responses/EntityResponse.java | 4 +- .../core/responses/EntitySetResponse.java | 4 +- .../core/responses/MetadataResponse.java | 4 +- .../core/responses/PropertyResponse.java | 4 +- .../server/core/responses/ResponseUtil.java | 6 +- .../responses/ServiceDocumentResponse.java | 4 +- .../server/core/ODataExceptionHelper.java | 50 +- .../olingo/server/core/ODataHandler.java | 24 +- .../server/core/ODataHttpHandlerImpl.java | 4 +- .../json/ODataJsonDeserializer.java | 10 +- .../serializer/json/ODataErrorSerializer.java | 8 +- .../serializer/json/ODataJsonSerializer.java | 4 +- .../xml/ODataXmlSerializerImpl.java | 4 +- ...st.java => ClientErrorSerializerTest.java} | 32 +- .../server/tecsvc/data/DataCreator.java | 6 +- .../olingo/server/core/ODataHandlerTest.java | 4 +- .../json/ODataDeserializerDeepInsertTest.java | 6 +- .../json/ODataJsonDeserializerEntityTest.java | 6 +- 209 files changed, 3790 insertions(+), 3746 deletions(-) rename lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/{ODataNoContent.java => ClientNoContent.java} (88%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{AbstractODataPayload.java => AbstractClientPayload.java} (92%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{AbstractODataValue.java => AbstractClientValue.java} (79%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataAnnotatable.java => ClientAnnotatable.java} (91%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataAnnotation.java => ClientAnnotation.java} (94%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataCollectionValue.java => ClientCollectionValue.java} (90%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataComplexValue.java => ClientComplexValue.java} (87%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataDeletedEntity.java => ClientDeletedEntity.java} (96%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataDelta.java => ClientDelta.java} (82%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataDeltaLink.java => ClientDeltaLink.java} (94%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataEntity.java => ClientEntity.java} (92%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataEntitySet.java => ClientEntitySet.java} (93%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataEnumValue.java => ClientEnumValue.java} (94%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataError.java => ClientError.java} (89%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataErrorDetail.java => ClientErrorDetail.java} (88%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataInlineEntity.java => ClientInlineEntity.java} (77%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataInlineEntitySet.java => ClientInlineEntitySet.java} (76%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataInvokeResult.java => ClientInvokeResult.java} (90%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataItem.java => ClientItem.java} (81%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataLink.java => ClientLink.java} (78%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataLinkType.java => ClientLinkType.java} (83%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataLinked.java => ClientLinked.java} (87%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataObjectFactory.java => ClientObjectFactory.java} (69%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataOperation.java => ClientOperation.java} (98%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataPrimitiveValue.java => ClientPrimitiveValue.java} (78%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataProperty.java => ClientProperty.java} (91%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataPropertyType.java => ClientPropertyType.java} (97%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataServiceDocument.java => ClientServiceDocument.java} (99%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataSingleton.java => ClientSingleton.java} (94%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataValuable.java => ClientValuable.java} (89%) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/{ODataValue.java => ClientValue.java} (90%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{AbstractODataEntitySet.java => AbstractClientEntitySet.java} (82%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataAnnotationImpl.java => ClientAnnotationImpl.java} (67%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataCollectionValueImpl.java => ClientCollectionValueImpl.java} (80%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataComplexValueImpl.java => ClientComplexValueImpl.java} (69%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataDeletedEntityImpl.java => ClientDeletedEntityImpl.java} (82%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataDeltaImpl.java => ClientDeltaImpl.java} (58%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataDeltaLinkImpl.java => ClientDeltaLinkImpl.java} (78%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataEntityImpl.java => ClientEntityImpl.java} (70%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataEntitySetImpl.java => ClientEntitySetImpl.java} (66%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataEnumValueImpl.java => ClientEnumValueImpl.java} (79%) create mode 100644 lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientObjectFactoryImpl.java rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataPrimitiveValueImpl.java => ClientPrimitiveValueImpl.java} (82%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataPropertyImpl.java => ClientPropertyImpl.java} (71%) rename lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/{ODataValuableImpl.java => ClientValuableImpl.java} (74%) delete mode 100644 lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java rename lib/server-api/src/main/java/org/apache/olingo/server/api/{ODataServerError.java => ClientServerError.java} (82%) rename lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/{ODataErrorSerializerTest.java => ClientErrorSerializerTest.java} (81%) diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java index 3f75544b1..276d6e4d0 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java @@ -35,7 +35,7 @@ import org.apache.commons.lang3.tuple.Triple; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.api.uri.URIFilter; -import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ClientAnnotation; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.AbstractTerm; import org.apache.olingo.ext.proxy.api.EntityType; @@ -59,7 +59,7 @@ public abstract class AbstractCollectionInvocationHandler itemRef; - protected final List annotations = new ArrayList(); + protected final List annotations = new ArrayList(); private final Map, Object> annotationsByTerm = new HashMap, Object>(); @@ -92,7 +92,7 @@ public abstract class AbstractCollectionInvocationHandler execute() { if (this.uri != null) { - final Triple, URI, List> res = fetchPartial(this.uri.build(), itemRef); + final Triple, URI, List> res = fetchPartial(this.uri.build(), itemRef); this.nextPageURI = res.getMiddle(); if (items == null) { @@ -109,9 +109,9 @@ public abstract class AbstractCollectionInvocationHandler, URI, List> fetchPartial(final URI uri, final Class typeRef); + public abstract Triple, URI, List> fetchPartial(final URI uri, final Class typeRef); - public void setAnnotations(final List annotations) { + public void setAnnotations(final List annotations) { this.annotations.clear(); this.annotationsByTerm.clear(); this.annotations.addAll(annotations); @@ -145,8 +145,8 @@ public abstract class AbstractCollectionInvocationHandler, URI, List> fetchPartial( + public Triple, URI, List> fetchPartial( final URI uri, final Class typeRef) { - final List entities = new ArrayList(); + final List entities = new ArrayList(); final URI next; - final List anns = new ArrayList(); + final List anns = new ArrayList(); if (isSingleton) { - final ODataRetrieveResponse res = + final ODataRetrieveResponse res = ((ODataClient) getClient()).getRetrieveRequestFactory().getSingletonRequest(uri).execute(); entities.add(res.getBody()); next = null; } else { - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); - final ODataEntitySet entitySet = res.getBody(); + final ClientEntitySet entitySet = res.getBody(); entities.addAll(entitySet.getEntities()); next = entitySet.getNext(); anns.addAll(entitySet.getAnnotations()); @@ -121,7 +121,7 @@ public abstract class AbstractEntityCollectionInvocationHandler res = new ArrayList(entities.size()); - for (ODataEntity entity : entities) { + for (ClientEntity entity : entities) { Class actualRef = null; if (entity.getTypeName() != null) { actualRef = service.getEntityTypeClass(entity.getTypeName().toString()); @@ -150,6 +150,6 @@ public abstract class AbstractEntityCollectionInvocationHandler, URI, List>(res, next, anns); + return new ImmutableTriple, URI, List>(res, next, anns); } } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java index abc0ee80e..a1005a348 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java @@ -32,8 +32,8 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.ComplexType; @@ -94,7 +94,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler { protected ComplexType getComplex( final String name, - final ODataValue value, + final ClientValue value, final Class ref, final EntityInvocationHandler handler, final URI baseURI, @@ -153,7 +153,7 @@ abstract class AbstractInvocationHandler implements InvocationHandler { final String namespace = handler.getUUID().getType().getAnnotation(Namespace.class).value(); - final ODataEntity template; + final ClientEntity template; final URI entityURI; if (handler.getEntityURI() == null || handler.getUUID().getKey() == null) { diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java index 06c190a42..d29aad475 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java @@ -40,9 +40,9 @@ import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddi import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.EdmStreamValue; import org.apache.olingo.ext.proxy.api.PersistenceManager; @@ -118,8 +118,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager { service.getContext().detachAll(); } - private ODataLink buildNavigationLink(final String name, final URI uri, final ODataLinkType type) { - ODataLink result; + private ClientLink buildNavigationLink(final String name, final URI uri, final ClientLinkType type) { + ClientLink result; switch (type) { case ENTITY_NAVIGATION: @@ -146,7 +146,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { int posNumber = pos; items.put(handler, null); - final ODataEntity entity = handler.getEntity(); + final ClientEntity entity = handler.getEntity(); entity.getNavigationLinks().clear(); final AttachedEntityStatus currentStatus = service.getContext().entityContext().getStatus(handler); @@ -166,13 +166,13 @@ abstract class AbstractPersistenceManager implements PersistenceManager { } for (Map.Entry property : handler.getLinkChanges().entrySet()) { - final ODataLinkType type = Collection.class.isAssignableFrom(property.getValue().getClass()) - ? ODataLinkType.ENTITY_SET_NAVIGATION - : ODataLinkType.ENTITY_NAVIGATION; + final ClientLinkType type = Collection.class.isAssignableFrom(property.getValue().getClass()) + ? ClientLinkType.ENTITY_SET_NAVIGATION + : ClientLinkType.ENTITY_NAVIGATION; final Set toBeLinked = new HashSet(); - for (Object proxy : type == ODataLinkType.ENTITY_SET_NAVIGATION + for (Object proxy : type == ClientLinkType.ENTITY_SET_NAVIGATION ? (Collection) property.getValue() : Collections.singleton(property.getValue())) { final EntityInvocationHandler target = (EntityInvocationHandler) Proxy.getInvocationHandler(proxy); @@ -312,7 +312,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { posNumber++; items.put(delayedUpdate.getSource(), posNumber); - final ODataEntity changes = + final ClientEntity changes = service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName()); AttachedEntityStatus status = service.getContext().entityContext().getStatus(delayedUpdate.getSource()); @@ -339,7 +339,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { targetURI = URI.create("$" + targetPos); } - changes.addLink(delayedUpdate.getType() == ODataLinkType.ENTITY_NAVIGATION + changes.addLink(delayedUpdate.getType() == ClientLinkType.ENTITY_NAVIGATION ? service.getClient().getObjectFactory(). newEntityNavigationLink(delayedUpdate.getSourceName(), targetURI) : service.getClient().getObjectFactory(). @@ -366,7 +366,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { private AttachedEntityStatus queue( final EntityInvocationHandler handler, - final ODataEntity entity, + final ClientEntity entity, final PersistenceChanges changeset) { switch (service.getContext().entityContext().getStatus(handler)) { @@ -390,7 +390,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { private void queueCreate( final EntityInvocationHandler handler, - final ODataEntity entity, + final ClientEntity entity, final PersistenceChanges changeset) { LOG.debug("Create '{}'", handler); @@ -445,12 +445,12 @@ abstract class AbstractPersistenceManager implements PersistenceManager { private void queueUpdate( final EntityInvocationHandler handler, - final ODataEntity changes, + final ClientEntity changes, final PersistenceChanges changeset) { LOG.debug("Update '{}'", handler.getEntityURI()); - final ODataEntityUpdateRequest req = + final ODataEntityUpdateRequest req = ((EdmEnabledODataClient) service.getClient()).getCUDRequestFactory(). getEntityUpdateRequest(handler.getEntityURI(), org.apache.olingo.client.api.communication.request.cud.UpdateType.PATCH, changes); @@ -490,12 +490,12 @@ abstract class AbstractPersistenceManager implements PersistenceManager { private void queueUpdate( final EntityInvocationHandler handler, final URI uri, - final ODataEntity changes, + final ClientEntity changes, final PersistenceChanges changeset) { LOG.debug("Update '{}'", uri); - final ODataEntityUpdateRequest req = + final ODataEntityUpdateRequest req = ((EdmEnabledODataClient) service.getClient()).getCUDRequestFactory(). getEntityUpdateRequest(uri, org.apache.olingo.client.api.communication.request.cud.UpdateType.PATCH, changes); @@ -511,7 +511,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { private void queueDelete( final EntityInvocationHandler handler, - final ODataEntity entity, + final ClientEntity entity, final PersistenceChanges changeset) { final URI deleteURI = entity.getEditLink() == null ? handler.getEntityURI() : entity.getEditLink(); changeset.addChange(buildDeleteRequest(deleteURI, handler.getETag()), handler); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java index e1b735ea0..0795e8b82 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java @@ -41,13 +41,13 @@ import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinked; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinked; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.ext.proxy.AbstractService; @@ -309,7 +309,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca } else if (propertyCache.containsKey(name)) { res = propertyCache.get(name); } else { - final ODataProperty property = getInternalProperty(name); + final ClientProperty property = getInternalProperty(name); if (ref != null && ClassUtils.getTypeClass(type).isAnnotationPresent(ComplexType.class)) { res = getComplex( @@ -332,7 +332,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca } else { List items = new ArrayList(); - for (ODataValue item : property.getValue().asCollection()) { + for (ClientValue item : property.getValue().asCollection()) { items.add(getComplex( name, item, @@ -364,7 +364,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca ? null : getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name)); } else { List items = new ArrayList(); - for (ODataValue item : property.getValue().asCollection()) { + for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue()); } collectionHandler = new PrimitiveCollectionInvocationHandler( @@ -450,25 +450,25 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca final Object navPropValue; URI targetEntitySetURI = CoreUtils.getTargetEntitySetURI(getClient(), property); - final ODataLink link = ((ODataLinked) internal).getNavigationLink(property.name()); + final ClientLink link = ((ClientLinked) internal).getNavigationLink(property.name()); - if (link instanceof ODataInlineEntity) { + if (link instanceof ClientInlineEntity) { // return entity navPropValue = ProxyUtils.getEntityProxy( service, - ((ODataInlineEntity) link).getEntity(), + ((ClientInlineEntity) link).getEntity(), targetEntitySetURI, type, null, false); - } else if (link instanceof ODataInlineEntitySet) { + } else if (link instanceof ClientInlineEntitySet) { // return entity set navPropValue = ProxyUtils.getEntityCollectionProxy( service, collItemType, type, targetEntitySetURI, - ((ODataInlineEntitySet) link).getEntitySet(), + ((ClientInlineEntitySet) link).getEntitySet(), targetEntitySetURI, false); } else { @@ -494,7 +494,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { - final ODataEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( + final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( collItemType.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(collItemType))); handler = EntityInvocationHandler.getInstance( @@ -543,7 +543,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca } } - for (ODataProperty property : getInternalProperties()) { + for (ClientProperty property : getInternalProperties()) { if (!propertyNames.contains(property.getName())) { res.add(property.getName()); } @@ -644,7 +644,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca public abstract boolean isChanged(); - protected abstract List getInternalProperties(); + protected abstract List getInternalProperties(); - protected abstract ODataProperty getInternalProperty(final String name); + protected abstract ClientProperty getInternalProperty(final String name); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatableInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatableInvocationHandler.java index 9da95ff6f..4b6689810 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatableInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AnnotatableInvocationHandler.java @@ -27,9 +27,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.AbstractTerm; import org.apache.olingo.ext.proxy.api.Annotatable; @@ -77,17 +77,17 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl return annotations; } - private List internalAnnotations() { - List result = Collections. emptyList(); + private List internalAnnotations() { + List result = Collections. emptyList(); - if (targetHandler.getInternal() instanceof ODataEntity) { + if (targetHandler.getInternal() instanceof ClientEntity) { result = propName == null - ? ((ODataEntity) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations() - : ((ODataEntity) targetHandler.getInternal()).getProperty(propName).getAnnotations(); - } else if (targetHandler.getInternal() instanceof ODataComplexValue) { + ? ((ClientEntity) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations() + : ((ClientEntity) targetHandler.getInternal()).getProperty(propName).getAnnotations(); + } else if (targetHandler.getInternal() instanceof ClientComplexValue) { result = propName == null - ? ((ODataComplexValue) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations() - : ((ODataComplexValue) targetHandler.getInternal()).get(propName).getAnnotations(); + ? ((ClientComplexValue) targetHandler.getInternal()).getNavigationLink(navPropName).getAnnotations() + : ((ClientComplexValue) targetHandler.getInternal()).get(propName).getAnnotations(); } return result; @@ -146,8 +146,8 @@ public class AnnotatableInvocationHandler extends AbstractInvocationHandler impl try { final Term termAnn = term.getAnnotation(Term.class); final Namespace namespaceAnn = term.getAnnotation(Namespace.class); - ODataAnnotation annotation = null; - for (ODataAnnotation _annotation : internalAnnotations()) { + ClientAnnotation annotation = null; + for (ClientAnnotation _annotation : internalAnnotations()) { if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) { annotation = _annotation; } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java index fc46c80a8..1607cfe12 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java @@ -33,10 +33,10 @@ import org.apache.commons.lang3.tuple.Triple; import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.ComplexCollection; import org.apache.olingo.ext.proxy.api.ComplexType; @@ -96,18 +96,18 @@ public class ComplexCollectionInvocationHandler> @SuppressWarnings("unchecked") @Override - public Triple, URI, List> fetchPartial(final URI uri, final Class typeRef) { - final ODataPropertyRequest req = + public Triple, URI, List> fetchPartial(final URI uri, final Class typeRef) { + final ODataPropertyRequest req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); final List resItems = new ArrayList(); - final ODataProperty property = res.getBody(); + final ClientProperty property = res.getBody(); if (property != null && property.hasCollectionValue()) { - for (ODataValue item : (ODataCollectionValue) property.getValue()) { + for (ClientValue item : (ClientCollectionValue) property.getValue()) { Class actualRef = null; if (StringUtils.isNotBlank(item.getTypeName())) { actualRef = service.getComplexTypeClass(item.getTypeName()); @@ -120,7 +120,7 @@ public class ComplexCollectionInvocationHandler> } } - return new ImmutableTriple, URI, List>( - resItems, null, Collections. emptyList()); + return new ImmutableTriple, URI, List>( + resItems, null, Collections. emptyList()); } } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java index 2e1deb69a..16467c2b1 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java @@ -28,9 +28,9 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataLinked; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientLinked; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.annotations.ComplexType; @@ -39,7 +39,7 @@ import org.apache.olingo.ext.proxy.utils.ClassUtils; public class ComplexInvocationHandler extends AbstractStructuredInvocationHandler { - private static Pair> init( + private static Pair> init( final Class typeRef, final AbstractService service) { @@ -57,10 +57,10 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle final FullQualifiedName typeName = new FullQualifiedName(ClassUtils.getNamespace(complexTypeRef), annotation.name()); - final ODataComplexValue complex = + final ClientComplexValue complex = service.getClient().getObjectFactory().newComplexValue(typeName.toString()); - return new ImmutablePair>(complex, complexTypeRef); + return new ImmutablePair>(complex, complexTypeRef); } public static ComplexInvocationHandler getInstance( @@ -68,12 +68,12 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle final EntityInvocationHandler handler, final Class typeRef) { - final Pair> init = init(typeRef, handler.service); + final Pair> init = init(typeRef, handler.service); return new ComplexInvocationHandler(init.getLeft(), init.getRight(), handler); } public static ComplexInvocationHandler getInstance( - final ODataComplexValue complex, + final ClientComplexValue complex, final Class typeRef, final AbstractService service) { @@ -84,7 +84,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle final Class typeRef, final AbstractService service) { - final Pair> init = init(typeRef, service); + final Pair> init = init(typeRef, service); return new ComplexInvocationHandler(init.getLeft(), init.getRight(), service); } @@ -93,12 +93,12 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle final AbstractService service, final URIBuilder uri) { - final Pair> init = init(typeRef, service); + final Pair> init = init(typeRef, service); return new ComplexInvocationHandler(init.getLeft(), init.getRight(), service, uri); } public static ComplexInvocationHandler getInstance( - final ODataComplexValue complex, + final ClientComplexValue complex, final Class typeRef, final AbstractService service, final URIBuilder uri) { @@ -107,7 +107,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle } private ComplexInvocationHandler( - final ODataComplexValue complex, + final ClientComplexValue complex, final Class typeRef, final AbstractService service, final URIBuilder uri) { @@ -118,7 +118,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle } private ComplexInvocationHandler( - final ODataComplexValue complex, + final ClientComplexValue complex, final Class typeRef, final EntityInvocationHandler handler) { @@ -127,7 +127,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle } private ComplexInvocationHandler( - final ODataComplexValue complex, + final ClientComplexValue complex, final Class typeRef, final AbstractService service) { @@ -135,13 +135,13 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle this.uri = null; } - public ODataComplexValue getComplex() { - return (ODataComplexValue) this.internal; + public ClientComplexValue getComplex() { + return (ClientComplexValue) this.internal; } @Override protected Object getNavigationPropertyValue(final NavigationProperty property, final Method getter) { - if (!(internal instanceof ODataLinked)) { + if (!(internal instanceof ClientLinked)) { throw new UnsupportedOperationException("Internal object is not navigable"); } @@ -157,10 +157,10 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle protected void load() { try { if (this.uri != null) { - final ODataPropertyRequest req = + final ODataPropertyRequest req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri.build()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); this.internal = res.getBody().getValue(); } } catch (IllegalArgumentException e) { @@ -173,10 +173,10 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle } @Override - protected List getInternalProperties() { - final List res = new ArrayList(); + protected List getInternalProperties() { + final List res = new ArrayList(); if (getComplex() != null) { - for (ODataProperty property : getComplex()) { + for (ClientProperty property : getComplex()) { res.add(property); } } @@ -184,7 +184,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle } @Override - protected ODataProperty getInternalProperty(final String name) { + protected ClientProperty getInternalProperty(final String name) { return getComplex() == null ? null : getComplex().get(name); } } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java index ffb59028f..b903fdbf2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java @@ -25,7 +25,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.net.URI; import org.apache.commons.lang3.ArrayUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.ComplexCollection; @@ -120,7 +120,7 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { - final ODataEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( + final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(entity, uri, uri, typeRef, service); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java index d3d7476b2..fff16b498 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java @@ -34,9 +34,9 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.ext.proxy.AbstractService; @@ -63,7 +63,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler private EntityUUID uuid; static EntityInvocationHandler getInstance( - final ODataEntity entity, + final ClientEntity entity, final EntitySetInvocationHandler entitySet, final Class typeRef) { @@ -77,7 +77,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler static EntityInvocationHandler getInstance( final Object key, - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final Class typeRef, final AbstractService service) { @@ -86,7 +86,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler } public static EntityInvocationHandler getInstance( - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final Class typeRef, final AbstractService service) { @@ -95,7 +95,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler } public static EntityInvocationHandler getInstance( - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final URI entityURI, final Class typeRef, @@ -129,7 +129,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); - ODataEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); + ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.uuid = new EntityUUID(null, typeRef, null); } @@ -145,7 +145,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); - ODataEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); + ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.baseURI = entityURI; this.uri = entityURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString()); @@ -154,7 +154,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler } private EntityInvocationHandler( - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final URI entityURI, final Class typeRef, @@ -177,7 +177,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler private EntityInvocationHandler( final Object entityKey, - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final Class typeRef, final AbstractService service) { @@ -207,7 +207,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler this.uuid = new EntityUUID(entitySetURI, typeRef, key); } - public void setEntity(final ODataEntity entity) { + public void setEntity(final ClientEntity entity) { this.internal = entity; getEntity().setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); @@ -240,7 +240,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler return uuid; } - public EntityUUID updateEntityUUID(final URI entitySetURI, final Class type, final ODataEntity entity) { + public EntityUUID updateEntityUUID(final URI entitySetURI, final Class type, final ClientEntity entity) { CoreUtils.addProperties(service.getClient(), this.getPropertyChanges(), entity); final Object key = CoreUtils.getKey(getClient(), this, this.getUUID().getType(), entity); return updateUUID(entitySetURI, type, key); @@ -266,8 +266,8 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler return uuid.getEntitySetURI(); } - public final ODataEntity getEntity() { - return (ODataEntity) internal; + public final ClientEntity getEntity() { + return (ClientEntity) internal; } public URI getEntityURI() { @@ -414,8 +414,8 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler try { final Term termAnn = term.getAnnotation(Term.class); final Namespace namespaceAnn = term.getAnnotation(Namespace.class); - ODataAnnotation annotation = null; - for (ODataAnnotation _annotation : getEntity().getAnnotations()) { + ClientAnnotation annotation = null; + for (ClientAnnotation _annotation : getEntity().getAnnotations()) { if ((namespaceAnn.value() + "." + termAnn.name()).equals(_annotation.getTerm())) { annotation = _annotation; } @@ -445,14 +445,14 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler final Object key = uuid.getKey(); try { - final ODataEntityRequest req = + final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(uri.build()); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); if (entity == null) { throw new IllegalArgumentException("Invalid " + typeRef.getSimpleName() + "(" + key + ")"); } @@ -479,12 +479,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler @Override @SuppressWarnings("unchecked") - protected List getInternalProperties() { + protected List getInternalProperties() { return getEntity() == null ? Collections. emptyList() : (List) getEntity().getProperties(); } @Override - protected ODataProperty getInternalProperty(final String name) { + protected ClientProperty getInternalProperty(final String name) { return getEntity() == null ? null : getEntity().getProperty(name); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java index 2f943d6e7..950b0ffa3 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java @@ -30,8 +30,8 @@ import java.util.concurrent.Future; import org.apache.commons.lang3.tuple.Triple; import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.ext.proxy.AbstractService; @@ -128,7 +128,7 @@ public class EntitySetInvocationHandler< EntityInvocationHandler handler = getContext().entityContext().getEntity(uuid); if (handler == null) { - final ODataEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( + final ClientEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( typeRef.getAnnotation(Namespace.class).value(), ClassUtils.getEntityTypeName(typeRef))); handler = EntityInvocationHandler.getInstance(key, entity, this.baseURI, typeRef, service); @@ -175,9 +175,9 @@ public class EntitySetInvocationHandler< ClassUtils.getNamespace(ref), ClassUtils.getEntityTypeName(ref)).toString()); } - final List anns = new ArrayList(); + final List anns = new ArrayList(); - final Triple, URI, List> entitySet = fetchPartial(uri.build(), (Class) ref); + final Triple, URI, List> entitySet = fetchPartial(uri.build(), (Class) ref); anns.addAll(entitySet.getRight()); final EntityCollectionInvocationHandler entityCollectionHandler = new EntityCollectionInvocationHandler( @@ -212,11 +212,11 @@ public class EntitySetInvocationHandler< final URIBuilder uriBuilder, final Class typeRef, final Class collTypeRef) { final List res = new ArrayList(); - final List anns = new ArrayList(); + final List anns = new ArrayList(); URI nextURI = uriBuilder.build(); while (nextURI != null) { - final Triple, URI, List> entitySet = fetchPartial(nextURI, (Class) typeRef); + final Triple, URI, List> entitySet = fetchPartial(nextURI, (Class) typeRef); res.addAll((List) entitySet.getLeft()); nextURI = entitySet.getMiddle(); anns.addAll(entitySet.getRight()); diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java index 60ff88307..9bbeeb0e1 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetIterator.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.NoSuchElementException; import org.apache.commons.lang3.tuple.Triple; -import org.apache.olingo.commons.api.domain.ODataAnnotation; +import org.apache.olingo.commons.api.domain.ClientAnnotation; import org.apache.olingo.ext.proxy.api.EntityCollection; import org.apache.olingo.ext.proxy.api.EntityType; @@ -81,7 +81,7 @@ class EntitySetIterator, KEY extends Serializable, EC ex } private void goOn() { - final Triple, URI, List> entitySet = esi.fetchPartial(this.next, this.esi.getTypeRef()); + final Triple, URI, List> entitySet = esi.fetchPartial(this.next, this.esi.getTypeRef()); this.current = entitySet.getLeft().iterator(); this.next = entitySet.getMiddle(); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java index 44a2d306c..733391cb4 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java @@ -30,15 +30,15 @@ import java.util.concurrent.Future; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; +import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.api.uri.URIFilter; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmFunction; import org.apache.olingo.commons.api.edm.EdmOperation; import org.apache.olingo.commons.api.edm.EdmReturnType; @@ -63,7 +63,7 @@ public class InvokerInvocationHandler extends AbstractI private URIBuilder uri; - private final Map parameters; + private final Map parameters; private final Operation operation; @@ -75,7 +75,7 @@ public class InvokerInvocationHandler extends AbstractI public InvokerInvocationHandler( final URI uri, - final Map parameters, + final Map parameters, final Operation operation, final EdmOperation edmOperation, final Type[] references, @@ -120,7 +120,7 @@ public class InvokerInvocationHandler extends AbstractI } // 2. invoke - final ODataInvokeResult result = service.getClient().getInvokeRequestFactory().getInvokeRequest( + final ClientInvokeResult result = service.getClient().getInvokeRequestFactory().getInvokeRequest( edmOperation instanceof EdmFunction ? HttpMethod.GET : HttpMethod.POST, uri.build(), getResultReference(edmOperation.getReturnType()), @@ -143,13 +143,13 @@ public class InvokerInvocationHandler extends AbstractI collItemType, targetRef, null, - (ODataEntitySet) result, + (ClientEntitySet) result, this.baseURI, false); } else { return (T) ProxyUtils.getEntityProxy( service, - (ODataEntity) result, + (ClientEntity) result, null, targetRef, null, @@ -159,7 +159,7 @@ public class InvokerInvocationHandler extends AbstractI Object res; final Class ref = ClassUtils.getTypeClass(targetRef); - final ODataProperty property = (ODataProperty) result; + final ClientProperty property = (ClientProperty) result; if (property == null || property.hasNullValue()) { res = null; @@ -168,7 +168,7 @@ public class InvokerInvocationHandler extends AbstractI final Class itemRef = ClassUtils.extractTypeArg(ref, ComplexCollection.class); final List items = new ArrayList(); - for (ODataValue item : property.getValue().asCollection()) { + for (ClientValue item : property.getValue().asCollection()) { items.add(ProxyUtils.getComplexProxy( service, property.getName(), @@ -189,7 +189,7 @@ public class InvokerInvocationHandler extends AbstractI } else { final List items = new ArrayList(); - for (ODataValue item : property.getValue().asCollection()) { + for (ClientValue item : property.getValue().asCollection()) { items.add(item.asPrimitive().toValue()); } @@ -218,18 +218,18 @@ public class InvokerInvocationHandler extends AbstractI } @SuppressWarnings("unchecked") - private Class getResultReference(final EdmReturnType returnType) { + private Class getResultReference(final EdmReturnType returnType) { Class result; if (returnType == null) { - result = (Class) ODataNoContent.class; + result = (Class) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { - result = (Class) ODataEntitySet.class; + result = (Class) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { - result = (Class) ODataEntity.class; + result = (Class) ClientEntity.class; } else { - result = (Class) ODataProperty.class; + result = (Class) ClientProperty.class; } } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java index 73daaf300..d92d39e1b 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java @@ -30,9 +30,9 @@ import java.util.List; import java.util.Map; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntityType; @@ -171,7 +171,7 @@ final class OperationInvocationHandler extends AbstractInvocationHandler { throw new IllegalStateException("Invalid target invocation"); } - final Map parameterValues = new LinkedHashMap(); + final Map parameterValues = new LinkedHashMap(); for (Map.Entry parameter : parameters.entrySet()) { if (!parameter.getKey().nullable() && parameter.getValue() == null) { throw new IllegalArgumentException( @@ -181,7 +181,7 @@ final class OperationInvocationHandler extends AbstractInvocationHandler { final EdmTypeInfo parameterType = new EdmTypeInfo.Builder(). setEdm(service.getClient().getCachedEdm()).setTypeExpression(parameter.getKey().type()).build(); - final ODataValue paramValue = parameter.getValue() == null + final ClientValue paramValue = parameter.getValue() == null ? null : CoreUtils.getODataValue(service.getClient(), parameterType, parameter.getValue()); @@ -239,10 +239,10 @@ final class OperationInvocationHandler extends AbstractInvocationHandler { } private Map.Entry getBoundOperation(final Operation operation, final List parameterNames) { - final ODataEntity entity = EntityInvocationHandler.class.cast(target).getEntity(); + final ClientEntity entity = EntityInvocationHandler.class.cast(target).getEntity(); final URI entityURI = EntityInvocationHandler.class.cast(target).getEntityURI(); - ODataOperation boundOp = entity.getOperation(operation.name()); + ClientOperation boundOp = entity.getOperation(operation.name()); if (boundOp == null) { boundOp = entity.getOperation(new FullQualifiedName(targetFQN.getNamespace(), operation.name()).toString()); } @@ -261,7 +261,7 @@ final class OperationInvocationHandler extends AbstractInvocationHandler { if (action == null) { baseType = baseType.getBaseType(); } else { - boundOp = new ODataOperation(); + boundOp = new ClientOperation(); boundOp.setMetadataAnchor(action.getFullQualifiedName().toString()); boundOp.setTitle(boundOp.getMetadataAnchor()); boundOp.setTarget(URI.create(entityURI.toASCIIString() + "/" @@ -279,7 +279,7 @@ final class OperationInvocationHandler extends AbstractInvocationHandler { if (func == null) { baseType = baseType.getBaseType(); } else { - boundOp = new ODataOperation(); + boundOp = new ClientOperation(); boundOp.setMetadataAnchor(func.getFullQualifiedName().toString()); boundOp.setTitle(boundOp.getMetadataAnchor()); boundOp.setTarget(URI.create(entityURI.toASCIIString() + "/" diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java index e5f4e5a01..e40593d3c 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java @@ -34,8 +34,9 @@ import org.apache.commons.lang3.tuple.Triple; import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.PrimitiveCollection; @@ -90,24 +91,24 @@ public class PrimitiveCollectionInvocationHandler @Override @SuppressWarnings("unchecked") - public Triple, URI, List> fetchPartial(final URI uri, final Class typeRef) { - final ODataPropertyRequest req = + public Triple, URI, List> fetchPartial(final URI uri, final Class typeRef) { + final ODataPropertyRequest req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); final List resItems = new ArrayList(); - final org.apache.olingo.commons.api.domain.ODataProperty property = res.getBody(); + final ClientProperty property = res.getBody(); if (property != null && !property.hasNullValue()) { - for (ODataValue item : property.getCollectionValue()) { + for (ClientValue item : property.getCollectionValue()) { resItems.add((T) item.asPrimitive().toValue()); } } - return new ImmutableTriple, URI, List>( - resItems, null, Collections.emptyList()); + return new ImmutableTriple, URI, List>( + resItems, null, Collections.emptyList()); } public void delete() { diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java index c909ab034..2ca7b8616 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java @@ -24,7 +24,7 @@ import java.net.URI; import java.util.Map; import org.apache.commons.lang3.ArrayUtils; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmOperation; import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; @@ -38,7 +38,7 @@ public class StructuredComposableInvokerInvocationHandler parameters, + final Map parameters, final Operation operation, final EdmOperation edmOperation, final Type[] references, diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java index 5a5318138..150665589 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java @@ -22,7 +22,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler; import java.io.Serializable; @@ -39,7 +39,7 @@ public class EntityLinkDesc implements Serializable { private final Collection targets; - private final ODataLinkType type; + private final ClientLinkType type; private final String reference; @@ -47,7 +47,7 @@ public class EntityLinkDesc implements Serializable { final String sourceName, final EntityInvocationHandler source, final Collection target, - final ODataLinkType type) { + final ClientLinkType type) { this.sourceName = sourceName; this.source = source; this.targets = target; @@ -59,7 +59,7 @@ public class EntityLinkDesc implements Serializable { final String sourceName, final EntityInvocationHandler source, final EntityInvocationHandler target, - final ODataLinkType type) { + final ClientLinkType type) { this.sourceName = sourceName; this.source = source; this.targets = Collections.singleton(target); @@ -90,7 +90,7 @@ public class EntityLinkDesc implements Serializable { return targets; } - public ODataLinkType getType() { + public ClientLinkType getType() { return type; } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java index b21c45c92..882f0f640 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java @@ -40,22 +40,22 @@ import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataAnnotatable; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotatable; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmElement; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmTerm; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.domain.ODataAnnotationImpl; +import org.apache.olingo.commons.core.domain.ClientAnnotationImpl; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; @@ -88,10 +88,10 @@ public final class CoreUtils { // Empty private constructor for static utility classes } - public static ODataValue getODataValue( + public static ClientValue getODataValue( final EdmEnabledODataClient client, final EdmTypeInfo type, final Object obj) { - final ODataValue value; + final ClientValue value; if (type.isCollection()) { value = client.getObjectFactory().newCollectionValue(type.getFullQualifiedName().toString()); @@ -144,7 +144,7 @@ public final class CoreUtils { return value; } - private static ODataProperty getODataEntityProperty( + private static ClientProperty getODataEntityProperty( final EdmEnabledODataClient client, final FullQualifiedName entity, final String property, @@ -154,7 +154,7 @@ public final class CoreUtils { return getODataProperty(client, edmProperty, property, obj); } - private static ODataProperty getODataComplexProperty( + private static ClientProperty getODataComplexProperty( final EdmEnabledODataClient client, final FullQualifiedName complex, final String property, @@ -164,7 +164,7 @@ public final class CoreUtils { return getODataProperty(client, edmProperty, property, obj); } - private static ODataProperty getODataProperty( + private static ClientProperty getODataProperty( final EdmEnabledODataClient client, final EdmElement edmProperty, final String property, @@ -186,29 +186,29 @@ public final class CoreUtils { return getODataProperty(client, property, type, obj); } - public static ODataAnnotation getODataAnnotation( + public static ClientAnnotation getODataAnnotation( final EdmEnabledODataClient client, final String term, final EdmType type, final Object obj) { - ODataAnnotation annotation; + ClientAnnotation annotation; if (obj == null) { - annotation = new ODataAnnotationImpl(term, null); + annotation = new ClientAnnotationImpl(term, null); } else { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()). setTypeExpression(type.getFullQualifiedName().toString()).build(); - annotation = new ODataAnnotationImpl(term, getODataValue(client, valueType, obj)); + annotation = new ClientAnnotationImpl(term, getODataValue(client, valueType, obj)); } return annotation; } - public static ODataProperty getODataProperty( + public static ClientProperty getODataProperty( final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { - ODataProperty property; + ClientProperty property; try { if (obj == null) { @@ -217,7 +217,7 @@ public final class CoreUtils { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : type; - final ODataValue value = getODataValue(client, valueType, obj); + final ClientValue value = getODataValue(client, valueType, obj); if (valueType.isCollection()) { property = client.getObjectFactory().newCollectionProperty(name, value.asCollection()); @@ -287,7 +287,7 @@ public final class CoreUtils { public static void addProperties( final EdmEnabledODataClient client, final Map changes, - final ODataEntity entity) { + final ClientEntity entity) { for (Map.Entry entry : changes.entrySet()) { entity.getProperties() @@ -298,7 +298,7 @@ public final class CoreUtils { public static void addProperties( final EdmEnabledODataClient client, final Map changes, - final ODataComplexValue entity) { + final ClientComplexValue entity) { for (Map.Entry entry : changes.entrySet()) { entity.add(getODataComplexProperty( @@ -312,7 +312,7 @@ public final class CoreUtils { public static void addAnnotations( final EdmEnabledODataClient client, final Map, Object> annotations, - final ODataAnnotatable annotatable) { + final ClientAnnotatable annotatable) { for (Map.Entry, Object> entry : annotations.entrySet()) { final Namespace nsAnn = entry.getKey().getAnnotation(Namespace.class); @@ -329,7 +329,7 @@ public final class CoreUtils { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private static Enum enumValueToObject(final ODataEnumValue value, final Class reference) { + private static Enum enumValueToObject(final ClientEnumValue value, final Class reference) { final Namespace namespace = reference.getAnnotation(Namespace.class); final EnumType enumType = reference.getAnnotation(EnumType.class); if (value.getTypeName().equals(namespace.value() + "." + enumType.name())) { @@ -339,7 +339,7 @@ public final class CoreUtils { return null; } - private static Object primitiveValueToObject(final ODataPrimitiveValue value, final Class reference) { + private static Object primitiveValueToObject(final ClientPrimitiveValue value, final Class reference) { Object obj; try { @@ -378,7 +378,7 @@ public final class CoreUtils { public static URIBuilder buildEditLink( final EdmEnabledODataClient client, final String entitySetURI, - final ODataEntity entity, + final ClientEntity entity, final Object key) { if (key == null) { @@ -428,14 +428,14 @@ public final class CoreUtils { final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Class entityTypeRef, - final ODataEntity entity) { + final ClientEntity entity) { Object res = null; if (!entity.getProperties().isEmpty()) { final Class keyRef = ClassUtils.getCompoundKeyRef(entityTypeRef); if (keyRef == null) { - final ODataProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); + final ClientProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); if (property != null && property.hasPrimitiveValue()) { res = primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(entityTypeRef, property.getName())); @@ -459,7 +459,7 @@ public final class CoreUtils { final EntityInvocationHandler typeHandler, final Object bean, final Class getterAnn, - final Iterator propItor) { + final Iterator propItor) { if (bean != null) { final Class typeRef; @@ -484,11 +484,11 @@ public final class CoreUtils { final Object bean, final Class typeRef, final Class getterAnn, - final Iterator propItor) { + final Iterator propItor) { if (bean != null) { while (propItor.hasNext()) { - final ODataProperty property = propItor.next(); + final ClientProperty property = propItor.next(); final Method getter = ClassUtils.findGetterByAnnotatedName(typeRef, getterAnn, property.getName()); @@ -520,9 +520,9 @@ public final class CoreUtils { setPropertyValue(bean, getter, collection); } - final Iterator collPropItor = property.getValue().asCollection().iterator(); + final Iterator collPropItor = property.getValue().asCollection().iterator(); while (collPropItor.hasNext()) { - final ODataValue value = collPropItor.next(); + final ClientValue value = collPropItor.next(); if (value.isPrimitive()) { collection.add(primitiveValueToObject( value.asPrimitive(), getPropertyClass(typeRef, property.getName()))); @@ -546,7 +546,7 @@ public final class CoreUtils { } public static Object getObjectFromODataValue( - final ODataValue value, + final ClientValue value, final Type typeRef, final AbstractService service) throws InstantiationException, IllegalAccessException { @@ -566,7 +566,7 @@ public final class CoreUtils { } public static Object getObjectFromODataValue( - final ODataValue value, + final ClientValue value, final Class ref, final AbstractService service) throws InstantiationException, IllegalAccessException { @@ -585,9 +585,9 @@ public final class CoreUtils { } else if (value.isCollection()) { final ArrayList collection = new ArrayList(); - final Iterator collPropItor = value.asCollection().iterator(); + final Iterator collPropItor = value.asCollection().iterator(); while (collPropItor.hasNext()) { - final ODataValue itemValue = collPropItor.next(); + final ClientValue itemValue = collPropItor.next(); if (itemValue.isPrimitive()) { collection.add(CoreUtils.primitiveValueToObject(itemValue.asPrimitive(), ref)); } else if (itemValue.isComplex()) { @@ -602,8 +602,8 @@ public final class CoreUtils { } res = collection; - } else if (value instanceof ODataEnumValue) { - res = enumValueToObject((ODataEnumValue) value, ref == null ? getEnumTypeRef(service, value) : ref); + } else if (value instanceof ClientEnumValue) { + res = enumValueToObject((ClientEnumValue) value, ref == null ? getEnumTypeRef(service, value) : ref); } else { res = primitiveValueToObject(value.asPrimitive(), ref); } @@ -612,11 +612,11 @@ public final class CoreUtils { } public static Collection> getAnnotationTerms( - final AbstractService service, final List annotations) { + final AbstractService service, final List annotations) { final List> res = new ArrayList>(); - for (ODataAnnotation annotation : annotations) { + for (ClientAnnotation annotation : annotations) { final Class clazz = service.getTermClass(annotation.getTerm()); if (clazz != null) { res.add(clazz); @@ -626,11 +626,11 @@ public final class CoreUtils { return res; } - private static Class getEnumTypeRef(final AbstractService service, final ODataValue value) { + private static Class getEnumTypeRef(final AbstractService service, final ClientValue value) { return service.getEnumTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); } - public static Class getComplexTypeRef(final AbstractService service, final ODataValue value) { + public static Class getComplexTypeRef(final AbstractService service, final ClientValue value) { return service.getComplexTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); } @@ -646,8 +646,8 @@ public final class CoreUtils { return null; } - public static URI getMediaEditLink(final String name, final ODataEntity entity) { - final ODataLink mediaEditLink = entity.getMediaEditLink(name); + public static URI getMediaEditLink(final String name, final ClientEntity entity) { + final ClientLink mediaEditLink = entity.getMediaEditLink(name); return mediaEditLink == null ? URIUtils.getURI(entity.getEditLink(), name) : mediaEditLink.getLink(); } diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java index 4ff910ff5..cb17b14de 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java @@ -22,9 +22,9 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.commons.ComplexInvocationHandler; import org.apache.olingo.ext.proxy.commons.EntityCollectionInvocationHandler; @@ -39,14 +39,14 @@ public class ProxyUtils { final Class typeRef, final Class typeCollectionRef, final URI targetEntitySetURI, - final ODataEntitySet entitySet, + final ClientEntitySet entitySet, final URI uri, final boolean checkInTheContext) { final List items = new ArrayList(); if (entitySet != null) { - for (ODataEntity entityFromSet : entitySet.getEntities()) { + for (ClientEntity entityFromSet : entitySet.getEntities()) { items.add(getEntityProxy(service, entityFromSet, uri, typeRef, null, checkInTheContext)); } } @@ -71,7 +71,7 @@ public class ProxyUtils { public static Object getEntityProxy( final AbstractService service, - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final Class type, final String eTag, @@ -98,7 +98,7 @@ public class ProxyUtils { public static Object getComplexProxy( final AbstractService service, final String name, - final ODataValue value, + final ClientValue value, final Class ref, final EntityInvocationHandler handler, final URI baseURI, diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java index e915f3f59..da0e7422c 100644 --- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java @@ -32,9 +32,9 @@ import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; import org.apache.olingo.fit.server.TomcatTestServer; @@ -94,15 +94,15 @@ public abstract class AbstractBaseTestITCase { } } - protected void debugODataProperty(final ODataProperty property, final String message) { + protected void debugODataProperty(final ClientProperty property, final String message) { LOG.debug(message + "\n{}", property.toString()); } - protected void debugODataValue(final ODataValue value, final String message) { + protected void debugODataValue(final ClientValue value, final String message) { LOG.debug(message + "\n{}", value.toString()); } - protected void debugODataEntity(final ODataEntity entity, final String message) { + protected void debugODataEntity(final ClientEntity entity, final String message) { if (LOG.isDebugEnabled()) { StringWriter writer = new StringWriter(); try { diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java index 49502bd66..9f6c183ee 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java @@ -34,12 +34,12 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -52,20 +52,20 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void primitveAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build(); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class).execute(); + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute(); assertEquals(200, response.getStatusCode()); assertEquals("UARTString string value", response.getBody().getPrimitiveValue().toValue()); } @Test public void primitveActionInvalidParameters() throws Exception { - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("Invalid", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1)); URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build(); try { - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); fail("Expected an ODataClientErrorException"); } catch (ODataClientErrorException e) { @@ -77,17 +77,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void primitveCollectionAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollStringTwoParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder().setType( EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build()); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue valueArray = response.getBody().getCollectionValue(); + ClientCollectionValue valueArray = response.getBody().getCollectionValue(); assertEquals(3, valueArray.size()); - Iterator iterator = valueArray.iterator(); + Iterator iterator = valueArray.iterator(); assertEquals("PT1S", iterator.next().asPrimitive().toValue()); assertEquals("PT2S", iterator.next().asPrimitive().toValue()); assertEquals("PT3S", iterator.next().asPrimitive().toValue()); @@ -97,17 +97,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCTTwoPrimParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataComplexValue complexValue = response.getBody().getComplexValue(); - ODataProperty propInt16 = complexValue.get("PropertyInt16"); + ClientComplexValue complexValue = response.getBody().getComplexValue(); + ClientProperty propInt16 = complexValue.get("PropertyInt16"); assertNotNull(propInt16); assertEquals(3, propInt16.getPrimitiveValue().toValue()); - ODataProperty propString = complexValue.get("PropertyString"); + ClientProperty propString = complexValue.get("PropertyString"); assertNotNull(propString); assertEquals("UARTCTTwoPrimParam string value", propString.getPrimitiveValue().toValue()); } @@ -116,13 +116,13 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionNoContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue complexValueCollection = response.getBody().getCollectionValue(); assertEquals(0, complexValueCollection.size()); } @@ -130,17 +130,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionSubContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue complexValueCollection = response.getBody().getCollectionValue(); assertEquals(1, complexValueCollection.size()); - Iterator iterator = complexValueCollection.iterator(); + Iterator iterator = complexValueCollection.iterator(); - ODataComplexValue next = iterator.next().asComplex(); + ClientComplexValue next = iterator.next().asComplex(); assertEquals(16, next.get("PropertyInt16").getPrimitiveValue().toValue()); assertEquals("Test123", next.get("PropertyString").getPrimitiveValue().toValue()); } @@ -149,17 +149,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionAllContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue complexValueCollection = response.getBody().getCollectionValue(); assertEquals(3, complexValueCollection.size()); - Iterator iterator = complexValueCollection.iterator(); + Iterator iterator = complexValueCollection.iterator(); - ODataComplexValue next = iterator.next().asComplex(); + ClientComplexValue next = iterator.next().asComplex(); assertEquals(16, next.get("PropertyInt16").getPrimitiveValue().toValue()); assertEquals("Test123", next.get("PropertyString").getPrimitiveValue().toValue()); @@ -176,18 +176,18 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityActionETTwoKeyTwoPrim() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntity.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntity entity = response.getBody(); - ODataProperty propInt16 = entity.getProperty("PropertyInt16"); + ClientEntity entity = response.getBody(); + ClientProperty propInt16 = entity.getProperty("PropertyInt16"); assertNotNull(propInt16); assertEquals(-365, propInt16.getPrimitiveValue().toValue()); - ODataProperty propString = entity.getProperty("PropertyString"); + ClientProperty propString = entity.getProperty("PropertyString"); assertNotNull(propString); assertEquals("Test String2", propString.getPrimitiveValue().toValue()); } @@ -196,17 +196,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNav() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(3, entitySet.getEntities().size()); Integer key = 1; - for (ODataEntity entity : entitySet.getEntities()) { + for (ClientEntity entity : entitySet.getEntities()) { assertEquals(key, entity.getProperty("PropertyInt16").getPrimitiveValue().toValue()); key++; } @@ -216,14 +216,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNavEmptyCollection() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(0, entitySet.getEntities().size()); } @@ -231,14 +231,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNavNegativeParam() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10)); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(0, entitySet.getEntities().size()); } @@ -251,18 +251,18 @@ public class ActionImportITCase extends AbstractBaseTestITCase { time.set(Calendar.HOUR_OF_DAY, 3); time.set(Calendar.MINUTE, 0); time.set(Calendar.SECOND, 0); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterTimeOfDay", getClient().getObjectFactory().newPrimitiveValueBuilder().setType( EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build()); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(3, entitySet.getEntities().size()); Integer key = 1; - for (ODataEntity entity : entitySet.getEntities()) { + for (ClientEntity entity : entitySet.getEntities()) { assertEquals(key, entity.getProperty("PropertyInt16").getPrimitiveValue().toValue()); key++; } @@ -275,12 +275,12 @@ public class ActionImportITCase extends AbstractBaseTestITCase { Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.clear(); dateTime.set(1012, 2, 0, 0, 0, 0); - Map parameters = new HashMap(); + Map parameters = new HashMap(); parameters .put("ParameterDate", getClient().getObjectFactory().newPrimitiveValueBuilder().setType( EdmPrimitiveTypeKind.Date).setValue(dateTime).build()); - ODataInvokeResponse response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntity.class, parameters) + ODataInvokeResponse response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters) .execute(); // Check 201 assertEquals(201, response.getStatusCode()); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java index 17eb3346e..c283395a5 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java @@ -34,7 +34,7 @@ public class BasicHttpExceptionHandlingITCase extends AbstractBaseTestITCase { private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/"; @Test - public void ambigiousXHTTPMethod() throws Exception{ + public void ambigiousXHTTPMethod() throws Exception { URL url = new URL(SERVICE_URI + "?$format=json"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java index 5beec7b5f..8a19000e9 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java @@ -53,17 +53,17 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.client.api.edm.xml.Reference; import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -85,10 +85,10 @@ public class BasicITCase extends AbstractBaseTestITCase { .getServiceDocumentRequest(SERVICE_URI); assertNotNull(request); - ODataRetrieveResponse response = request.execute(); + ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - ODataServiceDocument serviceDocument = response.getBody(); + ClientServiceDocument serviceDocument = response.getBody(); assertNotNull(serviceDocument); assertThat(serviceDocument.getEntitySetNames(), hasItem("ESAllPrim")); @@ -134,29 +134,29 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void readEntitySet() { - final ODataEntitySetRequest request = getClient().getRetrieveRequestFactory() + final ODataEntitySetRequest request = getClient().getRetrieveRequestFactory() .getEntitySetRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESMixPrimCollComp").build()); assertNotNull(request); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString())); - final ODataEntitySet entitySet = response.getBody(); + final ClientEntitySet entitySet = response.getBody(); assertNotNull(entitySet); assertNull(entitySet.getCount()); assertNull(entitySet.getNext()); - assertEquals(Collections. emptyList(), entitySet.getAnnotations()); + assertEquals(Collections. emptyList(), entitySet.getAnnotations()); assertNull(entitySet.getDeltaLink()); - final List entities = entitySet.getEntities(); + final List entities = entitySet.getEntities(); assertNotNull(entities); assertEquals(3, entities.size()); - final ODataEntity entity = entities.get(2); + final ClientEntity entity = entities.get(2); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyInt16"); + final ClientProperty property = entity.getProperty("PropertyInt16"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(0, property.getPrimitiveValue().toValue()); @@ -164,7 +164,7 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void readException() throws Exception { - final ODataEntityRequest request = getClient().getRetrieveRequestFactory() + final ODataEntityRequest request = getClient().getRetrieveRequestFactory() .getEntityRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESMixPrimCollComp").appendKeySegment("42").build()); assertNotNull(request); @@ -174,29 +174,29 @@ public class BasicITCase extends AbstractBaseTestITCase { fail("Expected Exception not thrown!"); } catch (final ODataClientErrorException e) { assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode()); - final ODataError error = e.getODataError(); + final ClientError error = e.getODataError(); assertThat(error.getMessage(), containsString("key property")); } } @Test public void readEntity() throws Exception { - final ODataEntityRequest request = getClient().getRetrieveRequestFactory() + final ODataEntityRequest request = getClient().getRetrieveRequestFactory() .getEntityRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build()); assertNotNull(request); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString())); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("CollPropertyInt16"); + final ClientProperty property = entity.getProperty("CollPropertyInt16"); assertNotNull(property); assertNotNull(property.getCollectionValue()); assertEquals(3, property.getCollectionValue().size()); - Iterator iterator = property.getCollectionValue().iterator(); + Iterator iterator = property.getCollectionValue().iterator(); assertEquals(1000, iterator.next().asPrimitive().toValue()); assertEquals(2000, iterator.next().asPrimitive().toValue()); assertEquals(30112, iterator.next().asPrimitive().toValue()); @@ -213,7 +213,7 @@ public class BasicITCase extends AbstractBaseTestITCase { // Check that the deleted entity is really gone. // This check has to be in the same session in order to access the same data provider. - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); try { entityRequest.execute(); @@ -226,8 +226,8 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void patchEntity() throws Exception { final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString", factory.newPrimitiveValueBuilder().buildString("new"))); patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyDecimal", @@ -236,29 +236,29 @@ public class BasicITCase extends AbstractBaseTestITCase { factory.newPrimitiveValueBuilder().buildInt64(null))); final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) .build(); - final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( + final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( uri, UpdateType.PATCH, patchEntity); - final ODataEntityUpdateResponse response = request.execute(); + final ODataEntityUpdateResponse response = request.execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the patched properties have changed and the other properties not. // This check has to be in the same session in order to access the same data provider. - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); - final ODataEntity entity = entityResponse.getBody(); + final ClientEntity entity = entityResponse.getBody(); assertNotNull(entity); - final ODataProperty property1 = entity.getProperty("PropertyString"); + final ClientProperty property1 = entity.getProperty("PropertyString"); assertNotNull(property1); assertEquals("new", property1.getPrimitiveValue().toValue()); - final ODataProperty property2 = entity.getProperty("PropertyDecimal"); + final ClientProperty property2 = entity.getProperty("PropertyDecimal"); assertNotNull(property2); assertEquals(42.875, property2.getPrimitiveValue().toValue()); - final ODataProperty property3 = entity.getProperty("PropertyInt64"); + final ClientProperty property3 = entity.getProperty("PropertyInt64"); assertNotNull(property3); assertNull(property3.getPrimitiveValue()); - final ODataProperty property4 = entity.getProperty("PropertyDuration"); + final ClientProperty property4 = entity.getProperty("PropertyDuration"); assertNotNull(property4); assertEquals("PT6S", property4.getPrimitiveValue().toValue()); } @@ -266,30 +266,30 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void updateEntity() throws Exception { final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64", factory.newPrimitiveValueBuilder().buildInt32(42))); - + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) .build(); - final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( + final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( uri, UpdateType.REPLACE, newEntity); - final ODataEntityUpdateResponse response = request.execute(); + final ODataEntityUpdateResponse response = request.execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the updated properties have changed and that other properties have their default values. // This check has to be in the same session in order to access the same data provider. - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); - final ODataEntity entity = entityResponse.getBody(); + final ClientEntity entity = entityResponse.getBody(); assertNotNull(entity); - final ODataProperty property1 = entity.getProperty("PropertyInt64"); + final ClientProperty property1 = entity.getProperty("PropertyInt64"); assertNotNull(property1); assertEquals(42, property1.getPrimitiveValue().toValue()); - final ODataProperty property2 = entity.getProperty("PropertyDecimal"); + final ClientProperty property2 = entity.getProperty("PropertyDecimal"); assertNotNull(property2); assertNull(property2.getPrimitiveValue()); } @@ -297,8 +297,8 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void patchEntityWithComplex() throws Exception { final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp")); patchEntity.getProperties().add(factory.newComplexProperty("PropertyComp", factory.newComplexValue("olingo.odata.test1.CTCompComp").add( factory.newComplexProperty("PropertyComp", @@ -306,26 +306,26 @@ public class BasicITCase extends AbstractBaseTestITCase { factory.newPrimitiveProperty("PropertyInt16", factory.newPrimitiveValueBuilder().buildInt32(42))))))); final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build(); - final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( + final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( uri, UpdateType.PATCH, patchEntity); - final ODataEntityUpdateResponse response = request.execute(); + final ODataEntityUpdateResponse response = request.execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the patched properties have changed and the other properties not. // This check has to be in the same session in order to access the same data provider. - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); - final ODataEntity entity = entityResponse.getBody(); + final ClientEntity entity = entityResponse.getBody(); assertNotNull(entity); - final ODataComplexValue complex = entity.getProperty("PropertyComp").getComplexValue() + final ClientComplexValue complex = entity.getProperty("PropertyComp").getComplexValue() .get("PropertyComp").getComplexValue(); assertNotNull(complex); - final ODataProperty property1 = complex.get("PropertyInt16"); + final ClientProperty property1 = complex.get("PropertyInt16"); assertNotNull(property1); assertEquals(42, property1.getPrimitiveValue().toValue()); - final ODataProperty property2 = complex.get("PropertyString"); + final ClientProperty property2 = complex.get("PropertyString"); assertNotNull(property2); assertEquals("String 1", property2.getPrimitiveValue().toValue()); } @@ -333,8 +333,8 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void updateEntityWithComplex() throws Exception { final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); newEntity.getProperties().add(factory.newComplexProperty("PropertyCompCompNav", null)); // The following properties must not be null newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString", @@ -350,23 +350,23 @@ public class BasicITCase extends AbstractBaseTestITCase { factory.newPrimitiveValueBuilder().buildString("Test2"))))); final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESKeyNav").appendKeySegment(1).build(); - final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( + final ODataEntityUpdateRequest request = client.getCUDRequestFactory().getEntityUpdateRequest( uri, UpdateType.REPLACE, newEntity); - final ODataEntityUpdateResponse response = request.execute(); + final ODataEntityUpdateResponse response = request.execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the complex-property hierarchy is still there and that all primitive values are now null. // This check has to be in the same session in order to access the same data provider. - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); - final ODataEntity entity = entityResponse.getBody(); + final ClientEntity entity = entityResponse.getBody(); assertNotNull(entity); - final ODataComplexValue complex = entity.getProperty("PropertyCompCompNav").getComplexValue() + final ClientComplexValue complex = entity.getProperty("PropertyCompCompNav").getComplexValue() .get("PropertyCompNav").getComplexValue(); assertNotNull(complex); - final ODataProperty property = complex.get("PropertyInt16"); + final ClientProperty property = complex.get("PropertyInt16"); assertNotNull(property); assertNull(property.getPrimitiveValue()); } @@ -374,30 +374,30 @@ public class BasicITCase extends AbstractBaseTestITCase { @Test public void createEntity() throws Exception { final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64", factory.newPrimitiveValueBuilder().buildInt32(42))); - newEntity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoPrimOne", - client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESTwoPrim") - .appendKeySegment(32766) - .build())); - - final ODataEntityCreateRequest createRequest = client.getCUDRequestFactory().getEntityCreateRequest( + newEntity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoPrimOne", + client.newURIBuilder(SERVICE_URI) + .appendEntitySetSegment("ESTwoPrim") + .appendKeySegment(32766) + .build())); + + final ODataEntityCreateRequest createRequest = client.getCUDRequestFactory().getEntityCreateRequest( client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").build(), newEntity); assertNotNull(createRequest); - final ODataEntityCreateResponse createResponse = createRequest.execute(); + final ODataEntityCreateResponse createResponse = createRequest.execute(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode()); assertEquals(SERVICE_URI + "/ESAllPrim(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next()); - final ODataEntity createdEntity = createResponse.getBody(); + final ClientEntity createdEntity = createResponse.getBody(); assertNotNull(createdEntity); - final ODataProperty property1 = createdEntity.getProperty("PropertyInt64"); + final ClientProperty property1 = createdEntity.getProperty("PropertyInt64"); assertNotNull(property1); assertEquals(42, property1.getPrimitiveValue().toValue()); - final ODataProperty property2 = createdEntity.getProperty("PropertyDecimal"); + final ClientProperty property2 = createdEntity.getProperty("PropertyDecimal"); assertNotNull(property2); assertNull(property2.getPrimitiveValue()); } @@ -406,140 +406,169 @@ public class BasicITCase extends AbstractBaseTestITCase { public void readEntityWithExpandedNavigationProperty() { final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); - + final URI uri = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESKeyNav") .appendKeySegment(1) .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany") .build(); - - final ODataRetrieveResponse response = client.getRetrieveRequestFactory() - .getEntityRequest(uri) - .execute(); - + + final ODataRetrieveResponse response = client.getRetrieveRequestFactory() + .getEntityRequest(uri) + .execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - + // Check if all inlined entities are available // NavPropertyETKeyNavOne assertNotNull(response.getBody().getNavigationLink("NavPropertyETKeyNavOne")); - final ODataInlineEntity inlineEntity = response.getBody() - .getNavigationLink("NavPropertyETKeyNavOne") - .asInlineEntity(); + final ClientInlineEntity inlineEntity = response.getBody() + .getNavigationLink("NavPropertyETKeyNavOne") + .asInlineEntity(); assertNotNull(inlineEntity); assertEquals(Integer.valueOf(2), inlineEntity.getEntity() - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + // NavPropertyETKeyNavMany assertNotNull(response.getBody().getNavigationLink("NavPropertyETKeyNavMany")); - final ODataInlineEntitySet inlineEntitySet = response.getBody() - .getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet(); + final ClientInlineEntitySet inlineEntitySet = response.getBody() + .getNavigationLink("NavPropertyETKeyNavMany") + .asInlineEntitySet(); assertNotNull(inlineEntitySet); assertEquals(2, inlineEntitySet.getEntitySet().getEntities().size()); assertEquals(1, inlineEntitySet.getEntitySet() - .getEntities() - .get(0) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .getEntities() + .get(0) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(2, inlineEntitySet.getEntitySet() - .getEntities() - .get(1) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); + .getEntities() + .get(1) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); } - + @Test public void updateCollectionOfComplexCollection() { - final ODataObjectFactory of = getClient().getObjectFactory(); - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final ClientObjectFactory of = getClient().getObjectFactory(); + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + + entity.getProperties().add( + of.newCollectionProperty("CollPropertyComp", + of.newCollectionValue("CTPrimComp") + .add( + of.newComplexValue("CTPrimComp") + .add( + of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16( + (short) 42))) + .add( + of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") + .add( + of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() + .buildString("42")))))) + .add( + of.newComplexValue("CTPrimComp") + .add( + of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16( + (short) 43))) + .add( + of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") + .add( + of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() + .buildString("43")))))))); - entity.getProperties().add(of.newCollectionProperty("CollPropertyComp", - of.newCollectionValue("CTPrimComp") - .add(of.newComplexValue("CTPrimComp") - .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short)42))) - .add(of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("42")))))) - .add(of.newComplexValue("CTPrimComp") - .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short)43))) - .add(of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("43")))))))); - final URI uri = getClient().newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(3) - .build(); - - final ODataEntityUpdateResponse response = getClient().getCUDRequestFactory() - .getEntityUpdateRequest(uri, - UpdateType.PATCH, - entity) - .execute(); - + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(3) + .build(); + + final ODataEntityUpdateResponse response = getClient().getCUDRequestFactory() + .getEntityUpdateRequest(uri, + UpdateType.PATCH, + entity) + .execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next(); - + // Check if entity has changed - final ODataEntityRequest entityRequest = getClient().getRetrieveRequestFactory().getEntityRequest(uri); + final ODataEntityRequest entityRequest = + getClient().getRetrieveRequestFactory().getEntityRequest(uri); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); - + final ODataRetrieveResponse entityResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); assertNotNull(entityResponse.getBody().getProperty("CollPropertyComp")); assertEquals(2, entityResponse.getBody().getProperty("CollPropertyComp").getCollectionValue().size()); - - final Iterator collectionIterator = entityResponse.getBody() - .getProperty("CollPropertyComp") - .getCollectionValue() - .iterator(); - - ODataComplexValue complexProperty = collectionIterator.next().asComplex(); + + final Iterator collectionIterator = entityResponse.getBody() + .getProperty("CollPropertyComp") + .getCollectionValue() + .iterator(); + + ClientComplexValue complexProperty = collectionIterator.next().asComplex(); assertEquals(42, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue()); assertNotNull(complexProperty.get("PropertyComp")); - - ODataComplexValue innerComplexProperty = complexProperty.get("PropertyComp").getComplexValue(); + + ClientComplexValue innerComplexProperty = complexProperty.get("PropertyComp").getComplexValue(); assertEquals("42", innerComplexProperty.get("PropertyString").getPrimitiveValue().toValue()); - + complexProperty = collectionIterator.next().asComplex(); assertEquals(43, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue()); assertNotNull(complexProperty.get("PropertyComp")); - + innerComplexProperty = complexProperty.get("PropertyComp").getComplexValue(); assertEquals("43", innerComplexProperty.get("PropertyString").getPrimitiveValue().toValue()); } - + @Test public void createCollectionOfComplexCollection() { /* * Create a new entity which contains a collection of complex collections * Check if all not filled fields are created by the server */ - final ODataObjectFactory of = getClient().getObjectFactory(); - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final ClientObjectFactory of = getClient().getObjectFactory(); + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); entity.getProperties().add( - of.newPrimitiveProperty("PropertyString", - of.newPrimitiveValueBuilder().buildString("Complex collection test"))); - entity.getProperties().add(of.newComplexProperty("PropertyCompTwoPrim", - of.newComplexValue("CTTwoPrim") - .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short) 1))) - .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("1"))))); - - entity.getProperties().add(of.newCollectionProperty("CollPropertyComp", - of.newCollectionValue("CTPrimComp") - .add(of.newComplexValue("CTPrimComp") - .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short)1))) - .add(of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("1")))))) - .add(of.newComplexValue("CTPrimComp") - .add(of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("2"))) - .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short) 2))) - .add(of.newPrimitiveProperty("PropertySingle", of.newPrimitiveValueBuilder().buildSingle(2.0f)))))))); - + of.newPrimitiveProperty("PropertyString", + of.newPrimitiveValueBuilder().buildString("Complex collection test"))); + entity.getProperties().add(of.newComplexProperty("PropertyCompTwoPrim", + of.newComplexValue("CTTwoPrim") + .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short) 1))) + .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("1"))))); + + entity.getProperties().add( + of.newCollectionProperty("CollPropertyComp", + of.newCollectionValue("CTPrimComp") + .add( + of.newComplexValue("CTPrimComp") + .add( + of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder() + .buildInt16((short) 1))) + .add( + of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") + .add( + of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() + .buildString("1")))))) + .add( + of.newComplexValue("CTPrimComp") + .add( + of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim") + .add( + of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() + .buildString("2"))) + .add( + of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16( + (short) 2))) + .add( + of.newPrimitiveProperty("PropertySingle", of.newPrimitiveValueBuilder() + .buildSingle(2.0f)))))))); + entity.addLink(of.newEntityNavigationLink("NavPropertyETTwoKeyNavOne", getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoKeyNav") @@ -551,22 +580,21 @@ public class BasicITCase extends AbstractBaseTestITCase { put("PropertyString", "1"); } }).build())); - - final ODataEntityCreateResponse response = getClient().getCUDRequestFactory().getEntityCreateRequest( + + final ODataEntityCreateResponse response = getClient().getCUDRequestFactory().getEntityCreateRequest( getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESKeyNav").build(), entity).execute(); - - + // Check if not declared fields are also available assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); - final ODataEntity newEntity = response.getBody(); - + final ClientEntity newEntity = response.getBody(); + assertEquals(2, newEntity.getProperty("CollPropertyComp").getCollectionValue().size()); - final Iterator iter = newEntity.getProperty("CollPropertyComp").getCollectionValue().iterator(); - final ODataComplexValue complexProperty1 = iter.next().asComplex(); + final Iterator iter = newEntity.getProperty("CollPropertyComp").getCollectionValue().iterator(); + final ClientComplexValue complexProperty1 = iter.next().asComplex(); assertEquals(1, complexProperty1.get("PropertyInt16").getPrimitiveValue().toValue()); assertNotNull(complexProperty1.get("PropertyComp")); - final ODataComplexValue innerComplexProperty1 = complexProperty1.get("PropertyComp").getComplexValue(); + final ClientComplexValue innerComplexProperty1 = complexProperty1.get("PropertyComp").getComplexValue(); assertEquals("1", innerComplexProperty1.get("PropertyString").getPrimitiveValue().toValue()); assertTrue(innerComplexProperty1.get("PropertyBinary").hasNullValue()); assertTrue(innerComplexProperty1.get("PropertyBoolean").hasNullValue()); @@ -584,11 +612,11 @@ public class BasicITCase extends AbstractBaseTestITCase { assertTrue(innerComplexProperty1.get("PropertyTimeOfDay").hasNullValue()); assertTrue(innerComplexProperty1.get("PropertyInt16").hasNullValue()); assertTrue(innerComplexProperty1.get("PropertySingle").hasNullValue()); - - final ODataComplexValue complexProperty2 = iter.next().asComplex(); + + final ClientComplexValue complexProperty2 = iter.next().asComplex(); assertTrue(complexProperty2.get("PropertyInt16").hasNullValue()); assertNotNull(complexProperty2.get("PropertyComp")); - final ODataComplexValue innerComplexProperty2 = complexProperty2.get("PropertyComp").getComplexValue(); + final ClientComplexValue innerComplexProperty2 = complexProperty2.get("PropertyComp").getComplexValue(); assertEquals("2", innerComplexProperty2.get("PropertyString").getPrimitiveValue().toValue()); assertEquals(2, innerComplexProperty2.get("PropertyInt16").getPrimitiveValue().toValue()); assertEquals(Double.valueOf(2), innerComplexProperty2.get("PropertySingle").getPrimitiveValue().toValue()); @@ -605,20 +633,20 @@ public class BasicITCase extends AbstractBaseTestITCase { assertTrue(innerComplexProperty2.get("PropertyInt64").hasNullValue()); assertTrue(innerComplexProperty2.get("PropertySByte").hasNullValue()); assertTrue(innerComplexProperty2.get("PropertyTimeOfDay").hasNullValue()); - + // Check if not available properties return null assertNull(innerComplexProperty2.get("NotAvailableProperty")); } - + @Test public void testComplexPropertyWithNotNullablePrimitiveValue() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - + final ClientObjectFactory of = client.getObjectFactory(); + // PropertyComp is null, but the primitive values in PropertyComp must not be null - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETMixPrimCollComp")); + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETMixPrimCollComp")); final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESMixPrimCollComp").build(); - + try { client.getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute(); fail("Expecting bad request"); @@ -626,192 +654,192 @@ public class BasicITCase extends AbstractBaseTestITCase { assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode()); } } - + @Test public void testUpsert() throws EdmPrimitiveTypeException { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETTwoPrim")); + final ClientObjectFactory of = client.getObjectFactory(); + + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETTwoPrim")); entity.getProperties().add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() - .buildString("Test"))); - + .buildString("Test"))); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").appendKeySegment(33).build(); - final ODataEntityUpdateResponse updateResponse = + final ODataEntityUpdateResponse updateResponse = client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.PATCH, entity).execute(); - + assertEquals(HttpStatusCode.CREATED.getStatusCode(), updateResponse.getStatusCode()); assertEquals("Test", updateResponse.getBody().getProperty("PropertyString").getPrimitiveValue().toValue()); - + final String cookie = updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next(); final Short key = updateResponse.getBody().getProperty("PropertyInt16") - .getPrimitiveValue() - .toCastValue(Short.class); - - final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() - .getEntityRequest(client.newURIBuilder() - .appendEntitySetSegment("ESTwoPrim") - .appendKeySegment(key) - .build()); + .getPrimitiveValue() + .toCastValue(Short.class); + + final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() + .getEntityRequest(client.newURIBuilder() + .appendEntitySetSegment("ESTwoPrim") + .appendKeySegment(key) + .build()); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse responseEntityRequest = entityRequest.execute(); + final ODataRetrieveResponse responseEntityRequest = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), responseEntityRequest.getStatusCode()); assertEquals("Test", responseEntityRequest.getBody().getProperty("PropertyString").getPrimitiveValue().toValue()); } - + @Test public void testUpdatePropertyWithNull() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - + final ClientObjectFactory of = client.getObjectFactory(); + final URI targetURI = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESAllPrim") - .appendKeySegment(32767) - .build(); - - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); + .appendEntitySetSegment("ESAllPrim") + .appendKeySegment(32767) + .build(); + + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim")); entity.getProperties().add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() - .buildString(null))); - - final ODataEntityUpdateResponse updateResponse = client.getCUDRequestFactory() - .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity) + .buildString(null))); + + final ODataEntityUpdateResponse updateResponse = client.getCUDRequestFactory() + .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity) .execute(); - + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), updateResponse.getStatusCode()); final String cookie = updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next(); - - final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() - .getEntityRequest(targetURI); + + final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() + .getEntityRequest(targetURI); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode()); - + assertTrue(entityResponse.getBody().getProperty("PropertyString").hasNullValue()); assertEquals(34, entityResponse.getBody().getProperty("PropertyDecimal").getPrimitiveValue().toValue()); } - - @Test(expected=ODataClientErrorException.class) + + @Test(expected = ODataClientErrorException.class) public void testUpdatePropertyWithNullNotAllowed() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - + final ClientObjectFactory of = client.getObjectFactory(); + final URI targetURI = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(32767) - .build(); - - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(32767) + .build(); + + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); entity.getProperties().add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() - .buildString(null))); - - client.getCUDRequestFactory().getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity).execute(); + .buildString(null))); + + client.getCUDRequestFactory().getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity).execute(); } - + @Test public void testUpdateMerge() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - - final URI targetURI = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(1) - .build(); + final ClientObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final URI targetURI = client.newURIBuilder(SERVICE_URI) + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(1) + .build(); + + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); entity.addLink(of.newEntityNavigationLink("NavPropertyETKeyNavOne", targetURI)); entity.addLink(of.newEntitySetNavigationLink("NavPropertyETKeyNavMany", client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESKeyNav").appendKeySegment(3).build())); entity.getProperties().add(of.newCollectionProperty("CollPropertyString", of.newCollectionValue("Edm.String") .add(of.newPrimitiveValueBuilder().buildString("Single entry!")))); - entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim", + entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", - of.newPrimitiveValueBuilder().buildString("Changed"))))); - - final ODataEntityUpdateResponse response = client.getCUDRequestFactory() - .getEntityUpdateRequest(targetURI,UpdateType.PATCH, entity) - .execute(); - + .add(of.newPrimitiveProperty("PropertyString", + of.newPrimitiveValueBuilder().buildString("Changed"))))); + + final ODataEntityUpdateResponse response = client.getCUDRequestFactory() + .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity) + .execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next(); - - final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() - .getEntityRequest( - client.newURIBuilder() - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(1) - .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany") - .build()); + + final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() + .getEntityRequest( + client.newURIBuilder() + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(1) + .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany") + .build()); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entitytResponse = entityRequest.execute(); - + final ODataRetrieveResponse entitytResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode()); assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne") - .asInlineEntity() - .getEntity() - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntity() + .getEntity() + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") .asInlineEntitySet() .getEntitySet() .getEntities() .size()); - + assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(1) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(1) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(2) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - - final Iterator collectionIterator = entitytResponse.getBody() - .getProperty("CollPropertyString") - .getCollectionValue() - .iterator(); + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(2) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + + final Iterator collectionIterator = entitytResponse.getBody() + .getProperty("CollPropertyString") + .getCollectionValue() + .iterator(); assertTrue(collectionIterator.hasNext()); assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue()); assertFalse(collectionIterator.hasNext()); - - final ODataComplexValue complexValue = entitytResponse.getBody() - .getProperty("PropertyCompAllPrim") - .getComplexValue(); - + + final ClientComplexValue complexValue = entitytResponse.getBody() + .getProperty("PropertyCompAllPrim") + .getComplexValue(); + assertEquals("Changed", complexValue.get("PropertyString").getPrimitiveValue().toValue()); } - + @Test public void testUpdateReplace() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - - final URI targetURI = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(1) - .build(); + final ClientObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final URI targetURI = client.newURIBuilder(SERVICE_URI) + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(1) + .build(); + + final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); entity.addLink(of.newEntityNavigationLink("NavPropertyETKeyNavOne", targetURI)); entity.addLink(of.newEntitySetNavigationLink("NavPropertyETKeyNavMany", client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESKeyNav").appendKeySegment(3).build())); @@ -819,105 +847,104 @@ public class BasicITCase extends AbstractBaseTestITCase { .buildString("Must not be null"))); entity.getProperties().add(of.newComplexProperty("PropertyCompTwoPrim", of.newComplexValue("CTTwoPrim") .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder() - .buildString("Must not be null"))) + .buildString("Must not be null"))) .add(of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder().buildInt16((short) 42))))); entity.getProperties().add(of.newCollectionProperty("CollPropertyString", of.newCollectionValue("Edm.String") .add(of.newPrimitiveValueBuilder().buildString("Single entry!")))); - entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim", + entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim", of.newComplexValue("CTAllPrim") - .add(of.newPrimitiveProperty("PropertyString", - of.newPrimitiveValueBuilder().buildString("Changed"))))); - - final ODataEntityUpdateResponse response = client.getCUDRequestFactory() - .getEntityUpdateRequest(targetURI,UpdateType.REPLACE, entity) - .execute(); - + .add(of.newPrimitiveProperty("PropertyString", + of.newPrimitiveValueBuilder().buildString("Changed"))))); + + final ODataEntityUpdateResponse response = client.getCUDRequestFactory() + .getEntityUpdateRequest(targetURI, UpdateType.REPLACE, entity) + .execute(); + assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next(); - - final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() - .getEntityRequest( - client.newURIBuilder() - .appendEntitySetSegment("ESKeyNav") - .appendKeySegment(1) - .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany") - .build()); + + final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory() + .getEntityRequest( + client.newURIBuilder() + .appendEntitySetSegment("ESKeyNav") + .appendKeySegment(1) + .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany") + .build()); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entitytResponse = entityRequest.execute(); - + final ODataRetrieveResponse entitytResponse = entityRequest.execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode()); assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne") - .asInlineEntity() - .getEntity() - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntity() + .getEntity() + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") .asInlineEntitySet() .getEntitySet() .getEntities() .size()); - + assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(1) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(1) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany") - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(2) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - - final Iterator collectionIterator = entitytResponse.getBody() - .getProperty("CollPropertyString") - .getCollectionValue() - .iterator(); + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(2) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + + final Iterator collectionIterator = entitytResponse.getBody() + .getProperty("CollPropertyString") + .getCollectionValue() + .iterator(); assertTrue(collectionIterator.hasNext()); assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue()); assertFalse(collectionIterator.hasNext()); - - final ODataComplexValue propCompAllPrim = entitytResponse.getBody() - .getProperty("PropertyCompAllPrim") - .getComplexValue(); - + + final ClientComplexValue propCompAllPrim = entitytResponse.getBody() + .getProperty("PropertyCompAllPrim") + .getComplexValue(); + assertEquals("Changed", propCompAllPrim.get("PropertyString").getPrimitiveValue().toValue()); assertTrue(propCompAllPrim.get("PropertyInt16").hasNullValue()); assertTrue(propCompAllPrim.get("PropertyDate").hasNullValue()); - - final ODataComplexValue propCompTwoPrim = entitytResponse.getBody() - .getProperty("PropertyCompTwoPrim") - .getComplexValue(); - - assertEquals("Must not be null", propCompTwoPrim.get("PropertyString").getPrimitiveValue().toValue()); - assertEquals(42, propCompTwoPrim.get("PropertyInt16").getPrimitiveValue().toValue()); - - assertNotNull(entitytResponse.getBody().getProperty("PropertyCompNav").getComplexValue()); - assertTrue(entitytResponse.getBody() - .getProperty("PropertyCompNav") - .getComplexValue() - .get("PropertyInt16") - .hasNullValue()); + + final ClientComplexValue propCompTwoPrim = entitytResponse.getBody() + .getProperty("PropertyCompTwoPrim") + .getComplexValue(); + + assertEquals("Must not be null", propCompTwoPrim.get("PropertyString").getPrimitiveValue().toValue()); + assertEquals(42, propCompTwoPrim.get("PropertyInt16").getPrimitiveValue().toValue()); + + assertNotNull(entitytResponse.getBody().getProperty("PropertyCompNav").getComplexValue()); + assertTrue(entitytResponse.getBody() + .getProperty("PropertyCompNav") + .getComplexValue() + .get("PropertyInt16") + .hasNullValue()); } - @Override protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getClient(); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java index 55fa57f99..c03490c1f 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java @@ -45,9 +45,9 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ContentType; @@ -91,10 +91,10 @@ public class BatchClientITCase extends AbstractTestITCase { */ final ODataClient client = getClient(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // Try to create entity, with invalid type - final ODataEntity entity = of.newEntity(ES_NOT_AVAILABLE); + final ClientEntity entity = of.newEntity(ES_NOT_AVAILABLE); entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder() .buildString("1"))); final ODataBatchRequest batchRequest = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI); @@ -104,7 +104,7 @@ public class BatchClientITCase extends AbstractTestITCase { final URI targetURI = client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_NOT_AVAILABLE_NAME) .build(); - final ODataEntityCreateRequest createRequest = client.getCUDRequestFactory() + final ODataEntityCreateRequest createRequest = client.getCUDRequestFactory() .getEntityCreateRequest(targetURI, entity); changeset.addRequest(createRequest); @@ -257,7 +257,7 @@ public class BatchClientITCase extends AbstractTestITCase { final BatchManager payload = request.payloadManager(); final URI uri = new URI(SERVICE_URI + "/../ESAllPrim(32767)"); - final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); + final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); queryReq.setFormat(ODataFormat.JSON); payload.addRequest(queryReq); @@ -282,7 +282,7 @@ public class BatchClientITCase extends AbstractTestITCase { final BatchManager payload = request.payloadManager(); final URI uri = new URI("http://otherhost/odata/ESAllPrim(32767)"); - final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); + final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); queryReq.setFormat(ODataFormat.JSON); payload.addRequest(queryReq); @@ -297,7 +297,7 @@ public class BatchClientITCase extends AbstractTestITCase { final BatchManager payload = request.payloadManager(); final URI uri = new URI("/ESAllPrim(32767)"); - final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); + final ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); queryReq.setFormat(ODataFormat.JSON); payload.addRequest(queryReq); @@ -366,29 +366,28 @@ public class BatchClientITCase extends AbstractTestITCase { public void changesetWithReferences() throws EdmPrimitiveTypeException, URISyntaxException { // create your request final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); request.setAccept(ACCEPT); final BatchManager streamManager = request.payloadManager(); final ODataChangeset changeset = streamManager.addChangeset(); - final ODataEntity entityESAllPrim = getClient().getObjectFactory(). + final ClientEntity entityESAllPrim = getClient().getObjectFactory(). newEntity(new FullQualifiedName("olingo.odata.test1.ESAllPrim")); entityESAllPrim.getProperties().add(client.getObjectFactory().newPrimitiveProperty( "PropertyDouble", client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(3.1415))); - + entityESAllPrim.addLink( of.newEntityNavigationLink("NavPropertyETTwoPrimOne", client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESTwoPrim") - .appendKeySegment(-365) - .build())); - - + .appendEntitySetSegment("ESTwoPrim") + .appendKeySegment(-365) + .build())); + final URIBuilder uriBuilder = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim"); // add create request - final ODataEntityCreateRequest createReq = + final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), entityESAllPrim); createReq.setFormat(ODataFormat.JSON); changeset.addRequest(createReq); @@ -397,21 +396,21 @@ public class BatchClientITCase extends AbstractTestITCase { int createRequestRef = changeset.getLastContentId(); // add update request - final ODataEntity entityUpdate = client.getObjectFactory().newEntity(entityESAllPrim.getTypeName()); + final ClientEntity entityUpdate = client.getObjectFactory().newEntity(entityESAllPrim.getTypeName()); entityUpdate.addLink(client.getObjectFactory().newEntitySetNavigationLink( "NavPropertyETTwoPrimMany", client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767).build())); - final ODataEntityUpdateRequest updateReq = client.getCUDRequestFactory().getEntityUpdateRequest( + final ODataEntityUpdateRequest updateReq = client.getCUDRequestFactory().getEntityUpdateRequest( URI.create("$" + createRequestRef), UpdateType.PATCH, entityUpdate); updateReq.setFormat(ODataFormat.JSON); - + changeset.addRequest(updateReq); final ODataBatchResponse response = streamManager.getResponse(); assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode()); final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next(); - + // verify response payload ... final Iterator bodyIterator = response.getBody(); final ODataBatchResponseItem item = bodyIterator.next(); @@ -422,31 +421,31 @@ public class BatchClientITCase extends AbstractTestITCase { ODataResponse res = chgitem.next(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), res.getStatusCode()); assertTrue(res instanceof ODataEntityCreateResponse); - final ODataEntityCreateResponse createResponse = ((ODataEntityCreateResponse) res); - + final ODataEntityCreateResponse createResponse = ((ODataEntityCreateResponse) res); + res = chgitem.next(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), res.getStatusCode()); assertTrue(res instanceof ODataEntityUpdateResponse); - - final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( + + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( new URI(createResponse.getHeader(HttpHeader.LOCATION).iterator().next() + "/NavPropertyETTwoPrimMany")); req.setFormat(ODataFormat.JSON); req.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse getResponse = req.execute(); - + final ODataRetrieveResponse getResponse = req.execute(); + assertEquals(32767, getResponse.getBody() - .getEntities() - .get(0) - .getProperty("PropertyInt16") - .getPrimitiveValue() - .toValue()); - } + .getEntities() + .get(0) + .getProperty("PropertyInt16") + .getPrimitiveValue() + .toValue()); + } @Test @SuppressWarnings("unchecked") public void changesetBatchRequest() throws URISyntaxException { final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); request.setAccept(ACCEPT); final BatchManager payload = request.payloadManager(); @@ -466,18 +465,18 @@ public class BatchClientITCase extends AbstractTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim"); URI editLink = targetURI.build(); - ODataEntity postEntity = client.getObjectFactory().newEntity( + ClientEntity postEntity = client.getObjectFactory().newEntity( new FullQualifiedName("olingo.odata.test1.ESAllPrim")); postEntity.addLink(of.newEntityNavigationLink("NavPropertyETTwoPrimOne", client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESTwoPrim") - .appendKeySegment(32766) - .build())); + .appendEntitySetSegment("ESTwoPrim") + .appendKeySegment(32766) + .build())); postEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty( "PropertyDouble", client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(3.1415))); - final ODataEntityCreateRequest createRequest = + final ODataEntityCreateRequest createRequest = client.getCUDRequestFactory().getEntityCreateRequest(editLink, postEntity); createRequest.setFormat(ODataFormat.JSON); @@ -488,15 +487,15 @@ public class BatchClientITCase extends AbstractTestITCase { targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(0); editLink = targetURI.build(); - ODataEntity patchEntity = client.getObjectFactory() - .newEntity(new FullQualifiedName("olingo.odata.test1.ESAllPrim")); + ClientEntity patchEntity = client.getObjectFactory() + .newEntity(new FullQualifiedName("olingo.odata.test1.ESAllPrim")); patchEntity.setEditLink(editLink); patchEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty( "PropertyDouble", client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(3.1415))); - ODataEntityUpdateRequest changeReq = + ODataEntityUpdateRequest changeReq = client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patchEntity); changeReq.setFormat(ODataFormat.JSON); changeset.addRequest(changeReq); @@ -512,12 +511,12 @@ public class BatchClientITCase extends AbstractTestITCase { patchEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty( "PropertyDouble", client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(3.1415))); - + patchEntity.addLink(of.newEntityNavigationLink("NavPropertyETTwoPrimOne", client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoPrim") .appendKeySegment(32766) .build())); - + changeReq = client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patchEntity); changeReq.setFormat(ODataFormat.JSON); changeset.addRequest(changeReq); @@ -541,24 +540,24 @@ public class BatchClientITCase extends AbstractTestITCase { assertTrue(item.hasNext()); final ODataResponse response0 = item.next(); assertTrue(response0 instanceof ODataRetrieveResponse); - assertEquals(34, ((ODataRetrieveResponse)response0).getBody() - .getProperty("PropertyDecimal") - .getPrimitiveValue() - .toValue()); - + assertEquals(34, ((ODataRetrieveResponse) response0).getBody() + .getProperty("PropertyDecimal") + .getPrimitiveValue() + .toValue()); + // Check change set assertTrue(bodyIterator.hasNext()); item = bodyIterator.next(); assertTrue(item.isChangeset()); - + // Insert assertTrue(item.hasNext()); final ODataResponse response1 = item.next(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), response1.getStatusCode()); assertTrue(response1 instanceof ODataEntityCreateResponse); - assertEquals(3.1415, ((ODataEntityCreateResponse) response1).getBody().getProperty("PropertyDouble") - .getPrimitiveValue() - .toValue()); + assertEquals(3.1415, ((ODataEntityCreateResponse) response1).getBody().getProperty("PropertyDouble") + .getPrimitiveValue() + .toValue()); // Update assertTrue(item.hasNext()); final ODataResponse response2 = item.next(); @@ -568,12 +567,12 @@ public class BatchClientITCase extends AbstractTestITCase { // Upsert assertTrue(item.hasNext()); final ODataResponse response3 = item.next(); - assertEquals(HttpStatusCode.CREATED.getStatusCode(),response3.getStatusCode()); + assertEquals(HttpStatusCode.CREATED.getStatusCode(), response3.getStatusCode()); assertTrue(response3 instanceof ODataEntityUpdateResponse); - assertEquals(3.1415, ((ODataEntityUpdateResponse) response3).getBody().getProperty("PropertyDouble") - .getPrimitiveValue() - .toValue()); - + assertEquals(3.1415, ((ODataEntityUpdateResponse) response3).getBody().getProperty("PropertyDouble") + .getPrimitiveValue() + .toValue()); + // Check second get request assertTrue(bodyIterator.hasNext()); item = bodyIterator.next(); @@ -581,18 +580,19 @@ public class BatchClientITCase extends AbstractTestITCase { assertTrue(item.hasNext()); final ODataResponse response4 = item.next(); assertTrue(response4 instanceof ODataRetrieveResponse); - assertEquals(3.1415, ((ODataRetrieveResponse)response4).getBody() - .getProperty("PropertyDouble") - .getPrimitiveValue() - .toValue()); + assertEquals(3.1415, ((ODataRetrieveResponse) response4).getBody() + .getProperty("PropertyDouble") + .getPrimitiveValue() + .toValue()); } + private void appendGetRequest(final BatchManager manager, final String segment, final Object key, boolean isRelative) throws URISyntaxException { final URIBuilder targetURI = client.newURIBuilder(SERVICE_URI); targetURI.appendEntitySetSegment(segment).appendKeySegment(key); final URI uri = (isRelative) ? new URI(SERVICE_URI).relativize(targetURI.build()) : targetURI.build(); - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri); queryReq.setFormat(ODataFormat.JSON); manager.addRequest(queryReq); } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java index 74b7718ea..57a3ed225 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java @@ -35,12 +35,12 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; @@ -77,10 +77,10 @@ public class BindingITCase extends AbstractBaseTestITCase { public void testCreateBindingSimple() throws EdmPrimitiveTypeException { final ODataClient client = getClient(); final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // Create entity (EntitySet: ESKeyNav, Type: ETKeyNav) - final ODataEntity entity = of.newEntity(ET_KEY_NAV); + final ClientEntity entity = of.newEntity(ET_KEY_NAV); entity.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42))); entity.getProperties() @@ -102,26 +102,26 @@ public class BindingITCase extends AbstractBaseTestITCase { .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42))))))); // Bind existing entities via binding synatx - entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, + entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_TWO_KEY_NAV) - .appendKeySegment(new LinkedHashMap() { - private static final long serialVersionUID = 3109256773218160485L; - { - put(PROPERTY_INT16, 3); - put(PROPERTY_STRING, "1"); - } - }).build())); - - final ODataLink navLinkOne = + .appendEntitySetSegment(ES_TWO_KEY_NAV) + .appendKeySegment(new LinkedHashMap() { + private static final long serialVersionUID = 3109256773218160485L; + { + put(PROPERTY_INT16, 3); + put(PROPERTY_STRING, "1"); + } + }).build())); + + final ClientLink navLinkOne = of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment( ES_KEY_NAV).appendKeySegment(1).build()); - final ODataLink navLinkMany1 = + final ClientLink navLinkMany1 = of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment( ES_KEY_NAV).appendKeySegment(2).build()); - final ODataLink navLinkMany2 = + final ClientLink navLinkMany2 = of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment( ES_KEY_NAV).appendKeySegment(3).build()); @@ -129,7 +129,7 @@ public class BindingITCase extends AbstractBaseTestITCase { final HashMap combinedKey = new HashMap(); combinedKey.put(PROPERTY_INT16, 1); combinedKey.put(PROPERTY_STRING, "1"); - final ODataLink navLink2Many = + final ClientLink navLink2Many = of.newEntitySetNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(combinedKey).build()); @@ -138,7 +138,7 @@ public class BindingITCase extends AbstractBaseTestITCase { entity.addLink(navLinkMany2); entity.addLink(navLink2Many); - final ODataEntityCreateResponse createResponse = + final ODataEntityCreateResponse createResponse = client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute(); final String cookie = createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next(); final Short entityInt16Key = @@ -149,17 +149,17 @@ public class BindingITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(entityInt16Key).expand( NAV_PROPERTY_ET_KEY_NAV_ONE, NAV_PROPERTY_ET_KEY_NAV_MANY, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build(); - final ODataEntityRequest entityGetRequest = + final ODataEntityRequest entityGetRequest = client.getRetrieveRequestFactory().getEntityRequest(entityGetURI); entityGetRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entityGetResponse = entityGetRequest.execute(); + final ODataRetrieveResponse entityGetResponse = entityGetRequest.execute(); // NAV_PROPERTY_ET_KEY_NAV_ONE assertEquals(1, entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); // NAV_PROPERTY_ET_KEY_NAV_MANY(0) - Iterator iterator = + Iterator iterator = entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().iterator(); assertEquals(2, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -176,10 +176,10 @@ public class BindingITCase extends AbstractBaseTestITCase { final URI etTwoKeyNavEntityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(combinedKey).expand( NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - final ODataEntityRequest etTwoKeyNavEntityRequest = + final ODataEntityRequest etTwoKeyNavEntityRequest = client.getRetrieveRequestFactory().getEntityRequest(etTwoKeyNavEntityURI); etTwoKeyNavEntityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse etTwoKeyNavEntityResponse = etTwoKeyNavEntityRequest.execute(); + final ODataRetrieveResponse etTwoKeyNavEntityResponse = etTwoKeyNavEntityRequest.execute(); assertEquals(entityInt16Key, etTwoKeyNavEntityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE) .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class)); @@ -194,23 +194,23 @@ public class BindingITCase extends AbstractBaseTestITCase { final ODataClient client = getClient(); final URI entityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // ESKeyNav(1).NavPropertyETKeyNavOne = ESKeyNav(2) // ESKeyNav(1).NavPropertyETKeyNavMany = { ESKeyNav(1), ESKeyNav(2) } // => Replace NavPropertyETKeyNavOne with ESKeyNav(3) // => Add to NavPropertyETKeyNavOne ESKeyNav(3) - final ODataEntity entity = of.newEntity(ET_KEY_NAV); - final ODataLink navLinkOne = + final ClientEntity entity = of.newEntity(ET_KEY_NAV); + final ClientLink navLinkOne = of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build()); - final ODataLink navLinkMany = + final ClientLink navLinkMany = of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build()); entity.addLink(navLinkOne); entity.addLink(navLinkMany); - final ODataEntityUpdateResponse updateResponse = + final ODataEntityUpdateResponse updateResponse = client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute(); final String cookie = updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next(); @@ -218,16 +218,16 @@ public class BindingITCase extends AbstractBaseTestITCase { final URI entityGetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).expand( NAV_PROPERTY_ET_KEY_NAV_ONE, NAV_PROPERTY_ET_KEY_NAV_MANY).build(); - final ODataEntityRequest entityRequest = + final ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(entityGetURI); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); assertEquals(3, entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals(3, entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().size()); - Iterator iterator = + Iterator iterator = entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().iterator(); assertEquals(1, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals(2, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -244,16 +244,16 @@ public class BindingITCase extends AbstractBaseTestITCase { final ODataClient client = getClient(); final URI entityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // Request to single (non collection) navigation property - ODataEntity entity = of.newEntity(ET_KEY_NAV); - final ODataLink navLinkOne = + ClientEntity entity = of.newEntity(ET_KEY_NAV); + final ClientLink navLinkOne = of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(42).build()); entity.addLink(navLinkOne); - ODataEntityUpdateResponse updateResponse = null; + ODataEntityUpdateResponse updateResponse = null; try { updateResponse = client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute(); @@ -264,7 +264,7 @@ public class BindingITCase extends AbstractBaseTestITCase { // Request to collection navigation propetry entity = of.newEntity(ET_KEY_NAV); - final ODataLink navLinkMany = + final ClientLink navLinkMany = of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build()); entity.addLink(navLinkMany); @@ -282,114 +282,114 @@ public class BindingITCase extends AbstractBaseTestITCase { final ODataClient client = getClient(); final URI entityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // Request to single (non collection) navigation property - ODataEntity entity = of.newEntity(ET_KEY_NAV); - final ODataProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_ONE, null); + ClientEntity entity = of.newEntity(ET_KEY_NAV); + final ClientProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_ONE, null); entity.getProperties().add(navPropery); - ODataEntityUpdateResponse updateResponse = + ODataEntityUpdateResponse updateResponse = client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), updateResponse.getStatusCode()); - final ODataEntityRequest getRequest = + final ODataEntityRequest getRequest = client.getRetrieveRequestFactory().getEntityRequest( client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).expand( NAV_PROPERTY_ET_KEY_NAV_ONE).build()); getRequest.addCustomHeader(HttpHeader.COOKIE, updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse getResponse = getRequest.execute(); + final ODataRetrieveResponse getResponse = getRequest.execute(); - ODataProperty property = getResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE); + ClientProperty property = getResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE); assertEquals(null, property.getPrimitiveValue()); } - + @Test public void testUpdateCollectionNavigationPropertyWithNull() { final ODataClient client = getClient(); final URI entityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build(); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); // Request to single (non collection) navigation property - ODataEntity entity = of.newEntity(ET_KEY_NAV); - final ODataProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_MANY, null); + ClientEntity entity = of.newEntity(ET_KEY_NAV); + final ClientProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_MANY, null); entity.getProperties().add(navPropery); try { client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute(); fail(); - } catch(ODataClientErrorException e) { + } catch (ODataClientErrorException e) { assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode()); } } - + @Test public void testDeepInsertWithBindingSameNavigationProperty() { - final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); - final ODataObjectFactory of = client.getObjectFactory(); - - final ODataEntity entity = of.newEntity(ET_KEY_NAV); - entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder() - .buildString("1"))); - entity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) - .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short)1))) - .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1"))))); - - final ODataEntity innerEntity = of.newEntity(ET_KEY_NAV); - innerEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder() + final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); + client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); + final ClientObjectFactory of = client.getObjectFactory(); + + final ClientEntity entity = of.newEntity(ET_KEY_NAV); + entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder() + .buildString("1"))); + entity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) + .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1))) + .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1"))))); + + final ClientEntity innerEntity = of.newEntity(ET_KEY_NAV); + innerEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder() .buildString("2"))); - innerEntity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) + innerEntity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("2"))))); - innerEntity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, - client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_TWO_KEY_NAV) - .appendKeySegment(new LinkedHashMap() { - private static final long serialVersionUID = 3109256773218160485L; - { - put(PROPERTY_INT16, 3); - put(PROPERTY_STRING, "1"); - } - }).build())); - - final ODataInlineEntity inlineLink = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity); - entity.addLink(inlineLink); - - entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, - client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_TWO_KEY_NAV) - .appendKeySegment(new LinkedHashMap() { - private static final long serialVersionUID = 3109256773218160485L; - { - put(PROPERTY_INT16, 3); - put(PROPERTY_STRING, "1"); - } - }).build())); - - final URI bindingURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV) - .appendKeySegment(3) - .build(); - - entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, bindingURI)); - - final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); - final ODataEntityCreateResponse response = - client.getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute(); - - assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); - - assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE) - .asInlineEntity() - .getEntity() - .getProperty(PROPERTY_COMP_TWO_PRIM) - .getComplexValue() - .get(PROPERTY_INT16) - .getPrimitiveValue() - .toValue()); + innerEntity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, + client.newURIBuilder(SERVICE_URI) + .appendEntitySetSegment(ES_TWO_KEY_NAV) + .appendKeySegment(new LinkedHashMap() { + private static final long serialVersionUID = 3109256773218160485L; + { + put(PROPERTY_INT16, 3); + put(PROPERTY_STRING, "1"); + } + }).build())); + + final ClientInlineEntity inlineLink = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity); + entity.addLink(inlineLink); + + entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, + client.newURIBuilder(SERVICE_URI) + .appendEntitySetSegment(ES_TWO_KEY_NAV) + .appendKeySegment(new LinkedHashMap() { + private static final long serialVersionUID = 3109256773218160485L; + { + put(PROPERTY_INT16, 3); + put(PROPERTY_STRING, "1"); + } + }).build())); + + final URI bindingURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV) + .appendKeySegment(3) + .build(); + + entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, bindingURI)); + + final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); + final ODataEntityCreateResponse response = + client.getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute(); + + assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); + + assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE) + .asInlineEntity() + .getEntity() + .getProperty(PROPERTY_COMP_TWO_PRIM) + .getComplexValue() + .get(PROPERTY_INT16) + .getPrimitiveValue() + .toValue()); } - + @Override protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getClient(); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java index b043a02d7..5e25b799d 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java @@ -40,15 +40,15 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; @@ -93,8 +93,8 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON); final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); - final ODataObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = of.newEntity(ET_KEY_NAV); + final ClientObjectFactory of = client.getObjectFactory(); + final ClientEntity entity = of.newEntity(ET_KEY_NAV); // Root entity entity.getProperties().add( @@ -106,7 +106,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { "String Property level 0, complex level 1"))))); // First level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav - final ODataEntity firstLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV); + final ClientEntity firstLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV); firstLevelTwoKeyNav.getProperties().add( of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42))) @@ -116,12 +116,12 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); firstLevelTwoKeyNav.getProperties().add( of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV))); - final ODataInlineEntity firstLevelTwoKeyOneInline = + final ClientInlineEntity firstLevelTwoKeyOneInline = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, firstLevelTwoKeyNav); entity.addLink(firstLevelTwoKeyOneInline); // Second level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav - final ODataEntity secondLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV); + final ClientEntity secondLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV); secondLevelTwoKeyNav.getProperties().add( of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 421))) @@ -131,7 +131,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); secondLevelTwoKeyNav.getProperties().add( of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV))); - + // Binding links secondLevelTwoKeyNav.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, client.newURIBuilder( SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(new LinkedHashMap() { @@ -142,12 +142,12 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { } }).build())); - final ODataInlineEntity secondLevelTwoKeyOneInline = + final ClientInlineEntity secondLevelTwoKeyOneInline = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, secondLevelTwoKeyNav); firstLevelTwoKeyNav.addLink(secondLevelTwoKeyOneInline); // Third level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav - final ODataEntity thirdLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV); + final ClientEntity thirdLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV); thirdLevelTwoKeyNavMany1.getProperties().add( of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431))) @@ -157,8 +157,8 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); thirdLevelTwoKeyNavMany1.getProperties().add( of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV))); - - final ODataEntity thirdLevelTwoKeyNavMany2 = of.newEntity(ET_TWO_KEY_NAV); + + final ClientEntity thirdLevelTwoKeyNavMany2 = of.newEntity(ET_TWO_KEY_NAV); thirdLevelTwoKeyNavMany2.getProperties().add( of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432))) @@ -168,15 +168,15 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); thirdLevelTwoKeyNavMany2.getProperties().add( of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV))); - - final ODataEntitySet entitySetThirdLevelTwoKeyNavMany = of.newEntitySet(); + + final ClientEntitySet entitySetThirdLevelTwoKeyNavMany = of.newEntitySet(); entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany1); entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany2); secondLevelTwoKeyNav.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, entitySetThirdLevelTwoKeyNavMany)); // First level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav - final ODataEntity firstLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV); + final ClientEntity firstLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV); firstLevelTwoKeyNavMany1.getProperties().add( of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 422))) @@ -186,17 +186,17 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); firstLevelTwoKeyNavMany1.getProperties().add( of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV))); - - final ODataEntitySet entitySetfirstLevelTwoKeyNavMany = of.newEntitySet(); + + final ClientEntitySet entitySetfirstLevelTwoKeyNavMany = of.newEntitySet(); entitySetfirstLevelTwoKeyNavMany.getEntities().add(firstLevelTwoKeyNavMany1); entity.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, entitySetfirstLevelTwoKeyNavMany)); - final ODataEntityCreateResponse createResponse = + final ODataEntityCreateResponse createResponse = client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute(); // Check response - final ODataEntity resultEntityFirstLevel = + final ClientEntity resultEntityFirstLevel = createResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE).asInlineEntity().getEntity(); assertEquals(42, resultEntityFirstLevel.getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue().get(PROPERTY_INT16) .getPrimitiveValue().toValue()); @@ -204,7 +204,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .getComplexValue().get(PROPERTY_STRING) .getPrimitiveValue().toValue()); - final ODataEntity resultEntitySecondLevel = + final ClientEntity resultEntitySecondLevel = resultEntityFirstLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE).asInlineEntity().getEntity(); assertEquals(421, resultEntitySecondLevel.getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue().get(PROPERTY_INT16) .getPrimitiveValue().toValue()); @@ -213,7 +213,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .getComplexValue().get(PROPERTY_STRING) .getPrimitiveValue().toValue()); - final ODataEntitySet thirdLevelEntitySetNavMany = + final ClientEntitySet thirdLevelEntitySetNavMany = resultEntitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); assertEquals(2, thirdLevelEntitySetNavMany.getEntities().size()); @@ -227,7 +227,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { assertEquals("String Property level 3, complex level 1", thirdLevelEntitySetNavMany.getEntities().get(1) .getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue().get(PROPERTY_STRING).getPrimitiveValue().toValue()); - final ODataEntitySet firstLevelEntitySetNavMany = + final ClientEntitySet firstLevelEntitySetNavMany = createResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); assertEquals(1, firstLevelEntitySetNavMany.getEntities().size()); assertEquals(422, firstLevelEntitySetNavMany.getEntities().get(0).getProperty(PROPERTY_COMP_TWO_PRIM) @@ -240,8 +240,8 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { public void testSimpleDeepInsert() throws EdmPrimitiveTypeException { final ODataClient client = getClient(); final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); - final ODataObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); + final ClientObjectFactory of = client.getObjectFactory(); + final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav) entity.getProperties() @@ -266,7 +266,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { // Non collection navigation property // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne) - final ODataEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntitySingle.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43))); inlineEntitySingle.getProperties() @@ -284,7 +284,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { // Collection navigation property // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne" // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany - final ODataEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntityCol1.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44))); inlineEntityCol1.getProperties() @@ -299,7 +299,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442"))))); - final ODataEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntityCol2.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45))); inlineEntityCol2.getProperties() @@ -314,19 +314,19 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452"))))); - final ODataInlineEntity newDeepInsertEntityLink = + final ClientInlineEntity newDeepInsertEntityLink = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle); - final ODataEntitySet newDeepInsertEntitySet = of.newEntitySet(); + final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet(); newDeepInsertEntitySet.getEntities().add(inlineEntityCol1); newDeepInsertEntitySet.getEntities().add(inlineEntityCol2); - final ODataInlineEntitySet newDeepInsertEntitySetLink = + final ClientInlineEntitySet newDeepInsertEntitySetLink = of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet); entity.addLink(newDeepInsertEntityLink); entity.addLink(newDeepInsertEntitySetLink); // Perform create request - final ODataEntityCreateResponse responseCreate = client.getCUDRequestFactory() + final ODataEntityCreateResponse responseCreate = client.getCUDRequestFactory() .getEntityCreateRequest(createURI, entity) .execute(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), responseCreate.getStatusCode()); @@ -334,16 +334,16 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).toString(); // Fetch ESKeyNav entity with expand of NavPropertyETTwoKeyNavOne nav. property - ODataProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16); + ClientProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16); final URI esKeyNavURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment( propertyInt16.getPrimitiveValue().toValue()).expand(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build(); - final ODataEntityRequest esKeyNavRequest = client.getRetrieveRequestFactory() + final ODataEntityRequest esKeyNavRequest = client.getRetrieveRequestFactory() .getEntityRequest(esKeyNavURI); esKeyNavRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esKeyNavResponse = esKeyNavRequest.execute(); + final ODataRetrieveResponse esKeyNavResponse = esKeyNavRequest.execute(); // Check nav. property NavPropertyETTwoKeyNavOne assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE)); @@ -354,12 +354,12 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(2, esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue() .size()); - Iterator twoKeyNavManyIterator = + Iterator twoKeyNavManyIterator = esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue().iterator(); - final ODataValue firstTwoKeyNavEnity = twoKeyNavManyIterator.next(); // First entity + final ClientValue firstTwoKeyNavEnity = twoKeyNavManyIterator.next(); // First entity assertEquals(441, firstTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get( PROPERTY_INT16).getPrimitiveValue().toValue()); - final ODataValue secondTwoKeyNavEnity = twoKeyNavManyIterator.next(); // Second entity + final ClientValue secondTwoKeyNavEnity = twoKeyNavManyIterator.next(); // Second entity assertEquals(451, secondTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -378,10 +378,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .appendKeySegment(composedKey) .build(); - final ODataEntityRequest esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory() + final ODataEntityRequest esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory() .getEntityRequest(esTwoKeyNavEntitySingleURI); esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute(); assertEquals(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -395,10 +395,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - final ODataEntityRequest esTwoKeyNavManyOneRequest = + final ODataEntityRequest esTwoKeyNavManyOneRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyOneURI); esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute(); assertEquals(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -416,10 +416,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - final ODataEntityRequest esTwoKeyNavManyTwoRequest = + final ODataEntityRequest esTwoKeyNavManyTwoRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyTwoURI); esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute(); assertEquals(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -432,8 +432,8 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { public void testDeepInsertSameEntitySet() throws EdmPrimitiveTypeException { final ODataClient client = getClient(); final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); - final ODataObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); + final ClientObjectFactory of = client.getObjectFactory(); + final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav) entity.getProperties() @@ -469,7 +469,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .build())); // Prepare inline entity(EntitySet: ESKeyNav, Type: ETKeyNav) - final ODataEntity innerEntity = of.newEntity(ET_KEY_NAV); + final ClientEntity innerEntity = of.newEntity(ET_KEY_NAV); innerEntity.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43))); innerEntity.getProperties() @@ -503,11 +503,11 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { } }) .build())); - - ODataInlineEntity inlineEntity = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity); + + ClientInlineEntity inlineEntity = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity); entity.addLink(inlineEntity); - final ODataEntityCreateResponse responseCreate = + final ODataEntityCreateResponse responseCreate = client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute(); final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).iterator().next(); final Short esKeyNavEntityKey = @@ -518,9 +518,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(esKeyNavEntityKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - ODataEntityRequest entityRequest = client.getRetrieveRequestFactory().getEntityRequest(fetchEntityURI); + ODataEntityRequest entityRequest = + client.getRetrieveRequestFactory().getEntityRequest(fetchEntityURI); entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse entityResponse = entityRequest.execute(); + final ODataRetrieveResponse entityResponse = entityRequest.execute(); // Check values assertEquals(431, entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get( @@ -533,10 +534,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { final URI innerEntityURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(innerEntityInt16Key) .build(); - final ODataEntityRequest innerRequest = + final ODataEntityRequest innerRequest = client.getRetrieveRequestFactory().getEntityRequest(innerEntityURI); innerRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - ODataRetrieveResponse innerResponse = innerRequest.execute(); + ODataRetrieveResponse innerResponse = innerRequest.execute(); assertEquals(431, innerResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get(PROPERTY_INT16) .getPrimitiveValue().toValue()); @@ -545,11 +546,11 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { @Test public void testConsistency() throws EdmPrimitiveTypeException { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); final String cookie = getCookie(); - + // Do not set PropertyString(Nullable=false) - final ODataEntity entity = of.newEntity(ET_KEY_NAV); + final ClientEntity entity = of.newEntity(ET_KEY_NAV); entity.getProperties().add( of.newCollectionProperty(COL_PROPERTY_STRING, of.newCollectionValue(EDM_STRING).add( @@ -558,7 +559,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); try { - ODataEntityCreateRequest request = client.getCUDRequestFactory() + ODataEntityCreateRequest request = client.getCUDRequestFactory() .getEntityCreateRequest(targetURI, entity); request.addCustomHeader(HttpHeader.COOKIE, cookie); request.execute(); @@ -570,19 +571,19 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { // Entity must not be created validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3); } - + @Test public void testInvalidType() throws EdmPrimitiveTypeException { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); + final ClientObjectFactory of = client.getObjectFactory(); final String cookie = getCookie(); - final ODataEntity entity = of.newEntity(ET_KEY_NAV); + final ClientEntity entity = of.newEntity(ET_KEY_NAV); entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildInt32(1))); final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build(); try { - ODataEntityCreateRequest request = client.getCUDRequestFactory() + ODataEntityCreateRequest request = client.getCUDRequestFactory() .getEntityCreateRequest(targetURI, entity); request.addCustomHeader(HttpHeader.COOKIE, cookie); request.execute(); @@ -598,7 +599,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newPrimitiveValueBuilder().buildString("Test")))); try { - ODataEntityCreateRequest request = client.getCUDRequestFactory() + ODataEntityCreateRequest request = client.getCUDRequestFactory() .getEntityCreateRequest(targetURI, entity); request.addCustomHeader(HttpHeader.COOKIE, cookie); request.execute(); @@ -608,14 +609,14 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3); } - + @Test @Ignore public void testDeepInsertOnNavigationPropertyInComplexProperty() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataObjectFactory of = client.getObjectFactory(); - - final ODataEntity inlineEntity = of.newEntity(ET_TWO_KEY_NAV); + final ClientObjectFactory of = client.getObjectFactory(); + + final ClientEntity inlineEntity = of.newEntity(ET_TWO_KEY_NAV); inlineEntity.getProperties().add( of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); inlineEntity.getProperties().add( @@ -624,8 +625,8 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1"))))); - - final ODataEntity entity = of.newEntity(ET_TWO_KEY_NAV); + + final ClientEntity entity = of.newEntity(ET_TWO_KEY_NAV); entity.getProperties().add( of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP))); entity.getProperties().add( @@ -634,46 +635,46 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM) .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 2))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("2"))))); - - final ODataLink link = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntity); - final ODataComplexValue complexValueCreate = of.newComplexValue(CT_NAV_FIVE_PROP); + + final ClientLink link = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntity); + final ClientComplexValue complexValueCreate = of.newComplexValue(CT_NAV_FIVE_PROP); complexValueCreate.getNavigationLinks().add(link); - + entity.getProperties().add( of.newCollectionProperty(COL_PROPERTY_COMP_NAV, of.newCollectionValue(CT_NAV_FIVE_PROP) - .add(complexValueCreate))); - + .add(complexValueCreate))); + final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).build(); - final ODataEntityCreateResponse response = client.getCUDRequestFactory() - .getEntityCreateRequest(targetURI, entity) - .execute(); - + final ODataEntityCreateResponse response = client.getCUDRequestFactory() + .getEntityCreateRequest(targetURI, entity) + .execute(); + assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); - final Iterator iter = response.getBody() - .getProperty(COL_PROPERTY_COMP_NAV) - .getCollectionValue() - .iterator(); - + final Iterator iter = response.getBody() + .getProperty(COL_PROPERTY_COMP_NAV) + .getCollectionValue() + .iterator(); + assertTrue(iter.hasNext()); - final ODataComplexValue complexValue = iter.next().asComplex(); - final ODataLink linkedEntity = complexValue.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE); + final ClientComplexValue complexValue = iter.next().asComplex(); + final ClientLink linkedEntity = complexValue.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE); assertNotNull(linkedEntity); assertEquals(1, linkedEntity.asInlineEntity() - .getEntity() - .getProperty(PROPERTY_INT16) - .getPrimitiveValue() - .toValue()); + .getEntity() + .getProperty(PROPERTY_INT16) + .getPrimitiveValue() + .toValue()); } - + @Test public void testDeepUpsert() { final ODataClient client = getClient(); final URI updateURI = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_KEY_NAV) - .appendKeySegment(815) - .build(); - final ODataObjectFactory of = client.getObjectFactory(); - final ODataEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); + .appendEntitySetSegment(ES_KEY_NAV) + .appendKeySegment(815) + .build(); + final ClientObjectFactory of = client.getObjectFactory(); + final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV); // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav) entity.getProperties() @@ -698,7 +699,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { // Non collection navigation property // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne) - final ODataEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntitySingle.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43))); inlineEntitySingle.getProperties() @@ -716,7 +717,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { // Collection navigation property // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne" // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany - final ODataEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntityCol1.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44))); inlineEntityCol1.getProperties() @@ -731,7 +732,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442"))))); - final ODataEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); + final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV); inlineEntityCol2.getProperties() .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45))); inlineEntityCol2.getProperties() @@ -746,19 +747,19 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452))) .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452"))))); - final ODataInlineEntity newDeepInsertEntityLink = + final ClientInlineEntity newDeepInsertEntityLink = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle); - final ODataEntitySet newDeepInsertEntitySet = of.newEntitySet(); + final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet(); newDeepInsertEntitySet.getEntities().add(inlineEntityCol1); newDeepInsertEntitySet.getEntities().add(inlineEntityCol2); - final ODataInlineEntitySet newDeepInsertEntitySetLink = + final ClientInlineEntitySet newDeepInsertEntitySetLink = of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet); entity.addLink(newDeepInsertEntityLink); entity.addLink(newDeepInsertEntitySetLink); // Perform update request (upsert) - final ODataEntityUpdateResponse responseCreate = client.getCUDRequestFactory() + final ODataEntityUpdateResponse responseCreate = client.getCUDRequestFactory() .getEntityUpdateRequest(updateURI, UpdateType.PATCH, entity) .execute(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), responseCreate.getStatusCode()); @@ -766,16 +767,16 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).toString(); // Fetch ESKeyNav entity with expand of NavPropertyETTwoKeyNavOne nav. property - ODataProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16); + ClientProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16); final URI esKeyNavURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment( propertyInt16.getPrimitiveValue().toValue()).expand(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build(); - final ODataEntityRequest esKeyNavRequest = client.getRetrieveRequestFactory() + final ODataEntityRequest esKeyNavRequest = client.getRetrieveRequestFactory() .getEntityRequest(esKeyNavURI); esKeyNavRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esKeyNavResponse = esKeyNavRequest.execute(); + final ODataRetrieveResponse esKeyNavResponse = esKeyNavRequest.execute(); // Check nav. property NavPropertyETTwoKeyNavOne assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE)); @@ -786,12 +787,12 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(2, esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue() .size()); - Iterator twoKeyNavManyIterator = + Iterator twoKeyNavManyIterator = esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue().iterator(); - final ODataValue firstTwoKeyNavEnity = twoKeyNavManyIterator.next(); // First entity + final ClientValue firstTwoKeyNavEnity = twoKeyNavManyIterator.next(); // First entity assertEquals(441, firstTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get( PROPERTY_INT16).getPrimitiveValue().toValue()); - final ODataValue secondTwoKeyNavEnity = twoKeyNavManyIterator.next(); // Second entity + final ClientValue secondTwoKeyNavEnity = twoKeyNavManyIterator.next(); // Second entity assertEquals(451, secondTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -810,10 +811,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { .appendKeySegment(composedKey) .build(); - final ODataEntityRequest esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory() + final ODataEntityRequest esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory() .getEntityRequest(esTwoKeyNavEntitySingleURI); esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute(); assertEquals(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -827,10 +828,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - final ODataEntityRequest esTwoKeyNavManyOneRequest = + final ODataEntityRequest esTwoKeyNavManyOneRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyOneURI); esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute(); assertEquals(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -848,22 +849,22 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey) .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build(); - final ODataEntityRequest esTwoKeyNavManyTwoRequest = + final ODataEntityRequest esTwoKeyNavManyTwoRequest = client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyTwoURI); esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute(); + final ODataRetrieveResponse esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute(); assertEquals(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get( PROPERTY_INT16).getPrimitiveValue().toValue()); assertNotNull(esTwoKeyNavManyTwoResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue()); assertEquals(propertyInt16.getPrimitiveValue().toValue(), esTwoKeyNavManyTwoResponse.getBody().getProperty( NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue()); - + } - + private String getCookie() { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataRetrieveResponse response = client.getRetrieveRequestFactory() + final ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build()) .execute(); @@ -872,15 +873,15 @@ public class DeepInsertITCase extends AbstractBaseTestITCase { private void validateSet(final URI uri, final String cookie, final short... keys) throws EdmPrimitiveTypeException { final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI); - final ODataEntitySetRequest request = client.getRetrieveRequestFactory() + final ODataEntitySetRequest request = client.getRetrieveRequestFactory() .getEntitySetRequest(uri); request.addCustomHeader(HttpHeader.COOKIE, cookie); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertEquals(3, response.getBody().getEntities().size()); - for (final ODataEntity responseEntity : response.getBody().getEntities()) { + for (final ClientEntity responseEntity : response.getBody().getEntities()) { short propertyInt16 = responseEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class); boolean found = false; diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java index 9038c4b71..9a430ff36 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,12 +28,12 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; @@ -44,24 +44,24 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readSelect() { final ODataClient client = getClient(); - final ODataEntityRequest request = client.getRetrieveRequestFactory() + final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESAllPrim").appendKeySegment(Short.MAX_VALUE) .select("PropertyInt32,PropertyInt16") .build()); assertNotNull(request); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); assertNotNull(entity.getProperties()); assertEquals(2, entity.getProperties().size()); assertNull(entity.getProperty("PropertyString")); - ODataProperty property = entity.getProperty("PropertyInt16"); + ClientProperty property = entity.getProperty("PropertyInt16"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(Integer.valueOf(Short.MAX_VALUE), property.getPrimitiveValue().toValue()); @@ -75,7 +75,7 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readExpandSelect() { final ODataClient client = getClient(); - final ODataEntityRequest request = client.getRetrieveRequestFactory() + final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(-365) .expand("NavPropertyETAllPrimMany($select=PropertyTimeOfDay,PropertySByte)") @@ -83,30 +83,30 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { .build()); assertNotNull(request); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); assertNull(entity.getProperty("PropertyInt16")); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String2", property.getPrimitiveValue().toValue()); assertNull(entity.getNavigationLink("NavPropertyETAllPrimOne")); - final ODataLink link = entity.getNavigationLink("NavPropertyETAllPrimMany"); + final ClientLink link = entity.getNavigationLink("NavPropertyETAllPrimMany"); assertNotNull(link); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, link.getType()); - final ODataInlineEntitySet inlineEntitySet = link.asInlineEntitySet(); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType()); + final ClientInlineEntitySet inlineEntitySet = link.asInlineEntitySet(); assertNotNull(inlineEntitySet); - final List entities = inlineEntitySet.getEntitySet().getEntities(); + final List entities = inlineEntitySet.getEntitySet().getEntities(); assertNotNull(entities); assertEquals(2, entities.size()); - final ODataEntity inlineEntity = entities.get(0); + final ClientEntity inlineEntity = entities.get(0); assertEquals(2, inlineEntity.getProperties().size()); assertEquals(-128, inlineEntity.getProperty("PropertySByte").getPrimitiveValue().toValue()); assertEquals(new java.sql.Timestamp(85754000), @@ -116,33 +116,33 @@ public final class ExpandSelectITCase extends AbstractBaseTestITCase { @Test public void readExpandTwoLevels() { final ODataClient client = getClient(); - final ODataEntityRequest request = client.getRetrieveRequestFactory() + final ODataEntityRequest request = client.getRetrieveRequestFactory() .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767) .expand("NavPropertyETAllPrimOne($expand=NavPropertyETTwoPrimOne)") .build()); assertNotNull(request); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); assertEquals(2, entity.getProperties().size()); assertNull(entity.getNavigationLink("NavPropertyETAllPrimMany")); - final ODataLink link = entity.getNavigationLink("NavPropertyETAllPrimOne"); + final ClientLink link = entity.getNavigationLink("NavPropertyETAllPrimOne"); assertNotNull(link); - assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType()); - final ODataInlineEntity inlineEntity = link.asInlineEntity(); + assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType()); + final ClientInlineEntity inlineEntity = link.asInlineEntity(); assertNotNull(inlineEntity); assertEquals(16, inlineEntity.getEntity().getProperties().size()); - final ODataLink innerLink = inlineEntity.getEntity().getNavigationLink("NavPropertyETTwoPrimOne"); + final ClientLink innerLink = inlineEntity.getEntity().getNavigationLink("NavPropertyETTwoPrimOne"); assertNotNull(innerLink); - assertEquals(ODataLinkType.ENTITY_NAVIGATION, innerLink.getType()); - final ODataEntity innerEntity = innerLink.asInlineEntity().getEntity(); + assertEquals(ClientLinkType.ENTITY_NAVIGATION, innerLink.getType()); + final ClientEntity innerEntity = innerLink.asInlineEntity().getEntity(); assertNotNull(innerEntity); assertEquals(2, innerEntity.getProperties().size()); assertEquals(32767, innerEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue()); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java index 1a6b411d3..38aec6146 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java @@ -33,8 +33,8 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; @@ -58,20 +58,20 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { final Map options = new HashMap(); options.put(QueryOption.FILTER, "PropertyString eq '2'"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_TWO_KEY_NAV, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(4, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue(); - final ODataEntitySet inlineEntitySet = + final ClientEntitySet inlineEntitySet = entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1) && propString.equals("1")) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); @@ -79,7 +79,7 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { assertEquals(0, inlineEntitySet.getEntities().size()); } else if (propInt16.equals(2) && propString.equals("1")) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); @@ -96,21 +96,21 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { final Map options = new HashMap(); options.put(QueryOption.ORDERBY, "PropertyString desc"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_TWO_KEY_NAV, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(4, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue(); - final ODataEntitySet inlineEntitySet = + final ClientEntitySet inlineEntitySet = entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1) && propString.equals("1")) { assertEquals(2, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity1 = inlineEntitySet.getEntities().get(0); - final ODataEntity inlineEntity2 = inlineEntitySet.getEntities().get(1); + final ClientEntity inlineEntity1 = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity2 = inlineEntitySet.getEntities().get(1); assertEquals(1, inlineEntity1.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", inlineEntity1.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); @@ -120,30 +120,30 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { } } } - + @Test public void testSkip() { final Map options = new HashMap(); options.put(QueryOption.SKIP, "1"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_KEY_NAV, NAV_PROPERTY_ET_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(3, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); - final ODataEntitySet inlineEntitySet = + final ClientEntitySet inlineEntitySet = entity.getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1)) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(2, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); } else if (propInt16.equals(2)) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(3, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); } else if (propInt16.equals(3)) { @@ -157,24 +157,24 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { final Map options = new HashMap(); options.put(QueryOption.TOP, "1"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_KEY_NAV, NAV_PROPERTY_ET_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(3, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); - final ODataEntitySet inlineEntitySet = + final ClientEntitySet inlineEntitySet = entity.getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1)) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); } else if (propInt16.equals(2)) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(2, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); } else if (propInt16.equals(3)) { @@ -190,20 +190,20 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { options.put(QueryOption.FILTER, "PropertyInt16 eq 1"); options.put(QueryOption.SKIP, "1"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_TWO_KEY_NAV, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(4, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue(); - final ODataEntitySet inlineEntitySet = + final ClientEntitySet inlineEntitySet = entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1) && propString.equals("1")) { assertEquals(1, inlineEntitySet.getEntities().size()); - final ODataEntity inlineEntity = inlineEntitySet.getEntities().get(0); + final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0); assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); @@ -231,16 +231,16 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).expandWithOptions( NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options).addQueryOption(QueryOption.SELECT, "PropertyInt16,PropertyString").build(); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntitySetRequest(uri).execute(); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(4, entities.size()); - for (final ODataEntity entity : entities) { + for (final ClientEntity entity : entities) { final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue(); final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue(); - final ODataEntitySet entitySet = + final ClientEntitySet entitySet = entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); if (propInt16.equals(1) && propString.equals("1")) { @@ -269,11 +269,11 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(keys) .expandWithOptions(NAV_PROPERTY_ET_KEY_NAV_MANY, options).build(); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntityRequest(uri).execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntitySet entitySet = + final ClientEntitySet entitySet = response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet().getEntitySet(); assertEquals(1, entitySet.getEntities().size()); assertEquals(1, entitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); @@ -284,182 +284,182 @@ public class ExpandWithSystemQueryOptionsITCase extends AbstractBaseTestITCase { final Map options = new HashMap(); options.put(QueryOption.FILTER, "PropertyInt16 eq 1" + " and PropertyComp/PropertyComp/PropertyDuration eq duration'PT1S' and length(PropertyString) gt 4"); - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = buildRequest(ES_TWO_KEY_NAV, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options); - final List entities = response.getBody().getEntities(); + final List entities = response.getBody().getEntities(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertEquals(4, entities.size()); } - + @Test public void testCyclicExpand() { // Expand entity in the following order // 1 => 2 => 1 - // Entity with Key (PropertyInt16=1, PrroperyString='1') holds references to (PropertyInt16=1, PropertyString='1') + // Entity with Key (PropertyInt16=1, PrroperyString='1') holds references to (PropertyInt16=1, PropertyString='1') // and (PropertyInt16=1, PropertyString='2') // Entity with Key (PropertyInt16=1, PropertyString='2') holds references to (PropertyInt16=1, PropertyString='1') // Define filters to select explicit the entities at any level => Circle - + final ODataClient client = getClient(); final Map options = new HashMap(); - options.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY - + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY - + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + "))"); + options.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + "))"); options.put(QueryOption.FILTER, "PropertyString eq '2'"); - + final Map keys = new HashMap(); keys.put(PROPERTY_INT16, 1); keys.put(PROPERTY_STRING, "1"); - + final URI uri = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_TWO_KEY_NAV) - .appendKeySegment(keys) - .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options) - .build(); - - final ODataRetrieveResponse response = client.getRetrieveRequestFactory() - .getEntityRequest(uri) - .execute(); - + .appendEntitySetSegment(ES_TWO_KEY_NAV) + .appendKeySegment(keys) + .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options) + .build(); + + final ODataRetrieveResponse response = client.getRetrieveRequestFactory() + .getEntityRequest(uri) + .execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertNotNull(response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final ODataEntity entitySecondLevel = response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final ClientEntity entitySecondLevel = response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0); + assertEquals(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", entitySecondLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); - + assertNotNull(entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(1, entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final ODataEntity entityThirdLevel = entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final ClientEntity entityThirdLevel = entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0); + assertEquals(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("1", entityThirdLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); - + assertNotNull(entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(2, entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final List fourthLevelEntites = entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities(); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final List fourthLevelEntites = entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities(); + assertEquals(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("1", fourthLevelEntites.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); assertEquals(1, fourthLevelEntites.get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", fourthLevelEntites.get(1).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); } - + @Test public void testSystemQueryOptionOnThirdLevel() { final ODataClient client = getClient(); final Map options = new HashMap(); - options.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY - + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY - + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY - + ";$filter=PropertyString eq '1'))"); + options.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + + "($expand=" + NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + + ";$filter=PropertyString eq '1'))"); options.put(QueryOption.FILTER, "PropertyString eq '2'"); - + final Map keys = new HashMap(); keys.put(PROPERTY_INT16, 1); keys.put(PROPERTY_STRING, "1"); - + final URI uri = client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment(ES_TWO_KEY_NAV) - .appendKeySegment(keys) - .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options) - .build(); - - final ODataRetrieveResponse response = client.getRetrieveRequestFactory() - .getEntityRequest(uri) - .execute(); - + .appendEntitySetSegment(ES_TWO_KEY_NAV) + .appendKeySegment(keys) + .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, options) + .build(); + + final ODataRetrieveResponse response = client.getRetrieveRequestFactory() + .getEntityRequest(uri) + .execute(); + assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertNotNull(response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final ODataEntity entitySecondLevel = response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final ClientEntity entitySecondLevel = response.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0); + assertEquals(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("2", entitySecondLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); - + assertNotNull(entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(1, entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final ODataEntity entityThirdLevel = entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .get(0); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final ClientEntity entityThirdLevel = entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .get(0); + assertEquals(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("1", entityThirdLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); - + assertNotNull(entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)); assertEquals(1, entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities() - .size()); - - final List fourthLevelEntites = entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) - .asInlineEntitySet() - .getEntitySet() - .getEntities(); - + .asInlineEntitySet() + .getEntitySet() + .getEntities() + .size()); + + final List fourthLevelEntites = entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY) + .asInlineEntitySet() + .getEntitySet() + .getEntities(); + assertEquals(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue()); assertEquals("1", fourthLevelEntites.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue()); } - - private ODataRetrieveResponse buildRequest(final String entitySet, final String navigationProperty, + + private ODataRetrieveResponse buildRequest(final String entitySet, final String navigationProperty, final Map expandOptions) { return buildRequest(entitySet, navigationProperty, expandOptions, null); } - private ODataRetrieveResponse buildRequest(final String entitySet, final String navigationProperty, + private ODataRetrieveResponse buildRequest(final String entitySet, final String navigationProperty, final Map expandOptions, final String cookie) { final ODataClient client = getClient(); final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(entitySet) .expandWithOptions(navigationProperty, expandOptions) .build(); - final ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); + final ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); if (cookie != null) { request.addCustomHeader(HttpHeader.COOKIE, cookie); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java index 16529dd9d..383b709a6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java @@ -30,10 +30,10 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpHeader; @@ -53,100 +53,100 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @AfterClass public static void tearDownAfterClass() throws Exception { - //Nothing here. + // Nothing here. } @Test public void testTimeOfDayLiteral() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyTimeOfDay eq 03:26:05"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyTimeOfDay eq 03:26:05"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testBooleanLiteral() { - ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq false"); + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq false"); assertEquals(2, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq true"); assertEquals(1, response.getBody().getEntities().size()); - oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateLiteral() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyDate eq 2012-12-03"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyDate eq 2012-12-03"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateTimeOffsetLiteral() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyDateTimeOffset eq 2012-12-03T07:16:23Z"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testInt64Literal() { long value = Integer.MAX_VALUE + 1L; - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyInt64 gt " + value); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDoubleLiteral() { Double value = -17900000000000000000.0; - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyDouble le " + value.toString()); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testSimpleEq() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq 1"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq 1"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testBinaryIntegerOperations() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 add 1 eq (1 sub 3) div 2 mul 3 add 7"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test @@ -161,47 +161,47 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { .filter(filter) .build(); - final ODataRetrieveResponse response = client.getRetrieveRequestFactory() + final ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri).execute(); assertEquals(1, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); + ClientEntity clientEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testStringProperty() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2'"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2'"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testBooleanOperator() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' and PropertyInt16 eq 1"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' or PropertyInt16 eq 1"); assertEquals(2, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testBooleanOperatorWithNull() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq null"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq null"); assertEquals(0, result.getBody().getEntities().size()); result = sendRequest(ES_TWO_KEY_NAV, "null eq null"); @@ -213,7 +213,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @Test public void testUnaryWithNullLiterals() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyComp/PropertyComp/PropertyBoolean eq not null"); assertEquals(0, result.getBody().getEntities().size()); @@ -230,7 +230,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @Test public void testMethodCallsWithNull() { // One representative of "stringFuntion" "residue class" - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "endswith(PropertyString, null) eq null"); // null eq null => true assertEquals(3, result.getBody().getEntities().size()); @@ -251,13 +251,13 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { // See OASIS JIRA ODATA-781 // -1 should be treated as 0 - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "substring(PropertyString, -1, 1) eq 'F'"); assertEquals(1, response.getBody().getEntities().size()); assertEquals(32767, response.getBody().getEntities().get(0).getProperty("PropertyInt16").getPrimitiveValue() .toValue()); - + // -1 should be treated as 0, Same values substring(PropertyString, 0, 0) returns the empty String response = sendRequest(ES_ALL_PRIM, "substring(PropertyString, 0, -1) eq ''"); assertEquals(3, response.getBody().getEntities().size()); @@ -283,21 +283,21 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { final String filterString = "PropertyString eq null"; ODataClient client = getClient(); - ODataObjectFactory objectFactory = client.getObjectFactory(); + ClientObjectFactory objectFactory = client.getObjectFactory(); - ODataEntity entity = objectFactory.newEntity(new FullQualifiedName("olingo.odata.test1.ETAllPrim")); + ClientEntity entity = objectFactory.newEntity(new FullQualifiedName("olingo.odata.test1.ETAllPrim")); entity.getProperties().add( objectFactory.newPrimitiveProperty("PropertyInt16", objectFactory.newPrimitiveValueBuilder() .buildInt16((short) 1))); - entity.addLink(objectFactory.newEntityNavigationLink("NavPropertyETTwoPrimOne", + entity.addLink(objectFactory.newEntityNavigationLink("NavPropertyETTwoPrimOne", client.newURIBuilder(SERVICE_URI) - .appendEntitySetSegment("ESTwoPrim") - .appendKeySegment(32766) - .build())); - + .appendEntitySetSegment("ESTwoPrim") + .appendKeySegment(32766) + .build())); + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").build(); - ODataEntityCreateResponse createResponse = + ODataEntityCreateResponse createResponse = client.getCUDRequestFactory().getEntityCreateRequest(uri, entity).execute(); final URI receiveURI = @@ -306,17 +306,17 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { .filter(filterString) .build(); - ODataEntitySetRequest filterRequest = + ODataEntitySetRequest filterRequest = client.getRetrieveRequestFactory().getEntitySetRequest(receiveURI); filterRequest.addCustomHeader(HttpHeader.COOKIE, createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - ODataRetrieveResponse filterResponse = filterRequest.execute(); + ODataRetrieveResponse filterResponse = filterRequest.execute(); assertEquals(1, filterResponse.getBody().getEntities().size()); } @Test public void testNumericComparisionOperators() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 ge 1"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 ge 1"); assertEquals(4, result.getBody().getEntities().size()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 gt 1"); @@ -351,131 +351,131 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { + "PropertyComp/PropertyInt16 eq " // Complex Property + "5.5 mul 2"; // Single * Int16 => Single => Int16 eq Single => Single eq Single - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, filterString); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, filterString); assertEquals(3, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("11", ((ODataValuable) ((ODataValuable) oDataEntity.getProperty("PropertyComp")).getComplexValue() + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue() .get("PropertyInt16")).getValue() .toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("11", ((ODataValuable) ((ODataValuable) oDataEntity.getProperty("PropertyComp")).getComplexValue() + clientEntity = result.getBody().getEntities().get(1); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue() .get("PropertyInt16")).getValue() .toString()); - oDataEntity = result.getBody().getEntities().get(2); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); - assertEquals("11", ((ODataValuable) ((ODataValuable) oDataEntity.getProperty("PropertyComp")).getComplexValue() + clientEntity = result.getBody().getEntities().get(2); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); + assertEquals("11", ((ClientValuable) ((ClientValuable) clientEntity.getProperty("PropertyComp")).getComplexValue() .get("PropertyInt16")).getValue() .toString()); } @Test public void testNotOperator() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "not (PropertyInt16 eq 1)"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "not (PropertyInt16 eq 1)"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testUnaryMinusOperator() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 gt -2 add - -3"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 gt -2 add - -3"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testUnaryMinusOperatorDecimal() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 gt -2.0 add - -3.0"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 gt -2.0 add - -3.0"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testStringPropertyEqualsNull() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq null"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq null"); assertEquals(0, result.getBody().getEntities().size()); } @Test public void testAddNullLiteral() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 add null eq 1"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 add null eq 1"); assertEquals(0, result.getBody().getEntities().size()); } @Test public void testAddNullLiteralEqualsNull() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 add null eq null"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 add null eq null"); assertEquals(4, result.getBody().getEntities().size()); } @Test public void testSubstringStartAndEndGiven() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "substring(PropertyString, length('First') add 1, 8) eq ('Resource')"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testSubstringStartGiven() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "substring(PropertyComp/PropertyComp/PropertyString, 6) eq 'Value'"); assertEquals(4, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(2); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(2); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(3); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(3); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test @SuppressWarnings("unused") public void testSubstringDouble() { try { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "substring(PropertyString, length('First')" + "add 1, 2.0 * 4) eq ('Resource')"); } catch (ODataClientErrorException e) { @@ -485,150 +485,150 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @Test public void testYearFunctionDate() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "year(PropertyDate) eq 2015"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "year(PropertyDate) eq 2015"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testYearFunctionDateTimeOffset() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "year(PropertyDateTimeOffset) eq 2012"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "year(PropertyDateTimeOffset) eq 2012"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMonthFunctionDateTimeOffset() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "month(PropertyDateTimeOffset) eq 12"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "month(PropertyDateTimeOffset) eq 12"); assertEquals(3, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(2); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(2); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMonthFunctionDate() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "month(PropertyDate) eq 11"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "month(PropertyDate) eq 11"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDayFunctionDateTimeOffset() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "day(PropertyDateTimeOffset) eq 3"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "day(PropertyDateTimeOffset) eq 3"); assertEquals(3, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(2); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(2); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDayFunctionDate() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "day(PropertyDate) eq 5"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "day(PropertyDate) eq 5"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testHourFunctionDateTimeOffset() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "hour(PropertyDateTimeOffset) eq 7"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "hour(PropertyDateTimeOffset) eq 7"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testHourFuntionTimeOfDay() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "hour(PropertyTimeOfDay) eq 3"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "hour(PropertyTimeOfDay) eq 3"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMinuteFunctionDateTimeOffset() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "minute(PropertyDateTimeOffset) eq 17"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "minute(PropertyDateTimeOffset) eq 17"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMinuteFuntionTimeOfDay() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "minute(PropertyTimeOfDay) eq 49"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "minute(PropertyTimeOfDay) eq 49"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testSecondFunctionDateTimeOffset() { - ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "second(PropertyDateTimeOffset) eq 8"); + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "second(PropertyDateTimeOffset) eq 8"); assertEquals(1, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testSecondFuntionTimeOfDay() { - ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "second(PropertyTimeOfDay) eq 14"); + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "second(PropertyTimeOfDay) eq 14"); assertEquals(1, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testFractionalsecondsDateTimeOffset() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_COMP_ALL_PRIM, "fractionalseconds(PropertyComp/PropertyDateTimeOffset) eq 0.1234567"); assertEquals(2, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testFractionalsecondsDateOfTime() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "fractionalseconds(PropertyTimeOfDay) eq 0"); assertEquals(3, response.getBody().getEntities().size()); } @Test public void testDateTimeFunctionsNull() { - ODataRetrieveResponse response; + ODataRetrieveResponse response; response = sendRequest(ES_ALL_PRIM, "year(null) eq null"); assertEquals(3, response.getBody().getEntities().size()); @@ -651,243 +651,243 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { @Test public void testFloor() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.8)"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.8)"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.1)"); assertEquals(1, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testCeiling() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.1)"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.1)"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.6)"); assertEquals(1, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testRound() { - ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.5)"); + ODataRetrieveResponse result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.5)"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.4)"); assertEquals(1, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("2", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("2", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.6)"); assertEquals(1, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(3.1)"); assertEquals(1, result.getBody().getEntities().size()); - oDataEntity = result.getBody().getEntities().get(0); - assertEquals("3", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); - assertEquals("1", ((ODataValuable) oDataEntity.getProperty("PropertyString")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(0); + assertEquals("3", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); + assertEquals("1", ((ClientValuable) clientEntity.getProperty("PropertyString")).getValue().toString()); } @Test public void testEndsWith() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "endswith(PropertyString, 'values')"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "endswith(PropertyString, 'values')"); assertEquals(2, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = result.getBody().getEntities().get(1); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = result.getBody().getEntities().get(1); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testIndexOf() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "indexof(PropertyString, 'positive') eq 17"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testStartsWith() { - ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "startswith(PropertyString, 'First')"); + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "startswith(PropertyString, 'First')"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testToLower() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "contains(PropertyString, tolower('POSITIVE'))"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testToUpper() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "contains(PropertyString, concat(toupper('f'), 'irst'))"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testTrim() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "trim(substring(PropertyString, 0, 6)) eq 'First'"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDecimalDiv() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyDouble eq 0 sub (358000 div 2)"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testNumericPromotionToInt64() { - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyInt64 eq 0"); assertEquals(1, result.getBody().getEntities().size()); - ODataEntity oDataEntity = result.getBody().getEntities().get(0); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = result.getBody().getEntities().get(0); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void castEdm64ToDouble() { double value = Float.MAX_VALUE + 1; - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest(ES_ALL_PRIM, "PropertyInt64 lt " + value); assertEquals(3, result.getBody().getEntities().size()); } @Test public void testDateTimeOffsetAddDuraton() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDateTimeOffset eq 2012-12-03T07:16:19Z add duration'PT4S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDurrationAddDuration() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDuration eq duration'PT2S' add duration'PT4S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDurrationLiteral() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDuration eq duration'P1DT'"); assertEquals(0, response.getBody().getEntities().size()); } @Test public void testDateAddDuration() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDateTimeOffset eq 2012-12-02 add duration'P1DT7H16M23S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateTimeOffsetSubDuration() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDateTimeOffset eq 2012-12-03T07:16:27Z sub duration'PT4S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDurrationSubDuration() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDuration sub duration'PT2S' eq duration'PT4S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateSubDuration() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDateTimeOffset eq 2012-12-04 sub duration'P0DT16H43M37S'"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateSubDate() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDuration eq 2012-12-04 sub 2012-12-04"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testDateTimeOffsetSubDateTimeOffset() { - ODataRetrieveResponse response = + ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyDuration eq 2005-12-03T00:00:00Z sub 2005-12-03T00:00:00Z"); assertEquals(1, response.getBody().getEntities().size()); - final ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + final ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test @@ -896,7 +896,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { * The idea is use the largest possible number of a specific type and add a another number to force an * implicit conversion to an higher type */ - ODataRetrieveResponse response; + ODataRetrieveResponse response; // SByte => Int16 byte byteValue = Byte.MAX_VALUE; // 2 ^ 7 -1 = 127 @@ -931,8 +931,8 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { // We define a filter, which returns all entry where PropertyCompComp/PropertyComp/PropertyInt16 is equals to 1 final ODataClient client = getClient(); - final ODataObjectFactory factory = client.getObjectFactory(); - ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); + final ClientObjectFactory factory = client.getObjectFactory(); + ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETKeyNav")); newEntity.getProperties().add(factory.newComplexProperty("PropertyCompCompNav", null)); newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt16", factory.newPrimitiveValueBuilder().buildInt16((short) 4))); @@ -954,7 +954,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { .add(factory.newPrimitiveProperty( "PropertyString", factory.newPrimitiveValueBuilder().buildString("Test2"))))); - + newEntity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoKeyNavOne", client.newURIBuilder(SERVICE_URI) .appendEntitySetSegment(ES_TWO_KEY_NAV) @@ -967,17 +967,17 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { } }) .build())); - + final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESKeyNav").build(); - ODataEntityCreateRequest request = + ODataEntityCreateRequest request = client.getCUDRequestFactory().getEntityCreateRequest(uri, newEntity); - ODataEntityCreateResponse response = request.execute(); + ODataEntityCreateResponse response = request.execute(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next(); // Do the filter request - ODataRetrieveResponse result = + ODataRetrieveResponse result = sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq 1", cookie); assertEquals(3, result.getBody().getEntities().size()); @@ -991,11 +991,11 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { fail("ESServerSidePaging", "filter=contains(PropertyInt16, 3) eq 'hallo'", HttpStatusCode.BAD_REQUEST); } - private ODataRetrieveResponse sendRequest(String entitySet, String filterString) { + private ODataRetrieveResponse sendRequest(String entitySet, String filterString) { return sendRequest(entitySet, filterString, null); } - private ODataRetrieveResponse sendRequest(String entitySet, String filterString, String cookie) { + private ODataRetrieveResponse sendRequest(String entitySet, String filterString, String cookie) { final ODataClient client = getClient(); final URI uri = @@ -1004,7 +1004,7 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase { .filter(filterString) .build(); - ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); + ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); if (cookie != null) { request.addCustomHeader(HttpHeader.COOKIE, cookie); } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java index ec3331e68..9078d8f5f 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -34,11 +34,11 @@ import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.api.communication.response.ODataRawResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -49,41 +49,41 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { @Test public void entity() throws Exception { - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) - .appendOperationCallSegment("FICRTESTwoKeyNav").build(), ODataEntity.class); + .appendOperationCallSegment("FICRTESTwoKeyNav").build(), ClientEntity.class); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyInt16"); + final ClientProperty property = entity.getProperty("PropertyInt16"); assertNotNull(property); assertEquals(1, property.getPrimitiveValue().toValue()); } @Test public void entityCollection() { - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) - .appendOperationCallSegment("FICRTCollESTwoKeyNavParam").build(), ODataEntitySet.class, - Collections. singletonMap("ParameterInt16", + .appendOperationCallSegment("FICRTCollESTwoKeyNavParam").build(), ClientEntitySet.class, + Collections. singletonMap("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2))); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntitySet entitySet = response.getBody(); + final ClientEntitySet entitySet = response.getBody(); assertNotNull(entitySet); - final List entities = entitySet.getEntities(); + final List entities = entitySet.getEntities(); assertNotNull(entities); assertEquals(2, entities.size()); - final ODataEntity entity = entities.get(1); + final ClientEntity entity = entities.get(1); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("2", property.getPrimitiveValue().toValue()); @@ -92,19 +92,19 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { @Test public void entityCollectionWithAppendedKey() { // .../odata.svc/FICRTCollESMedia()(1) - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) .appendOperationCallSegment("FICRTCollESMedia") .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1)) - .build(), ODataEntity.class); + .build(), ClientEntity.class); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyInt16"); + final ClientProperty property = entity.getProperty("PropertyInt16"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(1, property.getPrimitiveValue().toValue()); @@ -113,18 +113,18 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { @Test public void entityCollectionWithAppendedKeyAndProperty() { // .../odata.svc/FICRTCollESMedia()(2)/PropertyInt16 - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) .appendOperationCallSegment("FICRTCollESMedia") .appendKeySegment(getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2)) .appendPropertySegment("PropertyInt16") - .build(), ODataProperty.class); + .build(), ClientProperty.class); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(2, property.getPrimitiveValue().toValue()); @@ -141,35 +141,35 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { @Test public void complexWithPath() throws Exception { - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) .appendOperationCallSegment("FICRTCTTwoPrim").appendPropertySegment("PropertyInt16").build(), - ODataProperty.class); + ClientProperty.class); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertEquals(16, property.getPrimitiveValue().toValue()); } @Test public void primitiveCollection() throws Exception { - final ODataInvokeRequest request = getClient().getInvokeRequestFactory() + final ODataInvokeRequest request = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) - .appendOperationCallSegment("FICRTCollString").build(), ODataProperty.class); + .appendOperationCallSegment("FICRTCollString").build(), ClientProperty.class); assertNotNull(request); - final ODataInvokeResponse response = request.execute(); + final ODataInvokeResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertNotNull(property.getCollectionValue()); assertEquals(3, property.getCollectionValue().size()); - Iterator iterator = property.getCollectionValue().iterator(); + Iterator iterator = property.getCollectionValue().iterator(); assertEquals("Employee1@company.example", iterator.next().asPrimitive().toValue()); assertEquals("Employee2@company.example", iterator.next().asPrimitive().toValue()); assertEquals("Employee3@company.example", iterator.next().asPrimitive().toValue()); @@ -180,7 +180,7 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { final ODataValueRequest request = getClient().getRetrieveRequestFactory() .getPropertyValueRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) .appendOperationCallSegment("FICRTString").appendValueSegment().build()); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals("UFCRTString string value", response.getBody().toValue()); } @@ -190,7 +190,7 @@ public class FunctionImportITCase extends AbstractBaseTestITCase { .getPropertyValueRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI) .appendOperationCallSegment("FICRTCTTwoPrim") .appendPropertySegment("PropertyString").appendValueSegment().build()); - final ODataRetrieveResponse response = request.execute(); + final ODataRetrieveResponse response = request.execute(); assertEquals("UFCRTCTTwoPrim string value", response.getBody().toValue()); } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java index 9d02810a2..5df211c5a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -39,8 +39,8 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreat import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpHeader; @@ -96,13 +96,13 @@ public final class MediaITCase extends AbstractBaseTestITCase { final ODataClient client = getClient(); final URI uri = client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESMedia").appendKeySegment(4).appendValueSegment().build(); - ODataMediaEntityUpdateRequest request = + ODataMediaEntityUpdateRequest request = client.getCUDRequestFactory().getMediaEntityUpdateRequest(uri, IOUtils.toInputStream("just a test")); request.setContentType(ContentType.TEXT_PLAIN.toContentTypeString()); assertNotNull(request); - final ODataMediaEntityUpdateResponse response = request.payloadManager().getResponse(); + final ODataMediaEntityUpdateResponse response = request.payloadManager().getResponse(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); // Check that the media stream has changed. @@ -118,19 +118,19 @@ public final class MediaITCase extends AbstractBaseTestITCase { @Test public void create() throws Exception { final ODataClient client = getClient(); - ODataMediaEntityCreateRequest request = + ODataMediaEntityCreateRequest request = client.getCUDRequestFactory().getMediaEntityCreateRequest( client.newURIBuilder(TecSvcConst.BASE_URI).appendEntitySetSegment("ESMedia").build(), IOUtils.toInputStream("just a test")); request.setContentType(ContentType.TEXT_PLAIN.toContentTypeString()); assertNotNull(request); - final ODataMediaEntityCreateResponse response = request.payloadManager().getResponse(); + final ODataMediaEntityCreateResponse response = request.payloadManager().getResponse(); assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode()); assertEquals(request.getURI() + "(5)", response.getHeader(HttpHeader.LOCATION).iterator().next()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyInt16"); + final ClientProperty property = entity.getProperty("PropertyInt16"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(5, property.getPrimitiveValue().toValue()); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java index fedf7d90e..46261b238 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -24,9 +24,9 @@ import static org.junit.Assert.assertNotNull; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -39,7 +39,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Test public void oneLevelToEntity() throws Exception { - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntityRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) @@ -47,9 +47,9 @@ public final class NavigationITCase extends AbstractBaseTestITCase { .execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String4", property.getPrimitiveValue().toValue()); @@ -57,7 +57,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Test public void oneLevelToEntityWithKey() throws Exception { - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntityRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESAllPrim").appendKeySegment(32767) @@ -65,9 +65,9 @@ public final class NavigationITCase extends AbstractBaseTestITCase { .execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String2", property.getPrimitiveValue().toValue()); @@ -75,7 +75,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Test public void twoLevelsToEntityWithKey() throws Exception { - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntityRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767) @@ -84,9 +84,9 @@ public final class NavigationITCase extends AbstractBaseTestITCase { .execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntity entity = response.getBody(); + final ClientEntity entity = response.getBody(); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String2", property.getPrimitiveValue().toValue()); @@ -94,7 +94,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Test public void twoLevelsToEntitySet() throws Exception { - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getEntitySetRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767) @@ -103,12 +103,12 @@ public final class NavigationITCase extends AbstractBaseTestITCase { .execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataEntitySet entitySet = response.getBody(); + final ClientEntitySet entitySet = response.getBody(); assertNotNull(entitySet); assertEquals(1, entitySet.getEntities().size()); - final ODataEntity entity = entitySet.getEntities().get(0); + final ClientEntity entity = entitySet.getEntities().get(0); assertNotNull(entity); - final ODataProperty property = entity.getProperty("PropertyString"); + final ClientProperty property = entity.getProperty("PropertyString"); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String2", property.getPrimitiveValue().toValue()); @@ -116,7 +116,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { @Test public void twoLevelsToProperty() throws Exception { - final ODataRetrieveResponse response = + final ODataRetrieveResponse response = client.getRetrieveRequestFactory().getPropertyRequest( client.newURIBuilder(TecSvcConst.BASE_URI) .appendEntitySetSegment("ESKeyNav").appendKeySegment(1) @@ -126,7 +126,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase { .execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals(1, property.getPrimitiveValue().toValue()); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java index e55a9f1bd..629f856d6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java @@ -27,9 +27,9 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -47,97 +47,98 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase { @AfterClass public static void tearDownAfterClass() throws Exception { - //no teardown needed + // no teardown needed } @Test public void testSimpleOrderBy() { - ODataRetrieveResponse response = null; + ODataRetrieveResponse response = null; response = sendRequest(ES_ALL_PRIM, "PropertyDate"); assertEquals(3, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(2); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(2); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testSimpleOrderByDecending() { - ODataRetrieveResponse response = null; + ODataRetrieveResponse response = null; response = sendRequest(ES_ALL_PRIM, "PropertyDate desc"); assertEquals(3, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(2); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(2); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMultipleOrderBy() { - final ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16"); + final ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16"); assertEquals(3, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(2); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(2); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testMultipleOrderByDecending() { - final ODataRetrieveResponse response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16 desc"); + final ODataRetrieveResponse response = + sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16 desc"); assertEquals(3, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(2); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(2); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testOrderByWithNull() { - final ODataRetrieveResponse response = sendRequest(ES_TWO_PRIM, "PropertyString"); + final ODataRetrieveResponse response = sendRequest(ES_TWO_PRIM, "PropertyString"); assertEquals(4, response.getBody().getEntities().size()); - ODataEntity oDataEntity = response.getBody().getEntities().get(0); - assertEquals("-32766", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + ClientEntity clientEntity = response.getBody().getEntities().get(0); + assertEquals("-32766", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(1); - assertEquals("32766", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(1); + assertEquals("32766", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(2); - assertEquals("-365", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(2); + assertEquals("-365", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); - oDataEntity = response.getBody().getEntities().get(3); - assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString()); + clientEntity = response.getBody().getEntities().get(3); + assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString()); } @Test public void testOrderByInvalidExpression() { - fail(ES_TWO_PRIM, "PropertyString add 10", HttpStatusCode.BAD_REQUEST); + fail(ES_TWO_PRIM, "PropertyString add 10", HttpStatusCode.BAD_REQUEST); } - private ODataRetrieveResponse sendRequest(String entitySet, String orderByString) { + private ODataRetrieveResponse sendRequest(String entitySet, String orderByString) { final ODataClient client = getClient(); final URI uri = @@ -146,7 +147,7 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase { .orderBy(orderByString) .build(); - ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); + ODataEntitySetRequest request = client.getRetrieveRequestFactory().getEntitySetRequest(uri); return request.execute(); } @@ -159,7 +160,7 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase { assertEquals(errorCode.getStatusCode(), e.getStatusLine().getStatusCode()); } } - + @Override protected ODataClient getClient() { ODataClient odata = ODataClientFactory.getClient(); diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java index 253b4821d..892cdd5b6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -36,8 +36,8 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataValueReq import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpHeader; @@ -52,20 +52,20 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Test public void readSimpleProperty() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoPrim") .appendKeySegment(32766) .appendPropertySegment("PropertyString") .build()); - + assertNotNull(request); - ODataRetrieveResponse response = request.execute(); + ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString())); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertNotNull(property.getPrimitiveValue()); assertEquals("Test String1", property.getPrimitiveValue().toValue()); @@ -73,18 +73,18 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Test public void readSimplePropertyContextURL() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoPrim") .appendKeySegment(32766) .appendPropertySegment("PropertyString") .build()); - ODataRetrieveResponse response = request.execute(); - String expectedResult = + ODataRetrieveResponse response = request.execute(); + String expectedResult = "{\"@odata.context\":\"$metadata#ESTwoPrim(32766)/PropertyString\"," + - "\"value\":\"Test String1\"}"; - assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8")); - } + "\"value\":\"Test String1\"}"; + assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8")); + } @Test public void deletePrimitive() throws Exception { @@ -97,7 +97,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { // Check that the property is really gone. // This check has to be in the same session in order to access the same data provider. - ODataPropertyRequest propertyRequest = getClient().getRetrieveRequestFactory() + ODataPropertyRequest propertyRequest = getClient().getRetrieveRequestFactory() .getPropertyRequest(uri); propertyRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), propertyRequest.execute().getStatusCode()); @@ -122,12 +122,12 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { // Check that the property is not gone but empty now. // This check has to be in the same session in order to access the same data provider. - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(uri); request.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); - final ODataRetrieveResponse propertyResponse = request.execute(); + final ODataRetrieveResponse propertyResponse = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), propertyResponse.getStatusCode()); - final ODataProperty property = propertyResponse.getBody(); + final ClientProperty property = propertyResponse.getBody(); assertNotNull(property); assertNotNull(property.getCollectionValue()); assertTrue(property.getCollectionValue().isEmpty()); @@ -135,36 +135,36 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Test public void readComplexProperty() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESMixPrimCollComp") .appendKeySegment(7) .appendPropertySegment("PropertyComp") - .build()); - ODataRetrieveResponse response = request.execute(); + .build()); + ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode()); assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString())); - final ODataProperty property = response.getBody(); + final ClientProperty property = response.getBody(); assertNotNull(property); assertNotNull(property.getComplexValue()); - assertEquals("TEST B", property.getComplexValue().get("PropertyString").getPrimitiveValue().toValue()); - } + assertEquals("TEST B", property.getComplexValue().get("PropertyString").getPrimitiveValue().toValue()); + } @Test public void readComplexPropertyContextURL() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESMixPrimCollComp") .appendKeySegment(7) .appendPropertySegment("PropertyComp") - .build()); - ODataRetrieveResponse response = request.execute(); - String expectedResult = + .build()); + ODataRetrieveResponse response = request.execute(); + String expectedResult = "{\"@odata.context\":\"$metadata#ESMixPrimCollComp(7)/PropertyComp\"," + - "\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}"; - assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8")); - } + "\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}"; + assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8")); + } @Test public void deleteComplex() throws Exception { @@ -177,7 +177,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { // Check that the property is really gone. // This check has to be in the same session in order to access the same data provider. - ODataPropertyRequest propertyRequest = getClient().getRetrieveRequestFactory() + ODataPropertyRequest propertyRequest = getClient().getRetrieveRequestFactory() .getPropertyRequest(uri); propertyRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next()); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), propertyRequest.execute().getStatusCode()); @@ -185,15 +185,15 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Test public void readUnknownProperty() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoPrim") .appendKeySegment(32766) .appendPropertySegment("Unknown") .build()); try { - request.execute(); - fail("Expected exception not thrown!"); + request.execute(); + fail("Expected exception not thrown!"); } catch (final ODataClientErrorException e) { assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode()); } @@ -201,15 +201,15 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { @Test public void readNoContentProperty() throws Exception { - ODataPropertyRequest request = getClient().getRetrieveRequestFactory() + ODataPropertyRequest request = getClient().getRetrieveRequestFactory() .getPropertyRequest(getClient().newURIBuilder(SERVICE_URI) .appendEntitySetSegment("ESTwoPrim") .appendKeySegment(-32766) .appendPropertySegment("PropertyString") - .build()); - ODataRetrieveResponse response = request.execute(); + .build()); + ODataRetrieveResponse response = request.execute(); assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode()); - } + } @Test public void readPropertyValue() throws Exception { @@ -220,9 +220,9 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase { .appendPropertySegment("PropertyString") .appendValueSegment() .build()); - ODataRetrieveResponse response = request.execute(); + ODataRetrieveResponse response = request.execute(); assertEquals("Test String1", response.getBody().toValue()); - } + } @Override protected ODataClient getClient() { diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java index d014086f9..995925bd0 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java @@ -28,8 +28,8 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -50,7 +50,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.COUNT, "true") .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -66,7 +66,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.COUNT, "true") .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -82,14 +82,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.TOP, new Integer(5).toString()) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); assertEquals(5, response.getBody().getEntities().size()); for (int i = 0; i < 5; i++) { - ODataEntity entity = response.getBody().getEntities().get(i); + ClientEntity entity = response.getBody().getEntities().get(i); assertEquals(new Integer(i + 1).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString()); } } @@ -102,14 +102,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.SKIP, new Integer(5).toString()) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); assertEquals(10, response.getBody().getEntities().size()); for (int i = 0; i < 10; i++) { - ODataEntity entity = response.getBody().getEntities().get(i); + ClientEntity entity = response.getBody().getEntities().get(i); assertEquals(new Integer(i + 6).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString()); } } @@ -123,7 +123,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.SKIP, new Integer(503).toString()) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -138,7 +138,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.SKIP, new Integer(10000).toString()) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -157,7 +157,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.TOP, new Integer(43).toString()) // 102, 101, ...., 59 .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -168,7 +168,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { // Check first 10 entities for (int i = 0; i < 10; i++) { - ODataEntity entity = response.getBody().getEntities().get(i); + ClientEntity entity = response.getBody().getEntities().get(i); assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString()); id--; } @@ -179,7 +179,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { assertEquals(Integer.valueOf(105), response.getBody().getCount()); assertEquals(10, response.getBody().getEntities().size()); for (int i = 0; i < 10; i++) { - ODataEntity entity = response.getBody().getEntities().get(i); + ClientEntity entity = response.getBody().getEntities().get(i); assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString()); id--; } @@ -190,7 +190,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { assertEquals(Integer.valueOf(105), response.getBody().getCount()); assertEquals(3, response.getBody().getEntities().size()); for (int i = 0; i < 3; i++) { - ODataEntity entity = response.getBody().getEntities().get(i); + ClientEntity entity = response.getBody().getEntities().get(i); assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString()); id--; } @@ -206,7 +206,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .appendEntitySetSegment(ES_SERVER_SIDE_PAGING) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -233,7 +233,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString()) .build(); - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); @@ -241,7 +241,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { URI nextLink = response.getBody().getNext(); assertEquals("http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken=1", nextLink.toASCIIString()); - + int token = 1; while (nextLink != null) { token++; @@ -252,13 +252,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .execute(); nextLink = response.getBody().getNext(); - if(nextLink != null) { - assertEquals( - "http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken=" + token, - nextLink.toASCIIString()); + if (nextLink != null) { + assertEquals( + "http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken=" + + token, + nextLink.toASCIIString()); } } - + assertEquals(50 + 1, token); } @@ -272,7 +273,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .build(); try { - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); fail(); @@ -290,7 +291,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase { .addQueryOption(QueryOption.TOP, new Integer(-5).toString()) .build(); try { - ODataRetrieveResponse response = client.getRetrieveRequestFactory() + ODataRetrieveResponse response = client.getRetrieveRequestFactory() .getEntitySetRequest(uri) .execute(); fail(); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java index 7b8381108..8a4bcdc08 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -26,15 +26,15 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.core.domain.ODataEntityImpl; +import org.apache.olingo.commons.core.domain.ClientEntityImpl; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.junit.BeforeClass; @@ -98,12 +98,12 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { return client; } - protected ODataEntity read(final ODataFormat format, final URI editLink) { - final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink); + protected ClientEntity read(final ODataFormat format, final URI editLink) { + final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); @@ -115,57 +115,57 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void createAndDeleteOrder(final String serviceRoot, final ODataFormat format, final int id) { - final ODataEntity order = new ODataEntityImpl( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); + final ClientEntity order = new ClientEntityImpl( + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); - final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)); + final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)); order.getProperties().add(orderId); Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.set(2011, 2, 4, 16, 3, 57); - final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate", - getClient().getObjectFactory().newPrimitiveValueBuilder() + final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate", + getClient().getObjectFactory().newPrimitiveValueBuilder() .setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()); order.getProperties().add(orderDate); - final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife", - getClient().getObjectFactory().newPrimitiveValueBuilder(). + final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife", + getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(BigDecimal.TEN.scaleByPowerOfTen(7)).build()); order.getProperties().add(shelfLife); - final ODataCollectionValue orderShelfLifesValue = getClient().getObjectFactory(). - newCollectionValue("Collection(Duration)"); + final ClientCollectionValue orderShelfLifesValue = getClient().getObjectFactory(). + newCollectionValue("Collection(Duration)"); orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder(). - setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build()); + setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build()); orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder(). - setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()); - final ODataProperty orderShelfLifes = getClient().getObjectFactory(). - newCollectionProperty("OrderShelfLifes", orderShelfLifesValue); + setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()); + final ClientProperty orderShelfLifes = getClient().getObjectFactory(). + newCollectionProperty("OrderShelfLifes", orderShelfLifesValue); order.getProperties().add(orderShelfLifes); - final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( - getClient().newURIBuilder(serviceRoot). + final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( + getClient().newURIBuilder(serviceRoot). appendEntitySetSegment("Orders").build(), order); req.setFormat(format); - final ODataEntity created = req.execute().getBody(); + final ClientEntity created = req.execute().getBody(); assertNotNull(created); assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size()); - if(format == ODataFormat.JSON_NO_METADATA) { + if (format == ODataFormat.JSON_NO_METADATA) { assertEquals(0, created.getNavigationLinks().size()); assertNull(created.getEditLink()); - } else if(format == ODataFormat.JSON_FULL_METADATA) { + } else if (format == ODataFormat.JSON_FULL_METADATA) { assertEquals(3, created.getNavigationLinks().size()); assertThat(created.getTypeName().getNamespace(), is("Microsoft.Test.OData.Services.ODataWCFService")); assertThat(created.getEditLink().toASCIIString(), startsWith("http://localhost:9080/stub/StaticService")); - } else if(format == ODataFormat.JSON || format == ODataFormat.APPLICATION_JSON) { + } else if (format == ODataFormat.JSON || format == ODataFormat.APPLICATION_JSON) { assertEquals(0, created.getNavigationLinks().size()); assertNull(created.getEditLink()); } final URI deleteURI = getClient().newURIBuilder(serviceRoot). - appendEntitySetSegment("Orders").appendKeySegment(id).build(); + appendEntitySetSegment("Orders").appendKeySegment(id).build(); final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI); final ODataDeleteResponse deleteRes = deleteReq.execute(); assertEquals(204, deleteRes.getStatusCode()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java index 1008de9f5..3e9a85ff5 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -24,11 +24,11 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientLink; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -48,7 +48,7 @@ public class AsyncTestITCase extends AbstractTestITCase { public void clientAsync() throws InterruptedException, ExecutionException { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers"); - final Future> futureRes = + final Future> futureRes = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute(); assertNotNull(futureRes); @@ -56,7 +56,7 @@ public class AsyncTestITCase extends AbstractTestITCase { Thread.sleep(1000L); } - final ODataRetrieveResponse res = futureRes.get(); + final ODataRetrieveResponse res = futureRes.get(); assertNotNull(res); assertEquals(200, res.getStatusCode()); assertFalse(res.getBody().getEntities().isEmpty()); @@ -66,18 +66,19 @@ public class AsyncTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final AsyncRequestWrapper> async = - client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); + final AsyncRequestWrapper> async = + client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); - final AsyncResponseWrapper> responseWrapper = async.execute(); + final AsyncResponseWrapper> responseWrapper = async.execute(); assertFalse(responseWrapper.isPreferenceApplied()); - final ODataRetrieveResponse res = responseWrapper.getODataResponse(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = responseWrapper.getODataResponse(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); @@ -92,12 +93,12 @@ public class AsyncTestITCase extends AbstractTestITCase { boolean found = false; - for (ODataLink link : entity.getNavigationLinks()) { - if (link instanceof ODataInlineEntity) { - final ODataEntity inline = ((ODataInlineEntity) link).getEntity(); + for (ClientLink link : entity.getNavigationLinks()) { + if (link instanceof ClientInlineEntity) { + final ClientEntity inline = ((ClientInlineEntity) link).getEntity(); assertNotNull(inline); - final List properties = inline.getProperties(); + final List properties = inline.getProperties(); assertEquals(5, properties.size()); assertTrue(properties.get(0).getName().equals("CompanyID") @@ -133,21 +134,21 @@ public class AsyncTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("async").appendEntitySetSegment("Orders"); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); req.setFormat(format); - final AsyncRequestWrapper> async = - client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); + final AsyncRequestWrapper> async = + client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); async.callback(URI.create("http://client.service.it/callback/endpoint")); - final AsyncResponseWrapper> responseWrapper = async.execute(); + final AsyncResponseWrapper> responseWrapper = async.execute(); assertTrue(responseWrapper.isPreferenceApplied()); assertTrue(responseWrapper.isDone()); - final ODataRetrieveResponse res = responseWrapper.getODataResponse(); - final ODataEntitySet entitySet = res.getBody(); + final ODataRetrieveResponse res = responseWrapper.getODataResponse(); + final ClientEntitySet entitySet = res.getBody(); assertFalse(entitySet.getEntities().isEmpty()); } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java index 53a4106b7..a76e97a2e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -31,7 +31,7 @@ import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.ODataClientFactory; import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ContentType; @@ -83,7 +83,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase { targetURI.appendEntitySetSegment("Customers").appendKeySegment(1); // create new request - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); queryReq.setFormat(ODataFormat.JSON); streamManager.addRequest(queryReq); @@ -98,7 +98,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase { targetURI = client.newURIBuilder(baseURL).appendEntitySetSegment("Customers").appendKeySegment(1); final URI editLink = targetURI.build(); - final ODataEntity patch = client.getObjectFactory().newEntity( + final ClientEntity patch = client.getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); patch.setEditLink(editLink); @@ -106,7 +106,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase { "LastName", client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name"))); - final ODataEntityUpdateRequest changeReq = + final ODataEntityUpdateRequest changeReq = client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch); changeReq.setFormat(ODataFormat.JSON_FULL_METADATA); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java index be268304b..880dd956a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -46,8 +46,8 @@ import org.apache.olingo.client.core.communication.request.batch.ODataSingleResp import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl; import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -122,7 +122,7 @@ public class BatchTestITCase extends AbstractTestITCase { final ODataChangeset changeset = payload.addChangeset(); URIBuilder targetURI; - ODataEntityCreateRequest createReq; + ODataEntityCreateRequest createReq; targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders"); for (int i = 1; i <= 2; i++) { @@ -158,7 +158,7 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals(404, res.getStatusCode()); assertEquals("Not Found", res.getStatusMessage()); assertEquals(Integer.valueOf(3), Integer.valueOf( - res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next())); + res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next())); assertFalse(retitem.hasNext()); assertFalse(iter.hasNext()); @@ -192,7 +192,7 @@ public class BatchTestITCase extends AbstractTestITCase { targetURI.appendEntitySetSegment("UnexistingEntitySet").appendKeySegment(1); // create new request - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); queryReq.setFormat(ODataFormat.JSON); streamManager.addRequest(queryReq); @@ -247,13 +247,13 @@ public class BatchTestITCase extends AbstractTestITCase { final BatchManager streamManager = request.payloadManager(); final ODataChangeset changeset = streamManager.addChangeset(); - ODataEntity order = newOrder(20); + ClientEntity order = newOrder(20); final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders"); // add create request - final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order); + final ODataEntityCreateRequest createReq = + client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order); changeset.addRequest(createReq); @@ -261,10 +261,10 @@ public class BatchTestITCase extends AbstractTestITCase { int createRequestRef = changeset.getLastContentId(); // add update request: link CustomerInfo(17) to the new customer - final ODataEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName()); + final ClientEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName()); customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink( - "OrderDetails", - client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails"). + "OrderDetails", + client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails"). appendKeySegment(new HashMap() { private static final long serialVersionUID = 3109256773218160485L; @@ -274,8 +274,8 @@ public class BatchTestITCase extends AbstractTestITCase { } }).build())); - final ODataEntityUpdateRequest updateReq = client.getCUDRequestFactory().getEntityUpdateRequest( - URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges); + final ODataEntityUpdateRequest updateReq = client.getCUDRequestFactory().getEntityUpdateRequest( + URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges); changeset.addRequest(updateReq); @@ -295,12 +295,12 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals(201, res.getStatusCode()); assertTrue(res instanceof ODataEntityCreateResponse); - order = ((ODataEntityCreateResponse) res).getBody(); - final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( - URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails")); + order = ((ODataEntityCreateResponse) res).getBody(); + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( + URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails")); assertEquals(Integer.valueOf(7), - req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue(). + req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue(). toCastValue(Integer.class)); res = chgitem.next(); @@ -309,13 +309,13 @@ public class BatchTestITCase extends AbstractTestITCase { // clean ... assertEquals(204, client.getCUDRequestFactory().getDeleteRequest( - URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute(). - getStatusCode()); + URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute(). + getStatusCode()); try { client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())). - execute().getBody(); + URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())). + execute().getBody(); fail(); } catch (Exception e) { // ignore @@ -336,10 +336,10 @@ public class BatchTestITCase extends AbstractTestITCase { // prepare URI URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL); targetURI.appendEntitySetSegment("Customers").appendKeySegment(1). - expand("Orders").select("PersonID,Orders/OrderID"); + expand("Orders").select("PersonID,Orders/OrderID"); // create new request - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); queryReq.setFormat(ODataFormat.JSON); streamManager.addRequest(queryReq); @@ -350,9 +350,9 @@ public class BatchTestITCase extends AbstractTestITCase { // ------------------------------------------- // prepare URI targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders"); - final ODataEntity original = newOrder(2000); - final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); + final ClientEntity original = newOrder(2000); + final ODataEntityCreateRequest createReq = + client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); createReq.setFormat(ODataFormat.JSON); streamManager.addRequest(createReq); // ------------------------------------------- @@ -382,15 +382,15 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals(201, res.getStatusCode()); assertEquals("Created", res.getStatusMessage()); - final ODataEntityCreateResponse entres = (ODataEntityCreateResponse) res; - final ODataEntity entity = entres.getBody(); + final ODataEntityCreateResponse entres = (ODataEntityCreateResponse) res; + final ClientEntity entity = entres.getBody(); assertEquals(2000, entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class).intValue()); assertFalse(iter.hasNext()); } @Test - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) public void batchRequest() throws EdmPrimitiveTypeException { // create your request final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL); @@ -406,7 +406,7 @@ public class BatchTestITCase extends AbstractTestITCase { targetURI.appendEntitySetSegment("Customers").appendKeySegment(1); // create new request - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); queryReq.setFormat(ODataFormat.JSON); streamManager.addRequest(queryReq); @@ -421,25 +421,25 @@ public class BatchTestITCase extends AbstractTestITCase { targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1); final URI editLink = targetURI.build(); - final ODataEntity patch = client.getObjectFactory().newEntity( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); + final ClientEntity patch = client.getObjectFactory().newEntity( + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); patch.setEditLink(editLink); patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty( - "LastName", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name"))); + "LastName", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name"))); - final ODataEntityUpdateRequest changeReq = - client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch); + final ODataEntityUpdateRequest changeReq = + client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch); changeReq.setFormat(ODataFormat.JSON_FULL_METADATA); changeset.addRequest(changeReq); // Create Order into the changeset targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders"); - final ODataEntity original = newOrder(1000); - final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); + final ClientEntity original = newOrder(1000); + final ODataEntityCreateRequest createReq = + client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); createReq.setFormat(ODataFormat.JSON); changeset.addRequest(createReq); // ------------------------------------------- @@ -471,10 +471,10 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals(200, res.getStatusCode()); assertEquals("OK", res.getStatusMessage()); - ODataEntityRequestImpl.ODataEntityResponseImpl entres = - (ODataEntityRequestImpl.ODataEntityResponseImpl) res; + ODataEntityRequestImpl.ODataEntityResponseImpl entres = + (ODataEntityRequestImpl.ODataEntityResponseImpl) res; - ODataEntity entity = entres.getBody(); + ClientEntity entity = entres.getBody(); assertEquals(1, entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // retrieve the second item (ODataChangeset) @@ -492,7 +492,7 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals(201, res.getStatusCode()); assertEquals("Created", res.getStatusMessage()); - final ODataEntityCreateResponse createres = (ODataEntityCreateResponse) res; + final ODataEntityCreateResponse createres = (ODataEntityCreateResponse) res; entity = createres.getBody(); assertEquals(new Integer(1000), entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class)); @@ -517,7 +517,7 @@ public class BatchTestITCase extends AbstractTestITCase { public void async() { // create your request final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest( - URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString()); + URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString()); request.setAccept(ACCEPT); final AsyncBatchRequestWrapper async = client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request); @@ -530,7 +530,7 @@ public class BatchTestITCase extends AbstractTestITCase { targetURI.appendEntitySetSegment("People").appendKeySegment(5); // create new request - ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); + ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); queryReq.setFormat(ODataFormat.JSON); async.addRetrieve(queryReq); @@ -636,22 +636,22 @@ public class BatchTestITCase extends AbstractTestITCase { } } - private ODataEntity newOrder(final int id) { - final ODataEntity order = getClient().getObjectFactory(). - newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); + private ClientEntity newOrder(final int id) { + final ClientEntity order = getClient().getObjectFactory(). + newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate", - getClient().getObjectFactory().newPrimitiveValueBuilder(). + getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build())); order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife", - getClient().getObjectFactory().newPrimitiveValueBuilder(). + getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build())); order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes", - getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add( - getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration). - setValue(new BigDecimal("0.0000002")).build()))); + getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add( + getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration). + setValue(new BigDecimal("0.0000002")).build()))); return order; } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java index 0e456bafd..b48902fcb 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -21,16 +21,16 @@ package org.apache.olingo.fit.v4; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -53,40 +53,40 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { private void functions(final ODataFormat format) throws EdmPrimitiveTypeException { // GetEmployeesCount URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company"); - final ODataEntityRequest singletonReq = + final ODataEntityRequest singletonReq = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singletonReq.setFormat(format); - final ODataSingleton company = singletonReq.execute().getBody(); + final ClientSingleton company = singletonReq.execute().getBody(); assertNotNull(company); - ODataOperation boundOp = company.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount"); + ClientOperation boundOp = company.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount"); assertNotNull(boundOp); - final ODataInvokeRequest getEmployeesCountReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataProperty.class); + final ODataInvokeRequest getEmployeesCountReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class); getEmployeesCountReq.setFormat(format); - final ODataProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody(); + final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody(); assertNotNull(getEmployeesCountRes); assertTrue(getEmployeesCountRes.hasPrimitiveValue()); // GetProductDetails builder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Products").appendKeySegment(5); - ODataEntityRequest entityReq = client.getRetrieveRequestFactory(). + ODataEntityRequest entityReq = client.getRetrieveRequestFactory(). getEntityRequest(builder.build()); entityReq.setFormat(format); - ODataEntity entity = entityReq.execute().getBody(); + ClientEntity entity = entityReq.execute().getBody(); assertNotNull(entity); boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"); assertNotNull(boundOp); - final ODataPrimitiveValue count = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1); - final ODataInvokeRequest getProductDetailsReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataEntitySet.class, - Collections. singletonMap("count", count)); + final ClientPrimitiveValue count = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1); + final ODataInvokeRequest getProductDetailsReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntitySet.class, + Collections. singletonMap("count", count)); getProductDetailsReq.setFormat(format); - final ODataEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody(); + final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody(); assertNotNull(getProductDetailsRes); assertEquals(1, getProductDetailsRes.getEntities().size()); @@ -104,10 +104,10 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct"); assertNotNull(boundOp); - final ODataInvokeRequest getRelatedProductReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataEntity.class); + final ODataInvokeRequest getRelatedProductReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class); getRelatedProductReq.setFormat(format); - final ODataEntity getRelatedProductRes = getRelatedProductReq.execute().getBody(); + final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody(); assertNotNull(getRelatedProductRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product", getRelatedProductRes.getTypeName().toString()); @@ -124,10 +124,10 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"); assertNotNull(boundOp); - final ODataInvokeRequest getDefaultPIReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataEntity.class); + final ODataInvokeRequest getDefaultPIReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class); getDefaultPIReq.setFormat(format); - final ODataEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); + final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); assertNotNull(getDefaultPIRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", getDefaultPIRes.getTypeName().toString()); @@ -138,10 +138,10 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"); assertNotNull(boundOp); - final ODataInvokeRequest getAccountInfoReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataProperty.class); + final ODataInvokeRequest getAccountInfoReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class); getAccountInfoReq.setFormat(format); - final ODataProperty getAccountInfoRes = getAccountInfoReq.execute().getBody(); + final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody(); assertNotNull(getAccountInfoRes); assertTrue(getAccountInfoRes.hasComplexValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo", @@ -158,12 +158,12 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"); assertNotNull(boundOp); - final ODataPrimitiveValue bonusRate = client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1); - final ODataInvokeRequest getActualAmountReq = - client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ODataProperty.class, - Collections. singletonMap("bonusRate", bonusRate)); + final ClientPrimitiveValue bonusRate = client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1); + final ODataInvokeRequest getActualAmountReq = + client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class, + Collections. singletonMap("bonusRate", bonusRate)); getActualAmountReq.setFormat(format); - final ODataProperty getActualAmountRes = getActualAmountReq.execute().getBody(); + final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody(); assertNotNull(getActualAmountRes); assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0); } @@ -181,26 +181,26 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledFunctions() throws EdmPrimitiveTypeException { // GetEmployeesCount - final ODataInvokeRequest getEmployeesCountReq = + final ODataInvokeRequest getEmployeesCountReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( edmClient.newURIBuilder().appendSingletonSegment("Company").build(), new FullQualifiedName(("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount")), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"), false); - final ODataProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody(); + final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody(); assertNotNull(getEmployeesCountRes); assertTrue(getEmployeesCountRes.hasPrimitiveValue()); // GetProductDetails - final ODataPrimitiveValue count = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1); - final ODataInvokeRequest getProductDetailsReq = + final ClientPrimitiveValue count = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1); + final ODataInvokeRequest getProductDetailsReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"), false, - Collections. singletonMap("count", count)); - final ODataEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody(); + Collections. singletonMap("count", count)); + final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody(); assertNotNull(getProductDetailsRes); assertEquals(1, getProductDetailsRes.getEntities().size()); @@ -210,26 +210,26 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { keyMap.put("ProductDetailID", 1); URIBuilder builder = edmClient.newURIBuilder().appendEntitySetSegment("ProductDetails").appendKeySegment(keyMap); - final ODataInvokeRequest getRelatedProductReq = + final ODataInvokeRequest getRelatedProductReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( builder.build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"), false); - final ODataEntity getRelatedProductRes = getRelatedProductReq.execute().getBody(); + final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody(); assertNotNull(getRelatedProductRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product", getRelatedProductRes.getTypeName().toString()); assertEquals(6, getRelatedProductRes.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetDefaultPI - final ODataInvokeRequest getDefaultPIReq = + final ODataInvokeRequest getDefaultPIReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"), false); - final ODataEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); + final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); assertNotNull(getDefaultPIRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", getDefaultPIRes.getTypeName().toString()); @@ -237,29 +237,29 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetAccountInfo - final ODataInvokeRequest getAccountInfoReq = + final ODataInvokeRequest getAccountInfoReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"), false); - final ODataProperty getAccountInfoRes = getAccountInfoReq.execute().getBody(); + final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody(); assertNotNull(getAccountInfoRes); assertTrue(getAccountInfoRes.hasComplexValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo", getAccountInfoRes.getComplexValue().getTypeName()); // GetActualAmount - final ODataPrimitiveValue bonusRate = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1); - final ODataInvokeRequest getActualAmountReq = + final ClientPrimitiveValue bonusRate = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1); + final ODataInvokeRequest getActualAmountReq = edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102). appendNavigationSegment("MyGiftCard").build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GiftCard"), false, - Collections. singletonMap("bonusRate", bonusRate)); - final ODataProperty getActualAmountRes = getActualAmountReq.execute().getBody(); + Collections. singletonMap("bonusRate", bonusRate)); + final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody(); assertNotNull(getActualAmountRes); assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0); } @@ -267,22 +267,22 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { private void actions(final ODataFormat format) throws EdmPrimitiveTypeException { // IncreaseRevenue URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company"); - ODataEntityRequest entityReq = + ODataEntityRequest entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build()); entityReq.setFormat(format); - ODataEntity entity = entityReq.execute().getBody(); + ClientEntity entity = entityReq.execute().getBody(); assertNotNull(entity); - ODataOperation boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"); + ClientOperation boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"); assertNotNull(boundOp); - final ODataPrimitiveValue increaseValue = + final ClientPrimitiveValue increaseValue = client.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L); - final ODataInvokeRequest increaseRevenueReq = - client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ODataProperty.class, - Collections. singletonMap("IncreaseValue", increaseValue)); + final ODataInvokeRequest increaseRevenueReq = + client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class, + Collections. singletonMap("IncreaseValue", increaseValue)); increaseRevenueReq.setFormat(format); - final ODataProperty increaseRevenueRes = increaseRevenueReq.execute().getBody(); + final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody(); assertNotNull(increaseRevenueRes); assertTrue(increaseRevenueRes.hasPrimitiveValue()); @@ -297,13 +297,13 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"); assertNotNull(boundOp); - final ODataEnumValue accessRight = client.getObjectFactory(). + final ClientEnumValue accessRight = client.getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute"); - final ODataInvokeRequest getProductDetailsReq = - client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ODataProperty.class, - Collections. singletonMap("accessRight", accessRight)); + final ODataInvokeRequest getProductDetailsReq = + client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class, + Collections. singletonMap("accessRight", accessRight)); getProductDetailsReq.setFormat(format); - final ODataProperty getProductDetailsRes = getProductDetailsReq.execute().getBody(); + final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody(); assertNotNull(getProductDetailsRes); assertTrue(getProductDetailsRes.hasEnumValue()); @@ -318,10 +318,10 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"); assertNotNull(boundOp); - final ODataCollectionValue addresses = + final ClientCollectionValue addresses = client.getObjectFactory(). newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)"); - final ODataComplexValue address = client.getObjectFactory(). + final ClientComplexValue address = client.getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa"))); @@ -330,14 +330,14 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); addresses.add(address); - final ODataPrimitiveValue index = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0); - final Map params = new LinkedHashMap(2); + final ClientPrimitiveValue index = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0); + final Map params = new LinkedHashMap(2); params.put("addresses", addresses); params.put("index", index); - final ODataInvokeRequest resetAddressReq = - client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ODataEntity.class, params); + final ODataInvokeRequest resetAddressReq = + client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class, params); resetAddressReq.setFormat(format); - final ODataEntity resetAddressRes = resetAddressReq.execute().getBody(); + final ClientEntity resetAddressRes = resetAddressReq.execute().getBody(); assertNotNull(resetAddressRes); assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -354,13 +354,13 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.set(2014, 3, 9, 0, 0, 0); - final ODataPrimitiveValue newDate = client.getObjectFactory().newPrimitiveValueBuilder(). + final ClientPrimitiveValue newDate = client.getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build(); - final ODataInvokeRequest getDefaultPIReq = - client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ODataEntity.class, - Collections. singletonMap("newDate", newDate)); + final ODataInvokeRequest getDefaultPIReq = + client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class, + Collections. singletonMap("newDate", newDate)); getDefaultPIReq.setFormat(format); - final ODataEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); + final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); assertNotNull(getDefaultPIRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", getDefaultPIRes.getTypeName().toString()); @@ -381,37 +381,37 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledActions() throws EdmPrimitiveTypeException { // IncreaseRevenue - final ODataPrimitiveValue increaseValue = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L); - final ODataInvokeRequest increaseRevenueReq = + final ClientPrimitiveValue increaseValue = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L); + final ODataInvokeRequest increaseRevenueReq = edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest( edmClient.newURIBuilder().appendSingletonSegment("Company").build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"), false, - Collections. singletonMap("IncreaseValue", increaseValue)); - final ODataProperty increaseRevenueRes = increaseRevenueReq.execute().getBody(); + Collections. singletonMap("IncreaseValue", increaseValue)); + final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody(); assertNotNull(increaseRevenueRes); assertTrue(increaseRevenueRes.hasPrimitiveValue()); // AddAccessRight - final ODataEnumValue accessRight = edmClient.getObjectFactory(). + final ClientEnumValue accessRight = edmClient.getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute"); - final ODataInvokeRequest getProductDetailsReq = + final ODataInvokeRequest getProductDetailsReq = edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"), false, - Collections. singletonMap("accessRight", accessRight)); - final ODataProperty getProductDetailsRes = getProductDetailsReq.execute().getBody(); + Collections. singletonMap("accessRight", accessRight)); + final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody(); assertNotNull(getProductDetailsRes); assertTrue(getProductDetailsRes.hasEnumValue()); // ResetAddress - final ODataCollectionValue addresses = + final ClientCollectionValue addresses = edmClient.getObjectFactory(). newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)"); - final ODataComplexValue address = edmClient.getObjectFactory(). + final ClientComplexValue address = edmClient.getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(edmClient.getObjectFactory().newPrimitiveProperty("Street", edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa"))); @@ -420,36 +420,36 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { address.add(edmClient.getObjectFactory().newPrimitiveProperty("PostalCode", edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); addresses.add(address); - final ODataPrimitiveValue index = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0); - final Map params = new LinkedHashMap(2); + final ClientPrimitiveValue index = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0); + final Map params = new LinkedHashMap(2); params.put("addresses", addresses); params.put("index", index); final Map keys = new HashMap(); keys.put("PersonID", 2); - final ODataInvokeRequest resetAddressReq = + final ODataInvokeRequest resetAddressReq = edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Customers").appendKeySegment(keys).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Person"), false, params); - final ODataEntity resetAddressRes = resetAddressReq.execute().getBody(); + final ClientEntity resetAddressRes = resetAddressReq.execute().getBody(); assertNotNull(resetAddressRes); assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // RefreshDefaultPI Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.set(2014, 3, 9, 0, 0, 0); - final ODataPrimitiveValue newDate = edmClient.getObjectFactory().newPrimitiveValueBuilder(). + final ClientPrimitiveValue newDate = edmClient.getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build(); - final ODataInvokeRequest getDefaultPIReq = + final ODataInvokeRequest getDefaultPIReq = edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest( edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"), new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"), false, - Collections. singletonMap("newDate", newDate)); - final ODataEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); + Collections. singletonMap("newDate", newDate)); + final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody(); assertNotNull(getDefaultPIRes); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", getDefaultPIRes.getTypeName().toString()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java index 93b52ca65..06e3552cd 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -46,16 +46,16 @@ import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory; import org.apache.olingo.client.core.http.DefaultHttpClientFactory; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; -import org.apache.olingo.commons.core.domain.ODataEntityImpl; +import org.apache.olingo.commons.core.domain.ClientEntityImpl; import org.junit.Test; /** @@ -73,7 +73,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = + final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); assertEquals("4.0", req.getHeader("OData-MaxVersion")); @@ -87,36 +87,36 @@ public class ConformanceTestITCase extends AbstractTestITCase { */ @Test public void item2() { - final ODataEntity order = - new ODataEntityImpl(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); + final ClientEntity order = + new ClientEntityImpl(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); - final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID", + final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2000)); order.getProperties().add(orderId); Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.set(2011, 2, 4, 16, 3, 57); - final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate", + final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate", getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()); order.getProperties().add(orderDate); - final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife", + final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife", getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build()); order.getProperties().add(shelfLife); - final ODataCollectionValue orderShelfLifesValue = getClient().getObjectFactory(). + final ClientCollectionValue orderShelfLifesValue = getClient().getObjectFactory(). newCollectionValue("Collection(Duration)"); orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build()); orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()); - final ODataProperty orderShelfLifes = getClient().getObjectFactory(). + final ClientProperty orderShelfLifes = getClient().getObjectFactory(). newCollectionProperty("OrderShelfLifes", orderShelfLifesValue); order.getProperties().add(orderShelfLifes); - final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( + final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Orders").build(), order); req.setFormat(ODataFormat.JSON_FULL_METADATA); @@ -136,7 +136,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { ODataFormat.JSON_FULL_METADATA.getContentType().toContentTypeString(), req.getContentType()); - final ODataEntity created = req.execute().getBody(); + final ClientEntity created = req.execute().getBody(); assertNotNull(created); final URI deleteURI = created.getEditLink() == null @@ -156,14 +156,14 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("redirect"). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = + final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); assertEquals("4.0", req.getHeader("OData-MaxVersion")); assertEquals("4.0", req.getHeader(HeaderName.odataMaxVersion.toString())); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); @@ -178,13 +178,13 @@ public class ConformanceTestITCase extends AbstractTestITCase { public void item5() { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People"); - ODataEntitySetRequest req = client.getRetrieveRequestFactory(). + ODataEntitySetRequest req = client.getRetrieveRequestFactory(). getEntitySetRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); req.setPrefer(client.newPreferences().maxPageSize(5)); - ODataRetrieveResponse res = req.execute(); - ODataEntitySet feed = res.getBody(); + ODataRetrieveResponse res = req.execute(); + ClientEntitySet feed = res.getBody(); assertNotNull(feed); @@ -212,7 +212,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { public void item6() { final Integer id = 2000; - ODataEntity rowIndex = getClient().getObjectFactory().newEntity( + ClientEntity rowIndex = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex")); getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newPrimitiveProperty("Id", @@ -227,11 +227,11 @@ public class ConformanceTestITCase extends AbstractTestITCase { rowIndex.addLink(client.getObjectFactory().newEntityNavigationLink( "Row", URI.create(testOpenTypeServiceRootURL + "/Row(71f7d0dc-ede4-45eb-b421-555a2aa1e58f)"))); - final ODataEntityCreateRequest createReq = getClient().getCUDRequestFactory(). + final ODataEntityCreateRequest createReq = getClient().getCUDRequestFactory(). getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("RowIndex").build(), rowIndex); - final ODataEntityCreateResponse createRes = createReq.execute(); + final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(201, createRes.getStatusCode()); final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). @@ -256,7 +256,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URI uri = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).build(); - final ODataEntity patch = client.getObjectFactory().newEntity( + final ClientEntity patch = client.getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); patch.setEditLink(uri); @@ -264,13 +264,13 @@ public class ConformanceTestITCase extends AbstractTestITCase { patch.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FirstName", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newname))); - final ODataEntityUpdateRequest req = + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity actual = read(ODataFormat.JSON, uri); + final ClientEntity actual = read(ODataFormat.JSON, uri); assertEquals(newname, actual.getProperty("FirstName").getPrimitiveValue().toString()); } @@ -287,7 +287,8 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testAuthServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); assertNotNull(req.execute().getBody()); @@ -304,13 +305,13 @@ public class ConformanceTestITCase extends AbstractTestITCase { appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder"). appendRefSegment(); - ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); - ODataRetrieveResponse res = req.execute(); + ODataRetrieveResponse res = req.execute(); assertNotNull(res); - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); @@ -330,18 +331,18 @@ public class ConformanceTestITCase extends AbstractTestITCase { */ @Test public void item10() { - final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build()); req.setPrefer(client.newPreferences().trackChanges()); - final ODataEntitySet customers = req.execute().getBody(); + final ClientEntitySet customers = req.execute().getBody(); assertNotNull(customers); assertNotNull(customers.getDeltaLink()); final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink()); deltaReq.setFormat(ODataFormat.JSON_FULL_METADATA); - final ODataDelta delta = deltaReq.execute().getBody(); + final ClientDelta delta = deltaReq.execute().getBody(); assertNotNull(delta); assertNotNull(delta.getDeltaLink()); @@ -363,7 +364,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship()); assertEquals(2, delta.getEntities().size()); - ODataProperty property = delta.getEntities().get(0).getProperty("ContactName"); + ClientProperty property = delta.getEntities().get(0).getProperty("ContactName"); assertNotNull(property); assertTrue(property.hasPrimitiveValue()); property = delta.getEntities().get(1).getProperty("ShippingAddress"); @@ -379,21 +380,21 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("async").appendEntitySetSegment("Orders"); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); - final AsyncRequestWrapper> async = - client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); + final AsyncRequestWrapper> async = + client.getAsyncRequestFactory().> getAsyncRequestWrapper(req); async.callback(URI.create("http://client.service.it/callback/endpoint")); - final AsyncResponseWrapper> responseWrapper = async.execute(); + final AsyncResponseWrapper> responseWrapper = async.execute(); assertTrue(responseWrapper.isPreferenceApplied()); assertTrue(responseWrapper.isDone()); - final ODataRetrieveResponse res = responseWrapper.getODataResponse(); - final ODataEntitySet entitySet = res.getBody(); + final ODataRetrieveResponse res = responseWrapper.getODataResponse(); + final ClientEntitySet entitySet = res.getBody(); assertFalse(entitySet.getEntities().isEmpty()); } @@ -406,7 +407,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = + final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON); @@ -414,7 +415,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { assertEquals("application/json;odata.metadata=minimal", req.getHeader(HeaderName.accept.toString())); assertEquals("application/json;odata.metadata=minimal", req.getAccept()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertTrue(res.getContentType().startsWith("application/json; odata.metadata=minimal")); assertNotNull(res.getBody()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java index fa3b533cb..1a7bfe053 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -20,9 +20,9 @@ package org.apache.olingo.fit.v4; import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -33,18 +33,18 @@ import static org.junit.Assert.assertTrue; public class DeltaTestITCase extends AbstractTestITCase { private void parse(final ODataFormat format) { - final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest( client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build()); req.setPrefer(client.newPreferences().trackChanges()); - final ODataEntitySet customers = req.execute().getBody(); + final ClientEntitySet customers = req.execute().getBody(); assertNotNull(customers); assertNotNull(customers.getDeltaLink()); final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink()); deltaReq.setFormat(format); - final ODataDelta delta = deltaReq.execute().getBody(); + final ClientDelta delta = deltaReq.execute().getBody(); assertNotNull(delta); assertNotNull(delta.getDeltaLink()); @@ -66,7 +66,7 @@ public class DeltaTestITCase extends AbstractTestITCase { assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship()); assertEquals(2, delta.getEntities().size()); - ODataProperty property = delta.getEntities().get(0).getProperty("ContactName"); + ClientProperty property = delta.getEntities().get(0).getProperty("ContactName"); assertNotNull(property); assertTrue(property.hasPrimitiveValue()); property = delta.getEntities().get(1).getProperty("ShippingAddress"); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java index fcc1f616c..087ef8ef8 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -30,10 +30,10 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; @@ -46,11 +46,11 @@ public class DerivedTypeTestITCase extends AbstractTestITCase { URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People"). appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.ODataWCFService.Customer"); - ODataEntitySetRequest req = client.getRetrieveRequestFactory(). + ODataEntitySetRequest req = client.getRetrieveRequestFactory(). getEntitySetRequest(uriBuilder.build()); req.setFormat(format); - for (ODataEntity customer : req.execute().getBody().getEntities()) { + for (ClientEntity customer : req.execute().getBody().getEntities()) { assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", customer.getTypeName().toString()); } @@ -62,7 +62,7 @@ public class DerivedTypeTestITCase extends AbstractTestITCase { req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); req.setFormat(format); - for (ODataEntity customer : req.execute().getBody().getEntities()) { + for (ClientEntity customer : req.execute().getBody().getEntities()) { assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI", customer.getTypeName().toString()); } } @@ -78,7 +78,7 @@ public class DerivedTypeTestITCase extends AbstractTestITCase { } private void createDelete(final ODataFormat format) { - final ODataEntity customer = client.getObjectFactory(). + final ClientEntity customer = client.getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("PersonID", @@ -88,7 +88,7 @@ public class DerivedTypeTestITCase extends AbstractTestITCase { customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("LastName", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test"))); - final ODataComplexValue homeAddress = + final ClientComplexValue homeAddress = client.getObjectFactory().newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress"); homeAddress.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("V.le Gabriele D'Annunzio"))); @@ -115,24 +115,24 @@ public class DerivedTypeTestITCase extends AbstractTestITCase { client.getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build())); - final ODataEntityCreateRequest createReq = client.getCUDRequestFactory(). + final ODataEntityCreateRequest createReq = client.getCUDRequestFactory(). getEntityCreateRequest( client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People").build(), customer); createReq.setFormat(format); - final ODataEntityCreateResponse createRes = createReq.execute(); + final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(201, createRes.getStatusCode()); - final ODataEntityRequest fetchReq = client.getRetrieveRequestFactory(). + final ODataEntityRequest fetchReq = client.getRetrieveRequestFactory(). getEntityRequest(client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(976).build()); fetchReq.setFormat(format); - final ODataEntity actual = fetchReq.execute().getBody(); + final ClientEntity actual = fetchReq.execute().getBody(); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", actual.getTypeName().toString()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress", - ((ODataValuable) actual.getProperty("HomeAddress")).getValue().getTypeName()); + ((ClientValuable) actual.getProperty("HomeAddress")).getValue().getTypeName()); final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(actual.getEditLink()); assertEquals(204, deleteReq.execute().getStatusCode()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java index a92db26bf..5ad440729 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -22,10 +22,10 @@ import org.apache.commons.lang3.RandomUtils; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -52,18 +52,17 @@ public class EntityCreateTestITCase extends AbstractTestITCase { createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.JSON_FULL_METADATA, 1001); } - private void onContained(final ODataFormat format) { final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Accounts"). appendKeySegment(101).appendNavigationSegment("MyPaymentInstruments").build(); // 1. read contained collection before any operation - ODataEntitySet instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody(); + ClientEntitySet instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody(); assertNotNull(instruments); final int sizeBefore = instruments.getCount(); // 2. instantiate an ODataEntity of the same type as the collection above - final ODataEntity instrument = getClient().getObjectFactory(). + final ClientEntity instrument = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")); int id = RandomUtils.nextInt(101999, 105000); @@ -76,11 +75,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase { setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build())); // 3. create it as contained entity - final ODataEntityCreateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityCreateRequest req = getClient().getCUDRequestFactory(). getEntityCreateRequest(uri, instrument); req.setFormat(format); - final ODataEntityCreateResponse res = req.execute(); + final ODataEntityCreateResponse res = req.execute(); assertEquals(201, res.getStatusCode()); // 4. verify that the contained collection effectively grew @@ -114,7 +113,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { private void deepInsert(final ODataFormat format, final int productId, final int productDetailId) throws EdmPrimitiveTypeException { - final ODataEntity product = getClient().getObjectFactory(). + final ClientEntity product = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product")); product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId))); @@ -142,7 +141,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Red")); - final ODataEntity detail = getClient().getObjectFactory(). + final ClientEntity detail = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail")); detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId))); @@ -153,27 +152,27 @@ public class EntityCreateTestITCase extends AbstractTestITCase { detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Description", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("High-Quality Milk"))); - final ODataEntitySet details = getClient().getObjectFactory().newEntitySet(); + final ClientEntitySet details = getClient().getObjectFactory().newEntitySet(); details.getEntities().add(detail); - final ODataInlineEntitySet inlineDetails = getClient().getObjectFactory(). + final ClientInlineEntitySet inlineDetails = getClient().getObjectFactory(). newDeepInsertEntitySet("Details", details); product.addLink(inlineDetails); - final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( + final ODataEntityCreateRequest req = getClient().getCUDRequestFactory().getEntityCreateRequest( getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Products").build(), product); req.setFormat(format); - final ODataEntityCreateResponse res = req.execute(); + final ODataEntityCreateResponse res = req.execute(); assertEquals(201, res.getStatusCode()); - final ODataEntity createdProduct = res.getBody(); + final ClientEntity createdProduct = res.getBody(); assertEquals(productId, createdProduct.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataLink createdLink = createdProduct.getNavigationLink("Details"); + final ClientLink createdLink = createdProduct.getNavigationLink("Details"); assertNotNull(createdLink); - final ODataEntitySet createdProductDetails = + final ClientEntitySet createdProductDetails = getClient().getRetrieveRequestFactory().getEntitySetRequest(createdLink.getLink()).execute().getBody(); assertNotNull(createdProductDetails); assertEquals(productDetailId, createdProductDetails.getEntities().iterator().next(). diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java index 35c638af6..8b47d3868 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -32,13 +32,13 @@ import org.apache.olingo.client.api.communication.response.ODataRawResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -55,14 +55,14 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void withInlineEntity(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); + appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company"); - final ODataEntityRequest req = client.getRetrieveRequestFactory(). - getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = client.getRetrieveRequestFactory(). + getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); @@ -81,24 +81,24 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { boolean found = false; - for (ODataLink link : entity.getNavigationLinks()) { - if (link instanceof ODataInlineEntity) { - final ODataEntity inline = ((ODataInlineEntity) link).getEntity(); + for (ClientLink link : entity.getNavigationLinks()) { + if (link instanceof ClientInlineEntity) { + final ClientEntity inline = ((ClientInlineEntity) link).getEntity(); assertNotNull(inline); - final List properties = inline.getProperties(); + final List properties = inline.getProperties(); assertEquals(5, properties.size()); assertTrue(properties.get(0).getName().equals("CompanyID") - || properties.get(1).getName().equals("CompanyID") - || properties.get(2).getName().equals("CompanyID") - || properties.get(3).getName().equals("CompanyID") - || properties.get(4).getName().equals("CompanyID")); + || properties.get(1).getName().equals("CompanyID") + || properties.get(2).getName().equals("CompanyID") + || properties.get(3).getName().equals("CompanyID") + || properties.get(4).getName().equals("CompanyID")); assertTrue(properties.get(0).getValue().toString().equals("0") - || properties.get(1).getValue().toString().equals("0") - || properties.get(2).getValue().toString().equals("0") - || properties.get(3).getValue().toString().equals("0") - || properties.get(4).getValue().toString().equals("0")); + || properties.get(1).getValue().toString().equals("0") + || properties.get(2).getValue().toString().equals("0") + || properties.get(3).getValue().toString().equals("0") + || properties.get(4).getValue().toString().equals("0")); found = true; } @@ -125,23 +125,23 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void withInlineEntitySet(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders"); + appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders"); - final ODataEntityRequest req = client.getRetrieveRequestFactory(). - getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = client.getRetrieveRequestFactory(). + getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); // In JSON with minimal metadata, links are not provided if (format == ODataFormat.ATOM || format == ODataFormat.JSON_FULL_METADATA) { boolean found = false; - for (ODataLink link : entity.getNavigationLinks()) { - if (link instanceof ODataInlineEntitySet) { - final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet(); + for (ClientLink link : entity.getNavigationLinks()) { + if (link instanceof ClientInlineEntitySet) { + final ClientEntitySet inline = ((ClientInlineEntitySet) link).getEntitySet(); assertNotNull(inline); found = true; @@ -168,7 +168,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void rawRequest(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("People").appendKeySegment(5); + appendEntitySetSegment("People").appendKeySegment(5); final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build()); req.setFormat(format.getContentType().toContentTypeString()); @@ -176,10 +176,10 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { final ODataRawResponse res = req.execute(); assertNotNull(res); - final ResWrap entitySet = res.getBodyAs(ODataEntitySet.class); + final ResWrap entitySet = res.getBodyAs(ClientEntitySet.class); assertNull(entitySet); - final ResWrap entity = res.getBodyAs(ODataEntity.class); + final ResWrap entity = res.getBodyAs(ClientEntity.class); assertTrue(entity.getPayload().getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/People(5)")); } @@ -200,16 +200,17 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { multiKey.put("ProductDetailID", 1); final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey); + appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals(Integer.valueOf(1), - entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class)); + entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class)); } @Test @@ -224,18 +225,19 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void checkForETag(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = - client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); + client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertEquals(200, res.getStatusCode()); final String etag = res.getETag(); assertTrue(StringUtils.isNotBlank(etag)); - final ODataEntity order = res.getBody(); + final ClientEntity order = res.getBody(); assertEquals(etag, order.getETag()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString()); assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName()); @@ -263,7 +265,8 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { public void issue99() { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON); // this statement should cause an IllegalArgumentException bearing JsonParseException @@ -273,21 +276,21 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void reference(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder"). - appendRefSegment(); + appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder"). + appendRefSegment(); - ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - ODataRetrieveResponse res = req.execute(); + ODataRetrieveResponse res = req.execute(); assertNotNull(res); - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL). - appendEntityIdSegment(entity.getId().toASCIIString()).build(); + appendEntityIdSegment(entity.getId().toASCIIString()).build(); req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI); req.setFormat(format); @@ -309,16 +312,16 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void contained(final ODataClient client, final ODataFormat format) throws EdmPrimitiveTypeException { final URI uri = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(101). - appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101902).build(); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(101). + appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101902).build(); + final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uri); req.setFormat(format); - final ODataEntity contained = req.execute().getBody(); + final ClientEntity contained = req.execute().getBody(); assertNotNull(contained); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", contained.getTypeName().toString()); assertEquals(101902, - contained.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); + contained.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); assertEquals("Edm.DateTimeOffset", contained.getProperty("CreatedDate").getPrimitiveValue().getTypeName()); assertNotNull(contained.getProperty("CreatedDate").getPrimitiveValue().toCastValue(Timestamp.class)); } @@ -340,17 +343,17 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void entitySetNavigationLink(final ODataClient client, final ODataFormat format) { final URI uri = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(101).build(); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(101).build(); + final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uri); req.setFormat(format); - final ODataEntity entity = req.execute().getBody(); + final ClientEntity entity = req.execute().getBody(); assertNotNull(entity); // With JSON, entity set navigation links are only recognizable via Edm if (format == ODataFormat.ATOM || client instanceof EdmEnabledODataClient) { - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java index 821d7b732..65f54e547 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,8 +28,8 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -54,7 +54,7 @@ public class EntitySetTestITCase extends AbstractTestITCase { final ODataRawResponse res = req.execute(); assertNotNull(res); - final ResWrap entitySet = res.getBodyAs(ODataEntitySet.class); + final ResWrap entitySet = res.getBodyAs(ClientEntitySet.class); assertNotNull(entitySet.getPayload()); assertTrue(entitySet.getContextURL().toASCIIString().endsWith("$metadata#People")); } @@ -79,7 +79,7 @@ public class EntitySetTestITCase extends AbstractTestITCase { final ODataRawResponse res = req.execute(); assertNotNull(res); - final ResWrap entitySet = res.getBodyAs(ODataEntitySet.class); + final ResWrap entitySet = res.getBodyAs(ClientEntitySet.class); assertEquals(5, entitySet.getPayload().getEntities().size()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address", @@ -104,12 +104,12 @@ public class EntitySetTestITCase extends AbstractTestITCase { private void readODataEntitySetIterator(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People"); - final ODataEntitySetIteratorRequest req = + final ODataEntitySetIteratorRequest req = client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse> res = req.execute(); - final ODataEntitySetIterator feedIterator = res.getBody(); + final ODataRetrieveResponse> res = req.execute(); + final ODataEntitySetIterator feedIterator = res.getBody(); assertNotNull(feedIterator); @@ -146,13 +146,13 @@ public class EntitySetTestITCase extends AbstractTestITCase { private void readWithNext(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People"); - final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). + final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). getEntitySetRequest(uriBuilder.build()); req.setFormat(format); req.setPrefer(client.newPreferences().maxPageSize(5)); - final ODataRetrieveResponse res = req.execute(); - final ODataEntitySet feed = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntitySet feed = res.getBody(); assertNotNull(feed); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java index 913d5dbbb..2b472678e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -32,8 +32,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddi import org.apache.olingo.client.api.communication.request.cud.UpdateType; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientLink; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -44,7 +44,7 @@ import org.junit.Test; public class EntityUpdateTestITCase extends AbstractTestITCase { private void upsert(final UpdateType updateType, final ODataFormat format) { - final ODataEntity order = getClient().getObjectFactory(). + final ClientEntity order = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID", @@ -59,13 +59,13 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { final URI upsertURI = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Orders").appendKeySegment(9).build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(upsertURI, updateType, order); req.setFormat(format); req.execute(); try { - final ODataEntity read = read(format, upsertURI); + final ClientEntity read = read(format, upsertURI); assertNotNull(read); assertEquals(order.getProperty("OrderID"), read.getProperty("OrderID")); assertEquals(order.getProperty("OrderDate").getPrimitiveValue().toString(), @@ -115,7 +115,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { private void onContained(final ODataFormat format) { final String newName = UUID.randomUUID().toString(); - final ODataEntity changes = getClient().getObjectFactory().newEntity( + final ClientEntity changes = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")); changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newName))); @@ -123,14 +123,14 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { final URI uri = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Accounts").appendKeySegment(101). appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101901).build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(actual); assertEquals(newName, actual.getProperty("FriendlyName").getPrimitiveValue().toString()); } @@ -146,28 +146,28 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { } private void bindOperation(final ODataFormat format) throws EdmPrimitiveTypeException { - final ODataEntity changes = getClient().getObjectFactory().newEntity( + final ClientEntity changes = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); - final ODataLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent", + final ClientLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent", getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(1).build()); changes.getNavigationLinks().add(parent); final URI uri = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(5).build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(updated); - final ODataLink updatedLink = updated.getNavigationLink("Parent"); + final ClientLink updatedLink = updated.getNavigationLink("Parent"); assertNotNull(updatedLink); - final ODataEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()). + final ClientEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()). execute().getBody(); assertNotNull(updatedEntity); assertEquals(1, updatedEntity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java index 4c5262466..a69df6786 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java @@ -1,26 +1,26 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.fit.v4; import org.apache.olingo.client.api.communication.ODataClientErrorException; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -42,10 +42,10 @@ public class ErrorResponseTestITCase extends AbstractTestITCase { read(ODataFormat.JSON, readURI); fail("should have got exception"); } catch (Exception ex) { - final ODataError err = ((ODataClientErrorException) ex).getODataError(); + final ClientError err = ((ODataClientErrorException) ex).getODataError(); // verify details - final ODataErrorDetail detail = err.getDetails().get(0); + final ClientErrorDetail detail = err.getDetails().get(0); assertEquals("Code should be correct", "301", detail.getCode()); assertEquals("Target should be correct", "$search", detail.getTarget()); assertEquals("Message should be correct", "$search query option not supported", detail.getMessage()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java index b6f416f01..74e510a9e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -23,8 +23,8 @@ 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.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -48,14 +48,14 @@ public class FilterFactoryTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertEquals(3, feed.getEntities().size()); - for (ODataEntity entity : feed.getEntities()) { + for (ClientEntity entity : feed.getEntities()) { assertEquals(2, entity.getNavigationLinks().size()); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java index 1af92d68a..b45cf5a94 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -29,12 +29,12 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; @@ -62,21 +62,21 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item1() throws EdmPrimitiveTypeException { final URI uri = edmClient.newURIBuilder(). - appendEntitySetSegment("Accounts").appendKeySegment(102). - appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); - final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102). + appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); + final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); // request format (via Accept header) is set to minimal by default assertEquals("application/json;odata.metadata=minimal", req.getAccept()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); // response is odata.metadata=minimal assertFalse(res.getContentType().contains("odata.metadata=none")); assertFalse(res.getContentType().contains("odata.metadata=full")); // response payload is understood - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString()); assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -89,23 +89,23 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item2() { final URI uri = edmClient.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(102).build(); - final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102).build(); + final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); req.setFormat(ODataFormat.JSON_FULL_METADATA); // request format (via Accept header) is set to full metadata assertEquals("application/json;odata.metadata=full", req.getAccept()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); // response is odata.metadata=full assertTrue(res.getContentType().contains("odata.metadata=full")); // response payload is understood (including links, only returned with full metadata) - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); } /** @@ -119,36 +119,36 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item3() throws Exception { final String fromSection71 = "{" - + "\"NullValue\": null," - + "\"TrueValue\": true," - + "\"FalseValue\": false," - + "\"BinaryValue@odata.type\": \"Binary\"," - + "\"BinaryValue\": \"T0RhdGE\"," - + "\"IntegerValue\": -128," - + "\"DoubleValue\": 3.1415926535897931," - + "\"SingleValue@odata.type\": \"Single\"," - + "\"SingleValue\": \"INF\"," - + "\"DecimalValue@odata.type\": \"Decimal\"," - + "\"DecimalValue\": 34.95," - + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\"," - + "\"DateValue@odata.type\": \"Date\"," - + "\"DateValue\": \"2012-12-03\"," - + "\"DateTimeOffsetValue@odata.type\": \"DateTimeOffset\"," - + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\"," - + "\"DurationValue@odata.type\": \"Duration\"," - + "\"DurationValue\": \"P12DT23H59M59.999999999999S\"," - + "\"TimeOfDayValue@odata.type\": \"TimeOfDay\"," - + "\"TimeOfDayValue\": \"07:59:59.999\"," - + "\"GuidValue@odata.type\": \"Guid\"," - + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\"," - + "\"Int64Value@odata.type\": \"Int64\"," - + "\"Int64Value\": 0," - + "\"ColorEnumValue@odata.type\": \"Test.Color\"," - + "\"ColorEnumValue\": \"Yellow\"," - + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}" - + "}"; + + "\"NullValue\": null," + + "\"TrueValue\": true," + + "\"FalseValue\": false," + + "\"BinaryValue@odata.type\": \"Binary\"," + + "\"BinaryValue\": \"T0RhdGE\"," + + "\"IntegerValue\": -128," + + "\"DoubleValue\": 3.1415926535897931," + + "\"SingleValue@odata.type\": \"Single\"," + + "\"SingleValue\": \"INF\"," + + "\"DecimalValue@odata.type\": \"Decimal\"," + + "\"DecimalValue\": 34.95," + + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\"," + + "\"DateValue@odata.type\": \"Date\"," + + "\"DateValue\": \"2012-12-03\"," + + "\"DateTimeOffsetValue@odata.type\": \"DateTimeOffset\"," + + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\"," + + "\"DurationValue@odata.type\": \"Duration\"," + + "\"DurationValue\": \"P12DT23H59M59.999999999999S\"," + + "\"TimeOfDayValue@odata.type\": \"TimeOfDay\"," + + "\"TimeOfDayValue\": \"07:59:59.999\"," + + "\"GuidValue@odata.type\": \"Guid\"," + + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\"," + + "\"Int64Value@odata.type\": \"Int64\"," + + "\"Int64Value\": 0," + + "\"ColorEnumValue@odata.type\": \"Test.Color\"," + + "\"ColorEnumValue\": \"Yellow\"," + + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}" + + "}"; - final ODataEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ODataFormat.JSON); + final ClientEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ODataFormat.JSON); assertTrue(entity.getProperty("NullValue").hasNullValue()); @@ -165,29 +165,29 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertEquals(EdmPrimitiveTypeKind.Double, entity.getProperty("DoubleValue").getPrimitiveValue().getTypeKind()); assertEquals(3.1415926535897931, - entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0); + entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0); assertEquals(EdmPrimitiveTypeKind.Single, entity.getProperty("SingleValue").getPrimitiveValue().getTypeKind()); assertEquals(Float.POSITIVE_INFINITY, - entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0); + entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0); assertEquals(EdmPrimitiveTypeKind.Decimal, entity.getProperty("DecimalValue").getPrimitiveValue().getTypeKind()); assertEquals(BigDecimal.valueOf(34.95), - entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class)); + entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class)); assertEquals(EdmPrimitiveTypeKind.String, entity.getProperty("StringValue").getPrimitiveValue().getTypeKind()); assertEquals("Say \"Hello\",\nthen go", - entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class)); + entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class)); assertEquals(EdmPrimitiveTypeKind.Date, entity.getProperty("DateValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, - entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind()); + entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Duration, entity.getProperty("DurationValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.TimeOfDay, - entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind()); + entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Guid, entity.getProperty("GuidValue").getPrimitiveValue().getTypeKind()); @@ -196,7 +196,7 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertTrue(entity.getProperty("ColorEnumValue").hasEnumValue()); assertEquals(EdmPrimitiveTypeKind.GeographyPoint, - entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind()); + entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind()); } /** @@ -205,21 +205,21 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item4() throws Exception { final String fromSection45_1 = "{" - + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\"," - + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\"," - + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\"," - + "\"@odata.type\": \"#Model.VipCustomer\"," - + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\"," - + "\"@odata.editLink\": \"People(976)\"," - + "\"@odata.mediaEditLink\": \"Employees(1)/$value\"," - + "\"@odata.mediaContentType\": \"image/jpeg\"," - + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\"," - + "\"Parent@odata.navigationLink\": \"People(976)/Parent\"," - + "\"Parent@odata.associationLink\": \"People(976)/Parent\"" - + "}"; + + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\"," + + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\"," + + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\"," + + "\"@odata.type\": \"#Model.VipCustomer\"," + + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\"," + + "\"@odata.editLink\": \"People(976)\"," + + "\"@odata.mediaEditLink\": \"Employees(1)/$value\"," + + "\"@odata.mediaContentType\": \"image/jpeg\"," + + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\"," + + "\"Parent@odata.navigationLink\": \"People(976)/Parent\"," + + "\"Parent@odata.associationLink\": \"People(976)/Parent\"" + + "}"; final ResWrap entity = - client.getDeserializer(ODataFormat.JSON).toEntity(IOUtils.toInputStream(fromSection45_1)); + client.getDeserializer(ODataFormat.JSON).toEntity(IOUtils.toInputStream(fromSection45_1)); assertEquals("http://host/service/$metadata#Customers/$entity", entity.getContextURL().toASCIIString()); assertEquals("W/\"A1FF3E230954908F\"", entity.getMetadataETag()); @@ -234,14 +234,14 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertEquals("People(976)/Parent", entity.getPayload().getAssociationLink("Parent").getHref()); final String fromSection45_2 = "{" - + " \"@odata.count\": 5," - + " \"value\": []," - + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\"," - + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\"" - + "}"; + + " \"@odata.count\": 5," + + " \"value\": []," + + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\"," + + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\"" + + "}"; final ResWrap entitySet = - client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2)); + client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2)); assertEquals(5, entitySet.getPayload().getCount(), 0); assertEquals("Customers?$expand=Orders&$skipToken=5", entitySet.getPayload().getNext().toASCIIString()); @@ -255,54 +255,54 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item5() throws Exception { final String sample = "{" - + " \"@odata.context\": \"http://host/service/$metadata#Customers\"," - + " \"@odata.notdefined\": 11," - + " \"@com.contoso.customer.setkind\": \"VIPs\"," - + " \"value\": [" - + " {" - + " \"@com.contoso.display.highlight\": true," - + " \"ID\": \"ALFKI\"," - + " \"CompanyName@com.contoso.display.style\": { \"title\": true, \"order\": 1 }," - + " \"CompanyName\": \"Alfreds Futterkiste\"," - + " \"Orders@com.contoso.display.style\": { \"order\": 2 }," - + " \"Orders@odata.navigationLink\": \"People(976)/Orders\"" - + " }" - + " ]" - + "}"; + + " \"@odata.context\": \"http://host/service/$metadata#Customers\"," + + " \"@odata.notdefined\": 11," + + " \"@com.contoso.customer.setkind\": \"VIPs\"," + + " \"value\": [" + + " {" + + " \"@com.contoso.display.highlight\": true," + + " \"ID\": \"ALFKI\"," + + " \"CompanyName@com.contoso.display.style\": { \"title\": true, \"order\": 1 }," + + " \"CompanyName\": \"Alfreds Futterkiste\"," + + " \"Orders@com.contoso.display.style\": { \"order\": 2 }," + + " \"Orders@odata.navigationLink\": \"People(976)/Orders\"" + + " }" + + " ]" + + "}"; - final ODataEntitySet entitySet = client.getReader(). - readEntitySet(IOUtils.toInputStream(sample), ODataFormat.JSON); + final ClientEntitySet entitySet = client.getReader(). + readEntitySet(IOUtils.toInputStream(sample), ODataFormat.JSON); assertEquals(2, entitySet.getAnnotations().size()); - final ODataAnnotation notdefined = entitySet.getAnnotations().get(0); + final ClientAnnotation notdefined = entitySet.getAnnotations().get(0); assertEquals("odata.notdefined", notdefined.getTerm()); assertEquals(11, notdefined.getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataAnnotation setkind = entitySet.getAnnotations().get(1); + final ClientAnnotation setkind = entitySet.getAnnotations().get(1); assertEquals("com.contoso.customer.setkind", setkind.getTerm()); assertEquals("VIPs", setkind.getPrimitiveValue().toCastValue(String.class)); - final ODataEntity entity = entitySet.getEntities().get(0); + final ClientEntity entity = entitySet.getEntities().get(0); assertEquals(1, entity.getAnnotations().size()); - final ODataAnnotation highlight = entity.getAnnotations().get(0); + final ClientAnnotation highlight = entity.getAnnotations().get(0); assertEquals("com.contoso.display.highlight", highlight.getTerm()); assertEquals(Boolean.TRUE, highlight.getPrimitiveValue().toCastValue(Boolean.class)); - final ODataProperty property = entity.getProperty("CompanyName"); + final ClientProperty property = entity.getProperty("CompanyName"); assertEquals(1, property.getAnnotations().size()); - final ODataAnnotation style = property.getAnnotations().get(0); + final ClientAnnotation style = property.getAnnotations().get(0); assertEquals("com.contoso.display.style", style.getTerm()); assertTrue(style.hasComplexValue()); assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class)); assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataLink orders = entity.getNavigationLink("Orders"); + final ClientLink orders = entity.getNavigationLink("Orders"); assertEquals(1, orders.getAnnotations().size()); - final ODataAnnotation style2 = orders.getAnnotations().get(0); + final ClientAnnotation style2 = orders.getAnnotations().get(0); assertEquals("com.contoso.display.style", style2.getTerm()); assertTrue(style2.hasComplexValue()); assertEquals(2, style2.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -314,17 +314,17 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item6() throws EdmPrimitiveTypeException { final URI uri = edmClient.newURIBuilder(). - appendEntitySetSegment("Accounts").appendKeySegment(102). - appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); - final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102). + appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); + final ODataEntityRequest req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); // request format (via Accept header) does not contain odata.streaming=true assertEquals("application/json;odata.metadata=minimal", req.getAccept()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); // response payload is understood - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString()); assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java index b92e39f09..835d7a3c2 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -24,8 +24,8 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.AfterClass; @@ -52,13 +52,14 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase { private void read(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testKeyAsSegmentServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(101); + appendEntitySetSegment("Accounts").appendKeySegment(101); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); - final ODataEntity entity = res.getBody(); + final ODataRetrieveResponse res = req.execute(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); // In JSON with minimal metadata, links are not provided @@ -89,27 +90,27 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase { } private void update(final ODataFormat format) { - final ODataEntity changes = getClient().getObjectFactory().newEntity( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); - final ODataProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle")); + final ClientEntity changes = getClient().getObjectFactory().newEntity( + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); + final ClientProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle")); changes.getProperties().add(middleName); final URI uri = getClient().newURIBuilder(testKeyAsSegmentServiceRootURL). - appendEntitySetSegment("People").appendKeySegment(5).build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). - getEntityUpdateRequest(uri, UpdateType.PATCH, changes); + appendEntitySetSegment("People").appendKeySegment(5).build(); + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(updated); assertFalse(updated.getEditLink().toASCIIString().contains("(")); assertFalse(updated.getEditLink().toASCIIString().contains(")")); - final ODataProperty updatedMiddleName = updated.getProperty("MiddleName"); + final ClientProperty updatedMiddleName = updated.getProperty("MiddleName"); assertNotNull(updatedMiddleName); assertEquals("middle", updatedMiddleName.getPrimitiveValue().toString()); } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java index 9dfc97f78..2b19064a4 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -36,8 +36,8 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdat import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -61,16 +61,16 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final URIBuilder builder = client.newURIBuilder(testDemoServiceRootURL). appendEntitySetSegment("Advertisements"). appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")); - final ODataEntityRequest entityReq = + final ODataEntityRequest entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build()); entityReq.setFormat(format); - final ODataEntity entity = entityReq.execute().getBody(); + final ClientEntity entity = entityReq.execute().getBody(); assertNotNull(entity); assertTrue(entity.isMediaEntity()); // cast to workaround JDK 6 bug, fixed in JDK 7 assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(), - ((ODataValuable) entity.getProperty("AirDate")).getValue().getTypeName()); + ((ClientValuable) entity.getProperty("AirDate")).getValue().getTypeName()); final ODataMediaRequest streamReq = client.getRetrieveRequestFactory(). getMediaRequest(entity.getMediaContentSource()); @@ -101,28 +101,28 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final InputStream input = IOUtils.toInputStream(random); final URI uri = client.newURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build(); - final ODataMediaEntityCreateRequest createReq = + final ODataMediaEntityCreateRequest createReq = client.getCUDRequestFactory().getMediaEntityCreateRequest(uri, input); - final MediaEntityCreateStreamManager streamManager = createReq.payloadManager(); + final MediaEntityCreateStreamManager streamManager = createReq.payloadManager(); - final ODataMediaEntityCreateResponse createRes = streamManager.getResponse(); + final ODataMediaEntityCreateResponse createRes = streamManager.getResponse(); assertEquals(201, createRes.getStatusCode()); final Collection location = createRes.getHeader(HeaderName.location); assertNotNull(location); final URI createdLocation = URI.create(location.iterator().next()); - final ODataEntity changes = client.getObjectFactory(). + final ClientEntity changes = client.getObjectFactory(). newEntity(new FullQualifiedName("ODataDemo.Advertisement")); changes.getProperties().add(client.getObjectFactory().newPrimitiveProperty("AirDate", getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build())); - final ODataEntityUpdateRequest updateReq = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest updateReq = getClient().getCUDRequestFactory(). getEntityUpdateRequest(createdLocation, UpdateType.PATCH, changes); updateReq.setFormat(format); - final ODataEntityUpdateResponse updateRes = updateReq.execute(); + final ODataEntityUpdateResponse updateRes = updateReq.execute(); assertEquals(204, updateRes.getStatusCode()); final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory(). @@ -153,12 +153,12 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final String random = RandomStringUtils.random(124); // 1. update providing media content - final ODataMediaEntityUpdateRequest updateReq = client.getCUDRequestFactory(). + final ODataMediaEntityUpdateRequest updateReq = client.getCUDRequestFactory(). getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random)); updateReq.setFormat(format); - final MediaEntityUpdateStreamManager streamManager = updateReq.payloadManager(); - final ODataMediaEntityUpdateResponse createRes = streamManager.getResponse(); + final MediaEntityUpdateStreamManager streamManager = updateReq.payloadManager(); + final ODataMediaEntityUpdateResponse createRes = streamManager.getResponse(); assertEquals(204, createRes.getStatusCode()); // 2. check that media content was effectively uploaded diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java index 2119c0c3d..4a5d6f5c5 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -47,7 +47,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(edm); final EdmEntityType order = edm.getEntityType( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order")); + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order")); assertNotNull(order); final EdmProperty orderDate = order.getStructuralProperty("OrderDate"); @@ -68,12 +68,12 @@ public class MetadataTestITCase extends AbstractTestITCase { assertEquals(3, record.getPropertyValues().size()); assertTrue(record.getPropertyValues().get(0).getValue().isConstant()); assertTrue(record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive(). - toCastValue(Boolean.class)); + toCastValue(Boolean.class)); assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection()); assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size()); assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic()); assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection(). - getItems().get(0).asDynamic().asPropertyPath().getValue()); + getItems().get(0).asDynamic().asPropertyPath().getValue()); } @Test @@ -82,7 +82,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(edm); final EdmEntityContainer container = edm.getEntityContainer( - new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities")); + new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities")); assertNotNull(container); final EdmEntitySet categories = container.getEntitySet("Categories"); @@ -93,7 +93,7 @@ public class MetadataTestITCase extends AbstractTestITCase { @Test public void vocabularies() { final Edm edm = client.getRetrieveRequestFactory(). - getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody(); + getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody(); assertNotNull(edm); // 1. core @@ -105,12 +105,12 @@ public class MetadataTestITCase extends AbstractTestITCase { final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core.Description")); assertNotNull(descriptionTerm); assertEquals(descriptionTerm.getFullQualifiedName(), - edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName()); + edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName()); final EdmAnnotation description = core.getAnnotation(descriptionTerm); assertNotNull(description); assertEquals("Core terms needed to write vocabularies", - description.getExpression().asConstant().getValue().asPrimitive().toString()); + description.getExpression().asConstant().getValue().asPrimitive().toString()); final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core.IsLanguageDependent")); assertNotNull(isLanguageDependent); @@ -132,7 +132,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(scale); final EdmAnnotation requiresTypeInScale = edm.getAnnotation( - scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType"))); + scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType"))); assertNotNull(requiresTypeInScale); assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValue().toString()); @@ -140,6 +140,6 @@ public class MetadataTestITCase extends AbstractTestITCase { final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities.DeleteRestrictions")); assertNotNull(deleteRestrictions); assertEquals(deleteRestrictions.getType().getFullQualifiedName(), - edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName()); + edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName()); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java index 1eba762a9..44b7eca92 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -42,17 +42,17 @@ import org.apache.olingo.fit.CXFOAuth2HttpClientFactory; public class OAuth2TestITCase extends AbstractTestITCase { private static final URI OAUTH2_GRANT_SERVICE_URI = - URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize"); + URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize"); private static final URI OAUTH2_TOKEN_SERVICE_URI = - URI.create("http://localhost:9080/stub/StaticService/oauth2/token"); + URI.create("http://localhost:9080/stub/StaticService/oauth2/token"); private EdmEnabledODataClient _edmClient; @BeforeClass public static void enableOAuth2() { client.getConfiguration().setHttpClientFactory( - new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); + new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); } @AfterClass @@ -64,7 +64,7 @@ public class OAuth2TestITCase extends AbstractTestITCase { if (_edmClient == null) { _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL); _edmClient.getConfiguration().setHttpClientFactory( - new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); + new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); } return _edmClient; @@ -72,18 +72,19 @@ public class OAuth2TestITCase extends AbstractTestITCase { private void read(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = - client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); + client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertEquals(200, res.getStatusCode()); final String etag = res.getETag(); assertTrue(StringUtils.isNotBlank(etag)); - final ODataEntity order = res.getBody(); + final ClientEntity order = res.getBody(); assertEquals(etag, order.getETag()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString()); assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java index 4721ddc8f..ad9b0a6ac 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -30,8 +30,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmSchema; @@ -53,14 +53,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase { assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType()); } - private ODataEntity readRow(final ODataFormat format, final String uuid) { + private ClientEntity readRow(final ODataFormat format, final String uuid) { final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid)); return read(format, builder.build()); } private void read(final ODataFormat format) { - ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f"); + ClientEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f"); assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind()); @@ -81,7 +81,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase { private void cud(final ODataFormat format) { final Integer id = 1426; - ODataEntity rowIndex = getClient().getObjectFactory().newEntity( + ClientEntity rowIndex = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex")); getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newPrimitiveProperty("Id", @@ -114,7 +114,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase { getClient().getObjectFactory().newEnumProperty("aColor", getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue"))); - final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue( + final ClientComplexValue contactDetails = getClient().getObjectFactory().newComplexValue( "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails"); contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("FirstContacted", getClient().getObjectFactory().newPrimitiveValueBuilder().buildBinary("text".getBytes()))); @@ -151,11 +151,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase { getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newComplexProperty("aContact", contactDetails)); - final ODataEntityCreateRequest createReq = getClient().getCUDRequestFactory(). + final ODataEntityCreateRequest createReq = getClient().getCUDRequestFactory(). getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("RowIndex").build(), rowIndex); createReq.setFormat(format); - final ODataEntityCreateResponse createRes = createReq.execute(); + final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(201, createRes.getStatusCode()); final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java index 261d943e3..4c0775ede 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -27,15 +27,15 @@ import java.util.LinkedHashMap; import java.util.Map; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -44,31 +44,31 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { private void functionImports(final ODataFormat format) throws EdmPrimitiveTypeException { // GetDefaultColor - final ODataInvokeRequest defaultColorReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest defaultColorReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetDefaultColor").build(), ODataProperty.class); + appendOperationCallSegment("GetDefaultColor").build(), ClientProperty.class); defaultColorReq.setFormat(format); - final ODataProperty defaultColor = defaultColorReq.execute().getBody(); + final ClientProperty defaultColor = defaultColorReq.execute().getBody(); assertNotNull(defaultColor); assertTrue(defaultColor.hasEnumValue()); assertEquals("Red", defaultColor.getEnumValue().getValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName()); // GetPerson2 - final ODataPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); + final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); - final ODataInvokeRequest person2Req = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest person2Req = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetPerson2").build(), ODataEntity.class, - Collections. singletonMap("city", city)); + appendOperationCallSegment("GetPerson2").build(), ClientEntity.class, + Collections. singletonMap("city", city)); person2Req.setFormat(format); - final ODataEntity person2 = person2Req.execute().getBody(); + final ClientEntity person2 = person2Req.execute().getBody(); assertNotNull(person2); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString()); assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetPerson - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way"))); @@ -77,34 +77,34 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052"))); - final ODataInvokeRequest personReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest personReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetPerson").build(), ODataEntity.class, - Collections. singletonMap("address", address)); + appendOperationCallSegment("GetPerson").build(), ClientEntity.class, + Collections. singletonMap("address", address)); personReq.setFormat(format); - final ODataEntity person = personReq.execute().getBody(); + final ClientEntity person = personReq.execute().getBody(); assertNotNull(person); assertEquals(person2, person); // GetAllProducts - final ODataInvokeRequest productsReq = getClient().getInvokeRequestFactory() + final ODataInvokeRequest productsReq = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetAllProducts").build(), ODataEntitySet.class); + appendOperationCallSegment("GetAllProducts").build(), ClientEntitySet.class); productsReq.setFormat(format); - final ODataEntitySet products = productsReq.execute().getBody(); + final ClientEntitySet products = productsReq.execute().getBody(); assertNotNull(products); assertEquals(5, products.getEntities().size()); // GetProductsByAccessLevel - final ODataEnumValue accessLevel = getClient().getObjectFactory(). + final ClientEnumValue accessLevel = getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None"); - final ODataInvokeRequest prodByALReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest prodByALReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetProductsByAccessLevel").build(), ODataProperty.class, - Collections. singletonMap("accessLevel", accessLevel)); + appendOperationCallSegment("GetProductsByAccessLevel").build(), ClientProperty.class, + Collections. singletonMap("accessLevel", accessLevel)); prodByALReq.setFormat(format); - final ODataProperty prodByAL = prodByALReq.execute().getBody(); + final ClientProperty prodByAL = prodByALReq.execute().getBody(); assertNotNull(prodByAL); assertTrue(prodByAL.hasCollectionValue()); assertEquals(5, prodByAL.getCollectionValue().size()); @@ -124,27 +124,27 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledFunctionImports() throws EdmPrimitiveTypeException { // GetDefaultColor - final ODataInvokeRequest defaultColorReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest defaultColorReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest("GetDefaultColor"); - final ODataProperty defaultColor = defaultColorReq.execute().getBody(); + final ClientProperty defaultColor = defaultColorReq.execute().getBody(); assertNotNull(defaultColor); assertTrue(defaultColor.hasEnumValue()); assertEquals("Red", defaultColor.getEnumValue().getValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName()); // GetPerson2 - final ODataPrimitiveValue city = + final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); - final ODataInvokeRequest person2Req = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest person2Req = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( - "GetPerson2", Collections. singletonMap("city", city)); - final ODataEntity person2 = person2Req.execute().getBody(); + "GetPerson2", Collections. singletonMap("city", city)); + final ClientEntity person2 = person2Req.execute().getBody(); assertNotNull(person2); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString()); assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetPerson - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way"))); @@ -153,29 +153,29 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052"))); - final ODataInvokeRequest personReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest personReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( - "GetPerson", Collections. singletonMap("address", address)); - final ODataEntity person = personReq.execute().getBody(); + "GetPerson", Collections. singletonMap("address", address)); + final ClientEntity person = personReq.execute().getBody(); assertNotNull(person); assertEquals(person2, person); // GetAllProducts - final ODataInvokeRequest productsReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest productsReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest("GetAllProducts"); - final ODataEntitySet products = productsReq.execute().getBody(); + final ClientEntitySet products = productsReq.execute().getBody(); assertNotNull(products); assertEquals(5, products.getEntities().size()); // GetProductsByAccessLevel - final ODataEnumValue accessLevel = getClient().getObjectFactory(). + final ClientEnumValue accessLevel = getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None"); - final ODataInvokeRequest prodByALReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest prodByALReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( "GetProductsByAccessLevel", - Collections. singletonMap("accessLevel", accessLevel)); - final ODataProperty prodByAL = prodByALReq.execute().getBody(); + Collections. singletonMap("accessLevel", accessLevel)); + final ClientProperty prodByAL = prodByALReq.execute().getBody(); assertNotNull(prodByAL); assertTrue(prodByAL.hasCollectionValue()); assertEquals(5, prodByAL.getCollectionValue().size()); @@ -184,17 +184,17 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { private void actionImports(final ODataFormat format) { // Discount - final ODataPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); - final ODataInvokeRequest discountReq = getClient().getInvokeRequestFactory(). + final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); + final ODataInvokeRequest discountReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("Discount").build(), ODataNoContent.class, - Collections. singletonMap("percentage", percentage)); + appendOperationCallSegment("Discount").build(), ClientNoContent.class, + Collections. singletonMap("percentage", percentage)); discountReq.setFormat(format); - final ODataNoContent discount = discountReq.execute().getBody(); + final ClientNoContent discount = discountReq.execute().getBody(); assertNotNull(discount); // ResetBossAddress - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123"))); @@ -203,12 +203,12 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); - final ODataInvokeRequest resetBossAddressReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest resetBossAddressReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("ResetBossAddress").build(), ODataProperty.class, - Collections. singletonMap("address", address)); + appendOperationCallSegment("ResetBossAddress").build(), ClientProperty.class, + Collections. singletonMap("address", address)); resetBossAddressReq.setFormat(format); - final ODataProperty resetBossAddress = resetBossAddressReq.execute().getBody(); + final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody(); assertNotNull(resetBossAddress); assertEquals(address, resetBossAddress.getComplexValue()); } @@ -226,15 +226,15 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledActionImports() { // Discount - final ODataPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); - final ODataInvokeRequest discountReq = edmClient.getInvokeRequestFactory(). + final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); + final ODataInvokeRequest discountReq = edmClient.getInvokeRequestFactory(). getActionImportInvokeRequest( - "Discount", Collections. singletonMap("percentage", percentage)); - final ODataNoContent discount = discountReq.execute().getBody(); + "Discount", Collections. singletonMap("percentage", percentage)); + final ClientNoContent discount = discountReq.execute().getBody(); assertNotNull(discount); // ResetBossAddress - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123"))); @@ -243,38 +243,38 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); - final ODataInvokeRequest resetBossAddressReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest resetBossAddressReq = edmClient.getInvokeRequestFactory(). getActionImportInvokeRequest( - "ResetBossAddress", Collections. singletonMap("address", address)); - final ODataProperty resetBossAddress = resetBossAddressReq.execute().getBody(); + "ResetBossAddress", Collections. singletonMap("address", address)); + final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody(); assertNotNull(resetBossAddress); assertEquals(address.getTypeName(), resetBossAddress.getComplexValue().getTypeName()); } private void bossEmails(final ODataFormat format) { // ResetBossEmail - final ODataCollectionValue emails = + final ClientCollectionValue emails = getClient().getObjectFactory().newCollectionValue("Collection(Edm.String)"); emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("first@olingo.apache.org")); emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("second@olingo.apache.org")); - ODataInvokeRequest bossEmailsReq = getClient().getInvokeRequestFactory(). + ODataInvokeRequest bossEmailsReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("ResetBossEmail").build(), ODataProperty.class, - Collections. singletonMap("emails", emails)); + appendOperationCallSegment("ResetBossEmail").build(), ClientProperty.class, + Collections. singletonMap("emails", emails)); bossEmailsReq.setFormat(format); - final ODataProperty bossEmails = bossEmailsReq.execute().getBody(); + final ClientProperty bossEmails = bossEmailsReq.execute().getBody(); assertNotNull(bossEmails); assertTrue(bossEmails.hasCollectionValue()); assertEquals(2, bossEmails.getCollectionValue().size()); - final Map params = new LinkedHashMap(2); + final Map params = new LinkedHashMap(2); params.put("start", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(0)); params.put("count", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100)); bossEmailsReq = getClient().getInvokeRequestFactory().getFunctionInvokeRequest( getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetBossEmails").build(), ODataProperty.class, params); + appendOperationCallSegment("GetBossEmails").build(), ClientProperty.class, params); bossEmailsReq.setFormat(format); - final ODataProperty bossEmailsViaGET = bossEmailsReq.execute().getBody(); + final ClientProperty bossEmailsViaGET = bossEmailsReq.execute().getBody(); assertNotNull(bossEmailsViaGET); assertTrue(bossEmailsViaGET.hasCollectionValue()); assertEquals(2, bossEmailsViaGET.getCollectionValue().size()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java index f55c56e80..f942e1c7e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -34,9 +34,9 @@ import org.apache.olingo.client.api.communication.response.ODataEntityCreateResp import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; import org.junit.Test; @@ -46,15 +46,15 @@ public class PropertyTestITCase extends AbstractTestITCase { private void _enum(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Products").appendKeySegment(5).appendPropertySegment("CoverColors"); - final ODataPropertyRequest req = client.getRetrieveRequestFactory(). + final ODataPropertyRequest req = client.getRetrieveRequestFactory(). getPropertyRequest(uriBuilder.build()); req.setFormat(format); - final ODataProperty prop = req.execute().getBody(); + final ClientProperty prop = req.execute().getBody(); assertNotNull(prop); // cast to workaround JDK 6 bug, fixed in JDK 7 assertEquals("Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)", - ((ODataValuable) prop).getValue().getTypeName()); + ((ClientValuable) prop).getValue().getTypeName()); } @Test @@ -75,14 +75,14 @@ public class PropertyTestITCase extends AbstractTestITCase { private void geospatial(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Home"); - final ODataPropertyRequest req = client.getRetrieveRequestFactory(). + final ODataPropertyRequest req = client.getRetrieveRequestFactory(). getPropertyRequest(uriBuilder.build()); req.setFormat(format); - final ODataProperty prop = req.execute().getBody(); + final ClientProperty prop = req.execute().getBody(); assertNotNull(prop); // cast to workaround JDK 6 bug, fixed in JDK 7 - assertEquals("Edm.GeographyPoint", ((ODataValuable) prop).getValue().getTypeName()); + assertEquals("Edm.GeographyPoint", ((ClientValuable) prop).getValue().getTypeName()); } @Test @@ -103,15 +103,15 @@ public class PropertyTestITCase extends AbstractTestITCase { private void complex(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(2).appendPropertySegment("HomeAddress"); - final ODataPropertyRequest req = client.getRetrieveRequestFactory(). + final ODataPropertyRequest req = client.getRetrieveRequestFactory(). getPropertyRequest(uriBuilder.build()); req.setFormat(format); - final ODataProperty prop = req.execute().getBody(); + final ClientProperty prop = req.execute().getBody(); assertNotNull(prop); // cast to workaround JDK 6 bug, fixed in JDK 7 assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address", - ((ODataValuable) prop).getValue().getTypeName()); + ((ClientValuable) prop).getValue().getTypeName()); } @Test @@ -133,14 +133,14 @@ public class PropertyTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).appendPropertySegment("HomeAddress"); - ODataPropertyRequest retrieveReq = + ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build()); retrieveReq.setFormat(format); - ODataRetrieveResponse retrieveRes = retrieveReq.execute(); + ODataRetrieveResponse retrieveRes = retrieveReq.execute(); assertEquals(200, retrieveRes.getStatusCode()); - ODataProperty homeAddress = client.getObjectFactory().newComplexProperty("HomeAddress", + ClientProperty homeAddress = client.getObjectFactory().newComplexProperty("HomeAddress", client.getObjectFactory().newComplexValue(retrieveRes.getBody().getComplexValue().getTypeName())); homeAddress.getComplexValue().add(client.getObjectFactory(). @@ -176,17 +176,17 @@ public class PropertyTestITCase extends AbstractTestITCase { @Test public void createAndDelete() { // 1. create - final ODataEntity category = client.getObjectFactory().newEntity(null); + final ClientEntity category = client.getObjectFactory().newEntity(null); category.setId(client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Categories").appendKeySegment(1).build()); final URIBuilder createBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories"). appendRefSegment(); - final ODataEntityCreateRequest createReq = client.getCUDRequestFactory(). + final ODataEntityCreateRequest createReq = client.getCUDRequestFactory(). getEntityCreateRequest(createBuilder.build(), category); - final ODataEntityCreateResponse createRes = createReq.execute(); + final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(204, createRes.getStatusCode()); // 2. delete diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java index 12fd772be..60386547a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,9 +28,9 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -70,7 +70,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase { appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate"); final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); - final ODataPrimitiveValue property = req.execute().getBody(); + final ClientPrimitiveValue property = req.execute().getBody(); assertEquals("2011-03-04T16:03:57Z", property.toString()); } @@ -80,7 +80,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase { appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height"); final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); - final ODataPrimitiveValue property = req.execute().getBody(); + final ClientPrimitiveValue property = req.execute().getBody(); assertEquals("179", property.toString()); } @@ -90,7 +90,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase { appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC"); final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); - final ODataPrimitiveValue property = req.execute().getBody(); + final ClientPrimitiveValue property = req.execute().getBody(); assertEquals("fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJ" + "VIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=", property.toString()); } @@ -117,12 +117,12 @@ public class PropertyValueTestITCase extends AbstractTestITCase { public void retrieveCollectionPropertyValueTest() { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers"); - final ODataPropertyRequest req = client.getRetrieveRequestFactory(). + final ODataPropertyRequest req = client.getRetrieveRequestFactory(). getPropertyRequest(uriBuilder.build()); req.setFormat(ODataFormat.XML); - final ODataProperty property = req.execute().getBody(); + final ClientProperty property = req.execute().getBody(); // cast to workaround JDK 6 bug, fixed in JDK 7 - assertTrue(((ODataValuable) property).getValue().isCollection()); + assertTrue(((ClientValuable) property).getValue().isCollection()); assertEquals("555-555-5555", property.getCollectionValue().iterator().next().asPrimitive().toString()); } @@ -132,7 +132,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase { appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("HomeAddress"); final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); - final ODataPrimitiveValue property = req.execute().getBody(); + final ClientPrimitiveValue property = req.execute().getBody(); assertTrue(StringUtils.isBlank(property.toString())); } } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java index eb9ce22c7..046baa9c1 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -23,9 +23,9 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.QueryOption; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -51,10 +51,11 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - final ODataEntity customer = req.execute().getBody(); - assertTrue(customer.getNavigationLink("Orders") instanceof ODataInlineEntitySet); + final ClientEntity customer = req.execute().getBody(); + assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet); } @Test @@ -64,10 +65,11 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { expandWithOptions("Orders", Collections. singletonMap( QueryOption.FILTER, getClient().getFilterFactory().gt("OrderID", 7).build())); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - final ODataEntity customer = req.execute().getBody(); - assertTrue(customer.getNavigationLink("Orders") instanceof ODataInlineEntitySet); + final ClientEntity customer = req.execute().getBody(); + assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet); } /** @@ -81,16 +83,16 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { appendEntitySetSegment("People").filter("(PersonID lt 3)"); // 1. check that filtered entity set looks as expected - ODataEntitySetRequest req = + ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); - ODataEntitySet feed = req.execute().getBody(); + ClientEntitySet feed = req.execute().getBody(); assertNotNull(feed); assertEquals(2, feed.getEntities().size()); // 2. extract PersonID values - sorted ASC by default final List former = new ArrayList(2); - for (ODataEntity entity : feed.getEntities()) { + for (ClientEntity entity : feed.getEntities()) { final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class); assertTrue(personID < 3); former.add(personID); @@ -105,7 +107,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { // 4. extract again VIN value - now they were required to be sorted DESC final List latter = new ArrayList(2); - for (ODataEntity entity : feed.getEntities()) { + for (ClientEntity entity : feed.getEntities()) { final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class); assertTrue(personID < 3); latter.add(personID); @@ -124,10 +126,11 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).format("json"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(ODataFormat.ATOM); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertNotNull(res); assertTrue(res.getContentType().replaceAll(" ", ""). startsWith(ODataFormat.JSON.getContentType().toContentTypeString())); @@ -140,10 +143,10 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People"); // 1. check that filtered entity set looks as expected - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.skip(2).build()); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertEquals(3, feed.getEntities().size()); } @@ -154,10 +157,10 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People"); // 1. check that filtered entity set looks as expected - final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). + final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). getEntitySetRequest(uriBuilder.top(2).build()); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertEquals(2, feed.getEntities().size()); } @@ -169,14 +172,14 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL); uriBuilder.appendEntitySetSegment("People").skipToken("5"); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertNotNull(feed); assertEquals(1, feed.getEntities().size()); - for (ODataEntity entity : feed.getEntities()) { + for (ClientEntity entity : feed.getEntities()) { assertTrue(entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class) > 5); } } @@ -189,10 +192,10 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").count(true); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertNotNull(feed); assertEquals(Integer.valueOf(feed.getEntities().size()), feed.getCount()); } @@ -205,12 +208,13 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Customers").appendKeySegment(1).select("PersonID,Orders").expand("Orders"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - final ODataEntity customer = req.execute().getBody(); + final ClientEntity customer = req.execute().getBody(); assertEquals(1, customer.getProperties().size()); assertEquals(1, customer.getNavigationLinks().size()); - assertTrue((customer.getNavigationLinks().get(0) instanceof ODataInlineEntitySet)); + assertTrue((customer.getNavigationLinks().get(0) instanceof ClientInlineEntitySet)); } @Test @@ -219,9 +223,10 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { appendEntitySetSegment("relatedEntitySelect").appendEntitySetSegment("Customers").appendKeySegment(1). expandWithSelect("Orders", "OrderID", "OrderDetails"); - final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertEquals(200, res.getStatusCode()); } @@ -231,10 +236,10 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { appendEntitySetSegment("People").search(client.getSearchFactory(). or(client.getSearchFactory().literal("Bob"), client.getSearchFactory().literal("Jill"))); - final ODataEntitySetRequest req = + final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(builder.build()); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertEquals(200, res.getStatusCode()); assertFalse(res.getBody().getEntities().isEmpty()); } diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java index b2abc7042..402b30f61 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -20,7 +20,7 @@ package org.apache.olingo.fit.v4; import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -35,10 +35,10 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase { client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL); req.setFormat(format); - final ODataRetrieveResponse res = req.execute(); + final ODataRetrieveResponse res = req.execute(); assertEquals(200, res.getStatusCode()); - final ODataServiceDocument serviceDocument = res.getBody(); + final ClientServiceDocument serviceDocument = res.getBody(); assertEquals(12, serviceDocument.getEntitySets().size()); assertEquals(6, serviceDocument.getSingletons().size()); assertEquals(6, serviceDocument.getFunctionImports().size()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java index 5a2605b3d..8883c9624 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java @@ -1,18 +1,18 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -24,9 +24,9 @@ import org.apache.olingo.client.api.communication.request.cud.UpdateType; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataSingleton; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientSingleton; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; @@ -43,16 +43,16 @@ public class SingletonTestITCase extends AbstractTestITCase { private void read(final ODataClient client, final ODataFormat format) throws EdmPrimitiveTypeException { final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company"); - final ODataEntityRequest singleton = + final ODataEntityRequest singleton = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singleton.setFormat(format); - final ODataSingleton company = singleton.execute().getBody(); + final ClientSingleton company = singleton.execute().getBody(); assertNotNull(company); assertEquals(0, company.getProperty("CompanyID").getPrimitiveValue().toCastValue(Integer.class), 0); // cast to workaround JDK 6 bug, fixed in JDK 7 assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory", - ((ODataValuable) company.getProperty("CompanyCategory")).getValue().getTypeName()); + ((ClientValuable) company.getProperty("CompanyCategory")).getValue().getTypeName()); assertTrue(company.getProperty("CompanyCategory").hasEnumValue()); } @@ -75,15 +75,15 @@ public class SingletonTestITCase extends AbstractTestITCase { throws EdmPrimitiveTypeException { final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss"); - final ODataEntityRequest singleton = + final ODataEntityRequest singleton = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singleton.setFormat(format); singleton.setPrefer(client.newPreferences().includeAnnotations("*")); - final ODataSingleton boss = singleton.execute().getBody(); + final ClientSingleton boss = singleton.execute().getBody(); assertNotNull(boss); assertFalse(boss.getAnnotations().isEmpty()); - final ODataAnnotation isBoss = boss.getAnnotations().get(0); + final ClientAnnotation isBoss = boss.getAnnotations().get(0); assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class)); } @@ -103,20 +103,21 @@ public class SingletonTestITCase extends AbstractTestITCase { } private void update(final ODataFormat format) throws EdmPrimitiveTypeException { - final ODataSingleton changes = getClient().getObjectFactory().newSingleton( + final ClientSingleton changes = getClient().getObjectFactory().newSingleton( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company")); changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Revenue", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt64(132520L))); final URI uri = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company").build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). getSingletonUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataSingleton updated = getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody(); + final ClientSingleton updated = + getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody(); assertNotNull(updated); assertEquals(132520, updated.getProperty("Revenue").getPrimitiveValue().toCastValue(Integer.class), 0); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java index 24b5119ab..04e01ba34 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.api.serialization.ODataWriter; import org.apache.olingo.client.api.uri.FilterFactory; import org.apache.olingo.client.api.uri.SearchFactory; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializer; @@ -65,7 +65,7 @@ public interface ODataClient { SearchFactory getSearchFactory(); - ODataObjectFactory getObjectFactory(); + ClientObjectFactory getObjectFactory(); AsyncRequestFactory getAsyncRequestFactory(); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java index 178241a3b..218c6e3eb 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java @@ -21,12 +21,12 @@ package org.apache.olingo.client.api.communication; import org.apache.commons.lang3.StringUtils; import org.apache.http.StatusLine; import org.apache.olingo.commons.api.ODataRuntimeException; -import org.apache.olingo.commons.api.domain.ODataError; +import org.apache.olingo.commons.api.domain.ClientError; /** * Represents a client error in OData. * - * @see ODataError + * @see ClientError */ public class ODataClientErrorException extends ODataRuntimeException { @@ -34,7 +34,7 @@ public class ODataClientErrorException extends ODataRuntimeException { private final StatusLine statusLine; - private final ODataError error; + private final ClientError error; /** * Constructor. @@ -54,7 +54,7 @@ public class ODataClientErrorException extends ODataRuntimeException { * @param statusLine request status info. * @param error OData error to be wrapped. */ - public ODataClientErrorException(final StatusLine statusLine, final ODataError error) { + public ODataClientErrorException(final StatusLine statusLine, final ClientError error) { super(error == null ? statusLine.toString() : (StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ") @@ -78,7 +78,7 @@ public class ODataClientErrorException extends ODataRuntimeException { * * @return OData error. */ - public ODataError getODataError() { + public ClientError getODataError() { return error; } } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java index 9cc35c589..73c3f1f1d 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CUDRequestFactory.java @@ -24,10 +24,10 @@ import java.net.URI; import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest; import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest; import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; public interface CUDRequestFactory { @@ -41,7 +41,7 @@ public interface CUDRequestFactory { * @param entity entity to be created. * @return new ODataEntityCreateRequest instance. */ - ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, E entity); + ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, E entity); /** * Gets an update request object instance. @@ -52,7 +52,8 @@ public interface CUDRequestFactory { * @param changes changes to be applied. * @return new ODataEntityUpdateRequest instance. */ - ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType type, E changes); + ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, + UpdateType type, E changes); /** * Gets an update request object instance; uses entity's edit link as endpoint. @@ -62,7 +63,7 @@ public interface CUDRequestFactory { * @param entity changes to be applied. * @return new ODataEntityUpdateRequest instance. */ - ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, E entity); + ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, E entity); /** * Gets a create request object instance. @@ -74,7 +75,7 @@ public interface CUDRequestFactory { * @param value value to be created. * @return new ODataValueUpdateRequest instance. */ - ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UpdateType type, ODataPrimitiveValue value); + ODataValueUpdateRequest getValueUpdateRequest(URI targetURI, UpdateType type, ClientPrimitiveValue value); /** * Gets an update request object instance. @@ -85,7 +86,7 @@ public interface CUDRequestFactory { * @param property value to be update. * @return new ODataPropertyUpdateRequest instance. */ - ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property); + ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ClientProperty property); /** * Gets an update request object instance. @@ -98,7 +99,7 @@ public interface CUDRequestFactory { * @return new ODataPropertyUpdateRequest instance. */ ODataPropertyUpdateRequest - getPropertyComplexValueUpdateRequest(URI targetURI, UpdateType type, ODataProperty property); + getPropertyComplexValueUpdateRequest(URI targetURI, UpdateType type, ClientProperty property); /** * Gets an update request object instance. @@ -109,7 +110,7 @@ public interface CUDRequestFactory { * @param property value to be update. * @return new ODataPropertyUpdateRequest instance. */ - ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property); + ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ClientProperty property); /** * Gets a delete request object instance. @@ -131,7 +132,7 @@ public interface CUDRequestFactory { * @param media entity blob to be created. * @return new ODataMediaEntityCreateRequest instance. */ - ODataMediaEntityCreateRequest getMediaEntityCreateRequest( + ODataMediaEntityCreateRequest getMediaEntityCreateRequest( URI targetURI, InputStream media); /** @@ -155,14 +156,14 @@ public interface CUDRequestFactory { * @param media entity blob to be updated. * @return new ODataMediaEntityUpdateRequest instance. */ - ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( + ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( URI editURI, InputStream media); - ODataEntityUpdateRequest getSingletonUpdateRequest( - URI targetURI, UpdateType type, ODataSingleton changes); + ODataEntityUpdateRequest getSingletonUpdateRequest( + URI targetURI, UpdateType type, ClientSingleton changes); - ODataEntityUpdateRequest getSingletonUpdateRequest( - UpdateType type, ODataSingleton entity); + ODataEntityUpdateRequest getSingletonUpdateRequest( + UpdateType type, ClientSingleton entity); /** * A successful POST request to a navigation property's references collection adds a relationship to an existing diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java index 54999ccae..379935786 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java @@ -21,14 +21,14 @@ package org.apache.olingo.client.api.communication.request.cud; import org.apache.olingo.client.api.communication.request.ODataBasicRequest; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This interface describes an OData create request. * * @param concrete ODataEntity implementation */ -public interface ODataEntityCreateRequest +public interface ODataEntityCreateRequest extends ODataBasicRequest>, ODataBatchableRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java index 2eca16d38..fa51265b4 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityUpdateRequest.java @@ -21,14 +21,14 @@ package org.apache.olingo.client.api.communication.request.cud; import org.apache.olingo.client.api.communication.request.ODataBasicRequest; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements an OData update request. * * @param concrete ODataEntity implementation */ -public interface ODataEntityUpdateRequest +public interface ODataEntityUpdateRequest extends ODataBasicRequest>, ODataBatchableRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ClientNoContent.java similarity index 88% rename from lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java rename to lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ClientNoContent.java index a01d8226d..948570a26 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataNoContent.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ClientNoContent.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.invoke; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; /** * Marker class for invoke with no return type. */ -public class ODataNoContent implements ODataInvokeResult { +public class ClientNoContent implements ClientInvokeResult { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java index 8ffec0c18..cf993f24c 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java @@ -21,8 +21,8 @@ package org.apache.olingo.client.api.communication.request.invoke; import java.net.URI; import java.util.Map; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.FullQualifiedName; public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { @@ -34,7 +34,7 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param functionImportName operation to be invoked * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getFunctionImportInvokeRequest( + ODataInvokeRequest getFunctionImportInvokeRequest( String functionImportName); /** @@ -45,8 +45,8 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param parameters parameters to pass to operation import invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getFunctionImportInvokeRequest( - String functionImportName, Map parameters); + ODataInvokeRequest getFunctionImportInvokeRequest( + String functionImportName, Map parameters); /** * Gets an invoke request instance for the action import with the given name. @@ -55,7 +55,7 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param actionImportName operation to be invoked * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getActionImportInvokeRequest( + ODataInvokeRequest getActionImportInvokeRequest( String actionImportName); /** @@ -66,8 +66,8 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param parameters parameters to pass to operation import invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getActionImportInvokeRequest( - String actionImportName, Map parameters); + ODataInvokeRequest getActionImportInvokeRequest( + String actionImportName, Map parameters); /** * Gets an invoke request instance for the function bound to given URI (no parameters). @@ -79,7 +79,7 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param isBindingParameterCollection whether binding parameter is collection * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getBoundFunctionInvokeRequest( + ODataInvokeRequest getBoundFunctionInvokeRequest( URI bindingParameterURI, FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection); @@ -94,9 +94,9 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param parameters parameters to pass to function invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getBoundFunctionInvokeRequest( + ODataInvokeRequest getBoundFunctionInvokeRequest( URI bindingParameterURI, FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName, - Boolean isBindingParameterCollection, Map parameters); + Boolean isBindingParameterCollection, Map parameters); /** * Gets an invoke request instance for the action bound to given URI (no parameters). @@ -108,7 +108,7 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param isBindingParameterCollection whether binding parameter is collection * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getBoundActionInvokeRequest( + ODataInvokeRequest getBoundActionInvokeRequest( URI bindingParameterURI, FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName, Boolean isBindingParameterCollection); @@ -123,8 +123,8 @@ public interface EdmEnabledInvokeRequestFactory extends InvokeRequestFactory { * @param parameters parameters to pass to function invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getBoundActionInvokeRequest( + ODataInvokeRequest getBoundActionInvokeRequest( URI bindingParameterURI, FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName, - Boolean isBindingParameterCollection, Map parameters); + Boolean isBindingParameterCollection, Map parameters); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java index 71c499d55..247042f98 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java @@ -21,8 +21,8 @@ package org.apache.olingo.client.api.communication.request.invoke; import java.net.URI; import java.util.Map; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.http.HttpMethod; /** @@ -43,8 +43,8 @@ public interface InvokeRequestFactory { * @param parameters parameters to pass to function invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getInvokeRequest( - HttpMethod method, URI uri, Class resultRef, Map parameters); + ODataInvokeRequest getInvokeRequest( + HttpMethod method, URI uri, Class resultRef, Map parameters); /** * Gets an invoke request instance for the function bound to given URI (no parameters). @@ -54,7 +54,7 @@ public interface InvokeRequestFactory { * @param resultRef reference Class for result * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getFunctionInvokeRequest(URI uri, Class resultRef); + ODataInvokeRequest getFunctionInvokeRequest(URI uri, Class resultRef); /** * Gets an invoke request instance for the function bound to given URI (with parameters). @@ -65,8 +65,8 @@ public interface InvokeRequestFactory { * @param parameters parameters to pass to function invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getFunctionInvokeRequest( - URI uri, Class resultRef, Map parameters); + ODataInvokeRequest getFunctionInvokeRequest( + URI uri, Class resultRef, Map parameters); /** * Gets an invoke request instance for the action bound to given URI (no parameters). @@ -76,7 +76,7 @@ public interface InvokeRequestFactory { * @param resultRef reference Class for result * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getActionInvokeRequest(URI uri, Class resultRef); + ODataInvokeRequest getActionInvokeRequest(URI uri, Class resultRef); /** * Gets an invoke request instance for the action bound to given URI (with parameters). @@ -87,6 +87,6 @@ public interface InvokeRequestFactory { * @param parameters parameters to pass to action invocation * @return new {@link ODataInvokeRequest} instance. */ - ODataInvokeRequest getActionInvokeRequest( - URI uri, Class resultRef, Map parameters); + ODataInvokeRequest getActionInvokeRequest( + URI uri, Class resultRef, Map parameters); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java index 696ff23c5..3ff05bb80 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/ODataInvokeRequest.java @@ -22,15 +22,15 @@ import java.util.Map; import org.apache.olingo.client.api.communication.request.ODataBasicRequest; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; /** * This class implements an OData invoke operation request. * * @param the actual invoke result */ -public interface ODataInvokeRequest +public interface ODataInvokeRequest extends ODataBasicRequest> { /** @@ -38,5 +38,5 @@ public interface ODataInvokeRequest * * @param parameters operation parameters. */ - void setParameters(Map parameters); + void setParameters(Map parameters); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataDeltaRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataDeltaRequest.java index e1631a2f3..ea028d358 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataDeltaRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataDeltaRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataDelta; +import org.apache.olingo.commons.api.domain.ClientDelta; /** * Describes an OData retrieve request returning a delta object. */ -public interface ODataDeltaRequest extends ODataRetrieveRequest { +public interface ODataDeltaRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java index bb67ce263..c96e417e5 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * Describes an OData retrieve query request returning a single entity. */ -public interface ODataEntityRequest extends ODataRetrieveRequest { +public interface ODataEntityRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java index 2f0c39367..a00525bb1 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java @@ -19,13 +19,13 @@ package org.apache.olingo.client.api.communication.request.retrieve; import org.apache.olingo.client.api.domain.ODataEntitySetIterator; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; /** * This class implements an OData EntitySet query request. */ -public interface ODataEntitySetIteratorRequest +public interface ODataEntitySetIteratorRequest extends ODataRetrieveRequest> { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java index e78af0172..31accd539 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java @@ -18,13 +18,13 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntitySet; /** * This interface describes an OData EntitySet query request. * * @param concrete ODataEntitySet implementation */ -public interface ODataEntitySetRequest extends ODataRetrieveRequest { +public interface ODataEntitySetRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java index 567ae938b..fd02f03ed 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientProperty; /** * This class implements an OData entity property query request. */ -public interface ODataPropertyRequest extends ODataRetrieveRequest { +public interface ODataPropertyRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java index 96858a866..44d04f958 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataServiceDocumentRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; /** * This class implements an OData service document request. */ -public interface ODataServiceDocumentRequest extends ODataRetrieveRequest { +public interface ODataServiceDocumentRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java index 9324b8fed..2b245910d 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataValueRequest.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.client.api.communication.request.retrieve; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; /** * This class implements an OData entity property value query request. */ -public interface ODataValueRequest extends ODataRetrieveRequest { +public interface ODataValueRequest extends ODataRetrieveRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java index 4d0db79e1..04c5dfb83 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/RetrieveRequestFactory.java @@ -20,10 +20,10 @@ package org.apache.olingo.client.api.communication.request.retrieve; import java.net.URI; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; public interface RetrieveRequestFactory { @@ -63,7 +63,7 @@ public interface RetrieveRequestFactory { * @param uri request URI. * @return new {@link ODataEntitySetRequest} instance. */ - ODataEntitySetRequest getEntitySetRequest(URI uri); + ODataEntitySetRequest getEntitySetRequest(URI uri); /** * Gets a uri request returning a set of one or more OData entities. @@ -74,7 +74,7 @@ public interface RetrieveRequestFactory { * @param uri request URI. * @return new {@link ODataEntitySetIteratorRequest} instance. */ - ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri); + ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri); /** * Gets a uri request returning a single OData entity. @@ -82,7 +82,7 @@ public interface RetrieveRequestFactory { * @param uri request URI. * @return new {@link ODataEntityRequest} instance. */ - ODataEntityRequest getEntityRequest(URI uri); + ODataEntityRequest getEntityRequest(URI uri); /** * Gets a uri request returning a single OData entity property. @@ -90,7 +90,7 @@ public interface RetrieveRequestFactory { * @param uri request URI. * @return new {@link ODataPropertyRequest} instance. */ - ODataPropertyRequest getPropertyRequest(URI uri); + ODataPropertyRequest getPropertyRequest(URI uri); /** * Gets a uri request returning a single OData entity property value. @@ -132,7 +132,7 @@ public interface RetrieveRequestFactory { */ ODataRawRequest getRawRequest(URI uri); - ODataEntityRequest getSingletonRequest(URI uri); + ODataEntityRequest getSingletonRequest(URI uri); ODataDeltaRequest getDeltaRequest(URI uri); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityCreateStreamManager.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityCreateStreamManager.java index eb72494dd..1ef249377 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityCreateStreamManager.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityCreateStreamManager.java @@ -20,14 +20,14 @@ package org.apache.olingo.client.api.communication.request.streamed; import org.apache.olingo.client.api.communication.request.ODataPayloadManager; import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * Media entity payload object. * * @param concrete ODataEntity implementation */ -public interface MediaEntityCreateStreamManager +public interface MediaEntityCreateStreamManager extends ODataPayloadManager> { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityUpdateStreamManager.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityUpdateStreamManager.java index 2619ea9a1..cf4bdd00f 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityUpdateStreamManager.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/MediaEntityUpdateStreamManager.java @@ -20,14 +20,14 @@ package org.apache.olingo.client.api.communication.request.streamed; import org.apache.olingo.client.api.communication.request.ODataPayloadManager; import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * Media entity payload object. * * @param concrete ODataEntity implementation */ -public interface MediaEntityUpdateStreamManager +public interface MediaEntityUpdateStreamManager extends ODataPayloadManager> { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityCreateRequest.java index 8adc8f007..93570e5fe 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityCreateRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityCreateRequest.java @@ -20,14 +20,14 @@ package org.apache.olingo.client.api.communication.request.streamed; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory. * * @param concrete ODataEntity implementation */ -public interface ODataMediaEntityCreateRequest +public interface ODataMediaEntityCreateRequest extends ODataStreamedEntityRequest, MediaEntityCreateStreamManager>, ODataBatchableRequest{ //No additional methods needed for now. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityUpdateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityUpdateRequest.java index 3d4161d5e..e50620cc6 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityUpdateRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataMediaEntityUpdateRequest.java @@ -20,14 +20,14 @@ package org.apache.olingo.client.api.communication.request.streamed; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory. * * @param concrete ODataEntity implementation */ -public interface ODataMediaEntityUpdateRequest +public interface ODataMediaEntityUpdateRequest extends ODataStreamedEntityRequest, MediaEntityUpdateStreamManager>, ODataBatchableRequest { //No additional methods needed for now. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java index c90a25cee..5816e7128 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This interface describes the response to an OData entity create request. @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.domain.ODataEntity; * @param concrete ODataEntity implementation * @see org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest */ -public interface ODataEntityCreateResponse extends ODataResponse { +public interface ODataEntityCreateResponse extends ODataResponse { /** * Gets created object. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java index 2f999bc5e..1f7f86df6 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements the response to an OData update request. @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.domain.ODataEntity; * @param concrete ODataEntity implementation * @see org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest */ -public interface ODataEntityUpdateResponse extends ODataResponse { +public interface ODataEntityUpdateResponse extends ODataResponse { /** * Gets updated object. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java index 9d73d1183..96ae840be 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataInvokeResponse.java @@ -18,14 +18,14 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; /** * This class implements a response to a specific invoke request. * * @param the actual invoke result */ -public interface ODataInvokeResponse extends ODataResponse { +public interface ODataInvokeResponse extends ODataResponse { /** * Gets operation return value if exists. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java index fde5192f9..2b5141d9e 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java @@ -18,14 +18,14 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements the response to an OData media entity create request. * * @param concrete ODataEntity implementation */ -public interface ODataMediaEntityCreateResponse extends ODataResponse { +public interface ODataMediaEntityCreateResponse extends ODataResponse { /** * Gets created object. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java index b267507a3..a22eebd40 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java @@ -18,14 +18,14 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; /** * This class implements the response to an Odata media entity update request. * * @param concrete ODataEntity implementation */ -public interface ODataMediaEntityUpdateResponse extends ODataResponse { +public interface ODataMediaEntityUpdateResponse extends ODataResponse { /** * Gets updated object. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java index ca2ad51da..0739e37e6 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientProperty; /** * This class implements the response to an OData update entity property request. @@ -32,5 +32,5 @@ public interface ODataPropertyUpdateResponse extends ODataResponse { * * @return updated object. */ - ODataProperty getBody(); + ClientProperty getBody(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java index 415ad07f2..c921c4486 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataValueUpdateResponse.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.client.api.communication.response; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; /** * This class implements the response to an OData update entity property request. @@ -32,5 +32,5 @@ public interface ODataValueUpdateResponse extends ODataResponse { * * @return updated object. */ - ODataPrimitiveValue getBody(); + ClientPrimitiveValue getBody(); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java index 082716573..fd8e4e6a6 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java @@ -24,7 +24,7 @@ import java.util.List; /** * REST resource for an ODataServiceDocument. * - * @see org.apache.olingo.commons.api.domain.ODataServiceDocument + * @see org.apache.olingo.commons.api.domain.ClientServiceDocument */ public interface ServiceDocument { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java index 2944471fd..60fd352f3 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java @@ -33,8 +33,8 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.slf4j.Logger; @@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory; * @param concrete ODataEntity implementation * @param concrete ODataEntitySet implementation */ -public class ODataEntitySetIterator +public class ODataEntitySetIterator implements Iterator { /** diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java index 6dc57dd08..9be8744cb 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java @@ -25,12 +25,12 @@ import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; public interface ODataBinder { @@ -40,7 +40,7 @@ public interface ODataBinder { * @param entitySet OData entity set. * @return {@link EntityCollection} object. */ - EntityCollection getEntitySet(ODataEntitySet entitySet); + EntityCollection getEntitySet(ClientEntitySet entitySet); /** * Gets an Entity from the given OData entity. @@ -48,7 +48,7 @@ public interface ODataBinder { * @param entity OData entity. * @return {@link Entity} object. */ - Entity getEntity(ODataEntity entity); + Entity getEntity(ClientEntity entity); /** * Gets a Link from the given OData link. @@ -56,7 +56,7 @@ public interface ODataBinder { * @param link OData link. * @return Link object. */ - Link getLink(ODataLink link); + Link getLink(ClientLink link); /** * Gets a Property from the given OData property. @@ -64,7 +64,7 @@ public interface ODataBinder { * @param property OData property. * @return Property object. */ - Property getProperty(ODataProperty property); + Property getProperty(ClientProperty property); /** * Adds the given property to the given entity. @@ -73,7 +73,7 @@ public interface ODataBinder { * @param property OData property. * @return whether add was successful or not. */ - boolean add(ODataEntity entity, ODataProperty property); + boolean add(ClientEntity entity, ClientProperty property); /** * Gets ODataServiceDocument from the given service document resource. @@ -81,31 +81,31 @@ public interface ODataBinder { * @param resource service document resource. * @return ODataServiceDocument object. */ - ODataServiceDocument getODataServiceDocument(ServiceDocument resource); + ClientServiceDocument getODataServiceDocument(ServiceDocument resource); /** * Gets ODataEntitySet from the given entity set resource. * * @param resource entity set resource. - * @return {@link org.apache.olingo.commons.api.domain.ODataEntitySet} object. + * @return {@link ClientEntitySet} object. */ - ODataEntitySet getODataEntitySet(ResWrap resource); + ClientEntitySet getODataEntitySet(ResWrap resource); /** * Gets ODataEntity from the given entity resource. * * @param resource entity resource. - * @return {@link org.apache.olingo.commons.api.domain.ODataEntity} object. + * @return {@link ClientEntity} object. */ - ODataEntity getODataEntity(ResWrap resource); + ClientEntity getODataEntity(ResWrap resource); /** * Gets an ODataProperty from the given property resource. * * @param resource property resource. - * @return {@link org.apache.olingo.commons.api.domain.ODataProperty} object. + * @return {@link ClientProperty} object. */ - ODataProperty getODataProperty(ResWrap resource); + ClientProperty getODataProperty(ResWrap resource); - ODataDelta getODataDelta(ResWrap resource); + ClientDelta getODataDelta(ResWrap resource); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java index 063467357..8519a6601 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java @@ -22,11 +22,11 @@ import java.io.InputStream; import java.util.Map; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.provider.CsdlSchema; import org.apache.olingo.commons.api.format.ODataFormat; @@ -65,7 +65,7 @@ public interface ODataReader { * @return List of URIs. * @throws ODataDeserializerException */ - ODataServiceDocument readServiceDocument(InputStream input, ODataFormat format) throws ODataDeserializerException; + ClientServiceDocument readServiceDocument(InputStream input, ODataFormat format) throws ODataDeserializerException; /** * De-Serializes a stream into an OData entity set. @@ -75,7 +75,7 @@ public interface ODataReader { * @return de-serialized entity set. * @throws ODataDeserializerException */ - ODataEntitySet readEntitySet(InputStream input, ODataFormat format) throws ODataDeserializerException; + ClientEntitySet readEntitySet(InputStream input, ODataFormat format) throws ODataDeserializerException; /** * Parses a stream taking care to de-serializes the first OData entity found. @@ -85,7 +85,7 @@ public interface ODataReader { * @return entity de-serialized. * @throws ODataDeserializerException */ - ODataEntity readEntity(InputStream input, ODataFormat format) throws ODataDeserializerException; + ClientEntity readEntity(InputStream input, ODataFormat format) throws ODataDeserializerException; /** * Parses a stream taking care to de-serialize the first OData entity property found. @@ -95,7 +95,7 @@ public interface ODataReader { * @return OData entity property de-serialized. * @throws ODataDeserializerException */ - ODataProperty readProperty(InputStream input, ODataFormat format) throws ODataDeserializerException; + ClientProperty readProperty(InputStream input, ODataFormat format) throws ODataDeserializerException; /** * Parses a stream into an OData error. @@ -105,7 +105,7 @@ public interface ODataReader { * @return OData error. * @throws ODataDeserializerException */ - ODataError readError(InputStream inputStream, ODataFormat format) throws ODataDeserializerException; + ClientError readError(InputStream inputStream, ODataFormat format) throws ODataDeserializerException; /** * Parses a stream into the object type specified by the given reference. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java index 1686997f8..81f07a640 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java @@ -23,9 +23,9 @@ import java.net.URI; import java.util.Collection; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientLink; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; @@ -46,7 +46,7 @@ public interface ODataWriter { * @return stream of serialized objects. * @throws ODataSerializerException */ - InputStream writeEntities(Collection entities, ODataFormat format) + InputStream writeEntities(Collection entities, ODataFormat format) throws ODataSerializerException; /** @@ -57,7 +57,7 @@ public interface ODataWriter { * @return stream of serialized object. * @throws ODataSerializerException */ - InputStream writeEntity(ODataEntity entity, ODataFormat format) + InputStream writeEntity(ClientEntity entity, ODataFormat format) throws ODataSerializerException; /** @@ -68,7 +68,7 @@ public interface ODataWriter { * @return stream of serialized object. * @throws ODataSerializerException */ - InputStream writeProperty(ODataProperty property, ODataFormat format) + InputStream writeProperty(ClientProperty property, ODataFormat format) throws ODataSerializerException; /** @@ -79,7 +79,7 @@ public interface ODataWriter { * @return stream of serialized object. * @throws ODataSerializerException */ - InputStream writeLink(ODataLink link, ODataFormat format) + InputStream writeLink(ClientLink link, ODataFormat format) throws ODataSerializerException; /** diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java index e16b0d795..55d416995 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java @@ -47,11 +47,11 @@ import org.apache.olingo.client.core.serialization.ODataReaderImpl; import org.apache.olingo.client.core.serialization.ODataWriterImpl; import org.apache.olingo.client.core.uri.FilterFactoryImpl; import org.apache.olingo.client.core.uri.URIBuilderImpl; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializer; -import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl; +import org.apache.olingo.commons.core.domain.ClientObjectFactoryImpl; import org.apache.olingo.commons.core.serialization.AtomSerializer; import org.apache.olingo.commons.core.serialization.JsonSerializer; @@ -65,7 +65,7 @@ public class ODataClientImpl implements ODataClient { private final ODataBinder binder = new ODataBinderImpl(this); - private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(); + private final ClientObjectFactory objectFactory = new ClientObjectFactoryImpl(); private final AsyncRequestFactory asyncReqFact = new AsyncRequestFactoryImpl(this); @@ -147,7 +147,7 @@ public class ODataClientImpl implements ODataClient { } @Override - public ODataObjectFactory getObjectFactory() { + public ClientObjectFactory getObjectFactory() { return objectFactory; } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java index f1cc64a42..717096dba 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java @@ -25,7 +25,7 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataServerErrorException; import org.apache.olingo.commons.api.ODataRuntimeException; -import org.apache.olingo.commons.api.domain.ODataError; +import org.apache.olingo.commons.api.domain.ClientError; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.slf4j.Logger; @@ -35,8 +35,8 @@ public final class ODataErrorResponseChecker { protected static final Logger LOG = LoggerFactory.getLogger(ODataErrorResponseChecker.class); - private static ODataError getGenericError(final int code, final String errorMsg) { - final ODataError error = new ODataError(); + private static ClientError getGenericError(final int code, final String errorMsg) { + final ClientError error = new ClientError(); error.setCode(String.valueOf(code)); error.setMessage(errorMsg); return error; @@ -53,7 +53,7 @@ public final class ODataErrorResponseChecker { } else { final ODataFormat format = accept.contains("xml") ? ODataFormat.XML : ODataFormat.JSON; - ODataError error; + ClientError error; try { error = odataClient.getReader().readError(entity, format); } catch (final RuntimeException e) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java index 75c307603..be0960ae0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/CUDRequestFactoryImpl.java @@ -38,10 +38,10 @@ import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEn import org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequestImpl; import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; import org.apache.olingo.commons.api.http.HttpMethod; public class CUDRequestFactoryImpl implements CUDRequestFactory { @@ -53,14 +53,14 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { } @Override - public ODataEntityCreateRequest getEntityCreateRequest( + public ODataEntityCreateRequest getEntityCreateRequest( final URI targetURI, final E entity) { return new ODataEntityCreateRequestImpl(client, targetURI, entity); } @Override - public ODataEntityUpdateRequest getEntityUpdateRequest( + public ODataEntityUpdateRequest getEntityUpdateRequest( final URI targetURI, final UpdateType type, final E changes) { final ODataEntityUpdateRequest req; @@ -76,7 +76,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { } @Override - public ODataEntityUpdateRequest getEntityUpdateRequest( + public ODataEntityUpdateRequest getEntityUpdateRequest( final UpdateType type, final E entity) { if (entity.getEditLink() == null) { @@ -97,7 +97,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { @Override public ODataValueUpdateRequest getValueUpdateRequest( - final URI targetURI, final UpdateType type, final ODataPrimitiveValue value) { + final URI targetURI, final UpdateType type, final ClientPrimitiveValue value) { final ODataValueUpdateRequest req; @@ -113,7 +113,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { @Override public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest( - final URI targetURI, final ODataProperty property) { + final URI targetURI, final ClientProperty property) { if (!property.hasPrimitiveValue()) { throw new IllegalArgumentException("A primitive value is required"); @@ -133,7 +133,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { @Override public ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest( - final URI targetURI, final UpdateType type, final ODataProperty property) { + final URI targetURI, final UpdateType type, final ClientProperty property) { if (!property.hasComplexValue()) { throw new IllegalArgumentException("A complex value is required"); @@ -153,7 +153,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { @Override public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest( - final URI targetURI, final ODataProperty property) { + final URI targetURI, final ClientProperty property) { if (!property.hasCollectionValue()) { throw new IllegalArgumentException("A collection value is required"); @@ -186,7 +186,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { } @Override - public ODataMediaEntityCreateRequest getMediaEntityCreateRequest( + public ODataMediaEntityCreateRequest getMediaEntityCreateRequest( final URI targetURI, final InputStream media) { return new ODataMediaEntityCreateRequestImpl(client, targetURI, media); @@ -207,7 +207,7 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { } @Override - public ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( + public ODataMediaEntityUpdateRequest getMediaEntityUpdateRequest( final URI editURI, final InputStream media) { final ODataMediaEntityUpdateRequest req; @@ -223,15 +223,15 @@ public class CUDRequestFactoryImpl implements CUDRequestFactory { } @Override - public ODataEntityUpdateRequest getSingletonUpdateRequest( - final UpdateType type, final ODataSingleton entity) { + public ODataEntityUpdateRequest getSingletonUpdateRequest( + final UpdateType type, final ClientSingleton entity) { return getEntityUpdateRequest(type, entity); } @Override - public ODataEntityUpdateRequest getSingletonUpdateRequest( - final URI targetURI, final UpdateType type, final ODataSingleton changes) { + public ODataEntityUpdateRequest getSingletonUpdateRequest( + final URI targetURI, final UpdateType type, final ClientSingleton changes) { return getEntityUpdateRequest(targetURI, type, changes); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java index 3dc08a4ed..86d5395d8 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java @@ -33,7 +33,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -44,7 +44,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException; * * @param concrete ODataEntity implementation */ -public class ODataEntityCreateRequestImpl +public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest> implements ODataEntityCreateRequest { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java index d40149620..b86e6ae4c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java @@ -34,7 +34,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -45,7 +45,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException; * * @param concrete ODataEntity implementation */ -public class ODataEntityUpdateRequestImpl +public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest> implements ODataEntityUpdateRequest { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java index 50b423c8d..674a34222 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java @@ -33,7 +33,7 @@ import org.apache.olingo.client.core.communication.response.AbstractODataRespons import org.apache.olingo.client.core.uri.URIUtils; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -48,7 +48,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())). diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java index ddff3b91c..a7dfb5f8e 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; @@ -46,7 +46,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest ODataInvokeRequest getFunctionImportInvokeRequest( + public ODataInvokeRequest getFunctionImportInvokeRequest( final String functionImportName) { return getFunctionImportInvokeRequest(functionImportName, null); @@ -54,8 +54,8 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv @Override @SuppressWarnings("unchecked") - public ODataInvokeRequest getFunctionImportInvokeRequest( - final String functionImportName, final Map parameters) { + public ODataInvokeRequest getFunctionImportInvokeRequest( + final String functionImportName, final Map parameters) { EdmFunctionImport efi = null; for (EdmSchema schema : edmClient.getCachedEdm().getSchemas()) { @@ -82,7 +82,7 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv } @Override - public ODataInvokeRequest getActionImportInvokeRequest( + public ODataInvokeRequest getActionImportInvokeRequest( final String actionImportName) { return getActionImportInvokeRequest(actionImportName, null); @@ -90,8 +90,8 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv @Override @SuppressWarnings("unchecked") - public ODataInvokeRequest getActionImportInvokeRequest( - final String actionImportName, final Map parameters) { + public ODataInvokeRequest getActionImportInvokeRequest( + final String actionImportName, final Map parameters) { EdmActionImport eai = null; for (EdmSchema schema : edmClient.getCachedEdm().getSchemas()) { @@ -111,7 +111,7 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv } @Override - public ODataInvokeRequest getBoundFunctionInvokeRequest( + public ODataInvokeRequest getBoundFunctionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName functionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) { @@ -121,10 +121,10 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv @Override @SuppressWarnings("unchecked") - public ODataInvokeRequest getBoundFunctionInvokeRequest( + public ODataInvokeRequest getBoundFunctionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName functionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection, - final Map parameters) { + final Map parameters) { final EdmFunction function = edmClient.getCachedEdm().getBoundFunction( functionName, bindingParameterTypeName, isBindingParameterCollection, @@ -141,7 +141,7 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv } @Override - public ODataInvokeRequest getBoundActionInvokeRequest( + public ODataInvokeRequest getBoundActionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) { @@ -151,10 +151,10 @@ public abstract class AbstractEdmEnabledInvokeRequestFactory extends AbstractInv @Override @SuppressWarnings("unchecked") - public ODataInvokeRequest getBoundActionInvokeRequest( + public ODataInvokeRequest getBoundActionInvokeRequest( final URI bindingParameterURI, final FullQualifiedName actionName, final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection, - final Map parameters) { + final Map parameters) { final EdmAction action = edmClient.getCachedEdm().getBoundAction( actionName, bindingParameterTypeName, isBindingParameterCollection); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java index fdd0f27ea..75ee264d0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractInvokeRequestFactory.java @@ -23,12 +23,12 @@ import java.util.Map; import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmReturnType; import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; import org.apache.olingo.commons.api.http.HttpMethod; @@ -36,46 +36,46 @@ import org.apache.olingo.commons.api.http.HttpMethod; public abstract class AbstractInvokeRequestFactory implements InvokeRequestFactory { @Override - public ODataInvokeRequest getFunctionInvokeRequest( + public ODataInvokeRequest getFunctionInvokeRequest( final URI uri, final Class resultRef) { return getFunctionInvokeRequest(uri, resultRef, null); } @Override - public ODataInvokeRequest getFunctionInvokeRequest( - final URI uri, final Class resultRef, final Map parameters) { + public ODataInvokeRequest getFunctionInvokeRequest( + final URI uri, final Class resultRef, final Map parameters) { return getInvokeRequest(HttpMethod.GET, uri, resultRef, parameters); } @Override - public ODataInvokeRequest getActionInvokeRequest( + public ODataInvokeRequest getActionInvokeRequest( final URI uri, final Class resultRef) { return getActionInvokeRequest(uri, resultRef, null); } @Override - public ODataInvokeRequest getActionInvokeRequest( - final URI uri, final Class resultRef, final Map parameters) { + public ODataInvokeRequest getActionInvokeRequest( + final URI uri, final Class resultRef, final Map parameters) { return getInvokeRequest(HttpMethod.POST, uri, resultRef, parameters); } @SuppressWarnings("unchecked") - protected Class getResultReference(final EdmReturnType returnType) { + protected Class getResultReference(final EdmReturnType returnType) { Class result; if (returnType == null) { - result = (Class) ODataNoContent.class; + result = (Class) ClientNoContent.class; } else { if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { - result = (Class) ODataEntitySet.class; + result = (Class) ClientEntitySet.class; } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) { - result = (Class) ODataEntity.class; + result = (Class) ClientEntity.class; } else { - result = (Class) ODataProperty.class; + result = (Class) ClientProperty.class; } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java index e9801ccc7..2f2616138 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java @@ -32,17 +32,17 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.ODataBatchableRequest; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; +import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest; import org.apache.olingo.client.core.communication.response.AbstractODataResponse; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -51,7 +51,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException; /** * This class implements an OData invoke operation request. */ -public abstract class AbstractODataInvokeRequest +public abstract class AbstractODataInvokeRequest extends AbstractODataBasicRequest> implements ODataInvokeRequest, ODataBatchableRequest { @@ -60,7 +60,7 @@ public abstract class AbstractODataInvokeRequest /** * Function parameters. */ - protected Map parameters; + protected Map parameters; /** * Constructor. @@ -79,11 +79,11 @@ public abstract class AbstractODataInvokeRequest super(odataClient, method, uri); this.reference = reference; - this.parameters = new LinkedHashMap(); + this.parameters = new LinkedHashMap(); } @Override - public void setParameters(final Map parameters) { + public void setParameters(final Map parameters) { this.parameters.clear(); if (parameters != null && !parameters.isEmpty()) { this.parameters.putAll(parameters); @@ -96,7 +96,7 @@ public abstract class AbstractODataInvokeRequest } private String getActualFormat(final ODataFormat format) { - return ((ODataProperty.class.isAssignableFrom(reference) && format == ODataFormat.ATOM) + return ((ClientProperty.class.isAssignableFrom(reference) && format == ODataFormat.ATOM) ? ODataFormat.XML : format).getContentType().toContentTypeString(); } @@ -113,9 +113,9 @@ public abstract class AbstractODataInvokeRequest protected InputStream getPayload() { if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) { // Additional, non-binding parameters MUST be sent as JSON - final ODataEntity tmp = odataClient.getObjectFactory().newEntity(null); - for (Map.Entry param : parameters.entrySet()) { - ODataProperty property = null; + final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null); + for (Map.Entry param : parameters.entrySet()) { + ClientProperty property = null; if (param.getValue().isPrimitive()) { property = odataClient.getObjectFactory(). @@ -190,18 +190,18 @@ public abstract class AbstractODataInvokeRequest public T getBody() { if (invokeResult == null) { try { - if (ODataNoContent.class.isAssignableFrom(reference)) { - invokeResult = reference.cast(new ODataNoContent()); + if (ClientNoContent.class.isAssignableFrom(reference)) { + invokeResult = reference.cast(new ClientNoContent()); } else { // avoid getContent() twice:IllegalStateException: Content has been consumed final InputStream responseStream = this.payload == null ? res.getEntity().getContent() : this.payload; - if (ODataEntitySet.class.isAssignableFrom(reference)) { + if (ClientEntitySet.class.isAssignableFrom(reference)) { invokeResult = reference.cast(odataClient.getReader().readEntitySet(responseStream, ODataFormat.fromString(getContentType()))); - } else if (ODataEntity.class.isAssignableFrom(reference)) { + } else if (ClientEntity.class.isAssignableFrom(reference)) { invokeResult = reference.cast(odataClient.getReader().readEntity(responseStream, ODataFormat.fromString(getContentType()))); - } else if (ODataProperty.class.isAssignableFrom(reference)) { + } else if (ClientProperty.class.isAssignableFrom(reference)) { invokeResult = reference.cast(odataClient.getReader().readProperty(responseStream, ODataFormat.fromString(getContentType()))); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java index 9f1aaae52..27691c5db 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/EdmEnabledInvokeRequestFactoryImpl.java @@ -23,8 +23,8 @@ import java.util.Map; import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.http.HttpMethod; public class EdmEnabledInvokeRequestFactoryImpl extends AbstractEdmEnabledInvokeRequestFactory { @@ -37,9 +37,9 @@ public class EdmEnabledInvokeRequestFactoryImpl extends AbstractEdmEnabledInvoke } @Override - public ODataInvokeRequest getInvokeRequest( + public ODataInvokeRequest getInvokeRequest( final HttpMethod method, final URI uri, final Class resultRef, - final Map parameters) { + final Map parameters) { final ODataInvokeRequest request = new ODataInvokeRequestImpl(edmClient, resultRef, method, uri); if (parameters != null) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java index 315071e8d..7b8506cc8 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/InvokeRequestFactoryImpl.java @@ -23,8 +23,8 @@ import java.util.Map; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.http.HttpMethod; public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory { @@ -36,9 +36,9 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory { } @Override - public ODataInvokeRequest getInvokeRequest( + public ODataInvokeRequest getInvokeRequest( final HttpMethod method, final URI uri, final Class resultRef, - final Map parameters) { + final Map parameters) { final ODataInvokeRequest request = new ODataInvokeRequestImpl(client, resultRef, method, uri); if (parameters != null) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java index ce49d47bb..adf221406 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java @@ -21,11 +21,11 @@ package org.apache.olingo.client.core.communication.request.invoke; import java.net.URI; import org.apache.olingo.client.api.ODataClient; -import org.apache.olingo.commons.api.domain.ODataInvokeResult; +import org.apache.olingo.commons.api.domain.ClientInvokeResult; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.http.HttpMethod; -public class ODataInvokeRequestImpl extends AbstractODataInvokeRequest { +public class ODataInvokeRequestImpl extends AbstractODataInvokeRequest { private ODataFormat format; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java index e01da68d0..4412ef060 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java @@ -29,11 +29,11 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataDelta; +import org.apache.olingo.commons.api.domain.ClientDelta; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; -public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest +public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest implements ODataDeltaRequest { public ODataDeltaRequestImpl(final ODataClient odataClient, final URI query) { @@ -46,14 +46,14 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest execute() { + public ODataRetrieveResponse execute() { final HttpResponse res = doExecute(); return new ODataDeltaResponseImpl(odataClient, httpClient, res); } protected class ODataDeltaResponseImpl extends AbstractODataRetrieveResponse { - private ODataDelta delta = null; + private ClientDelta delta = null; private ODataDeltaResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { @@ -62,7 +62,7 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())). diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java index f247ec944..eec258b1b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java @@ -27,14 +27,14 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; /** * This class implements an OData retrieve query request returning a single entity. */ -public class ODataEntityRequestImpl +public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest implements ODataEntityRequest { /** diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java index 737305beb..04adfb61d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java @@ -26,14 +26,14 @@ import org.apache.olingo.client.api.ODataClient; 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.domain.ODataEntitySetIterator; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; /** * This class implements an OData EntitySet query request. */ -public class ODataEntitySetIteratorRequestImpl +public class ODataEntitySetIteratorRequestImpl extends AbstractODataRetrieveRequest> implements ODataEntitySetIteratorRequest { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java index 20d75b743..44de4c13d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java @@ -27,7 +27,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; * * @param concrete ODataEntitySet implementation */ -public class ODataEntitySetRequestImpl +public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest implements ODataEntitySetRequest { private ES entitySet = null; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java index 07f753b66..91644bf6c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java @@ -29,14 +29,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.client.api.http.HttpClientException; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; /** * This class implements an OData entity property query request. */ -public class ODataPropertyRequestImpl +public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest implements ODataPropertyRequest { /** diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java index ce2f477e6..771525e21 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java @@ -27,14 +27,14 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceD import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; /** * This class implements an OData service document request. */ -public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveRequest +public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveRequest implements ODataServiceDocumentRequest { /** @@ -53,7 +53,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques } @Override - public ODataRetrieveResponse execute() { + public ODataRetrieveResponse execute() { final HttpResponse res = doExecute(); return new ODataServiceResponseImpl(odataClient, httpClient, res); } @@ -63,7 +63,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques */ protected class ODataServiceResponseImpl extends AbstractODataRetrieveResponse { - private ODataServiceDocument serviceDocument = null; + private ClientServiceDocument serviceDocument = null; private ODataServiceResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { @@ -72,7 +72,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques } @Override - public ODataServiceDocument getBody() { + public ClientServiceDocument getBody() { if (serviceDocument == null) { try { final ResWrap resource = odataClient. diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java index ffb2caf4e..e6de8a617 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java @@ -27,14 +27,14 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.http.HttpClientException; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; /** * This class implements an OData entity property value query request. */ -public class ODataValueRequestImpl extends AbstractODataRetrieveRequest +public class ODataValueRequestImpl extends AbstractODataRetrieveRequest implements ODataValueRequest { /** @@ -53,7 +53,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest execute() { + public ODataRetrieveResponse execute() { final HttpResponse res = doExecute(); return new ODataValueResponseImpl(odataClient, httpClient, res); } @@ -63,7 +63,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest getEntitySetRequest(final URI uri) { - return new ODataEntitySetRequestImpl(client, uri); + public ODataEntitySetRequest getEntitySetRequest(final URI uri) { + return new ODataEntitySetRequestImpl(client, uri); } @Override - public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI uri) { - return new ODataEntitySetIteratorRequestImpl(client, uri); + public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI uri) { + return new ODataEntitySetIteratorRequestImpl(client, uri); } @Override - public ODataEntityRequest getSingletonRequest(final URI uri) { - return new ODataEntityRequestImpl(client, uri); + public ODataEntityRequest getSingletonRequest(final URI uri) { + return new ODataEntityRequestImpl(client, uri); } @Override - public ODataEntityRequest getEntityRequest(final URI uri) { - return new ODataEntityRequestImpl(client, uri); + public ODataEntityRequest getEntityRequest(final URI uri) { + return new ODataEntityRequestImpl(client, uri); } @Override - public ODataPropertyRequest getPropertyRequest(final URI uri) { - return new ODataPropertyRequestImpl(client, uri); + public ODataPropertyRequest getPropertyRequest(final URI uri) { + return new ODataPropertyRequestImpl(client, uri); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java index 8f1fedea7..a6bcb1376 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.core.communication.request.AbstractODataStreamMa import org.apache.olingo.client.core.communication.response.AbstractODataResponse; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; * * @param concrete ODataEntity implementation */ -public class ODataMediaEntityCreateRequestImpl +public class ODataMediaEntityCreateRequestImpl extends AbstractODataStreamedEntityRequest, MediaEntityCreateStreamManager> implements ODataMediaEntityCreateRequest { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java index 5e98d4303..d2b287cf6 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.core.communication.request.AbstractODataStreamMa import org.apache.olingo.client.core.communication.response.AbstractODataResponse; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; @@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; * * @param concrete ODataEntity implementation */ -public class ODataMediaEntityUpdateRequestImpl +public class ODataMediaEntityUpdateRequestImpl extends AbstractODataStreamedEntityRequest, MediaEntityUpdateStreamManager> implements ODataMediaEntityUpdateRequest { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java index a668aaf3a..916c360d8 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java @@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataError; +import org.apache.olingo.commons.api.domain.ClientError; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializer; @@ -86,7 +86,7 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer { } @Override - public ODataError toError(final InputStream input) throws ODataDeserializerException { + public ClientError toError(final InputStream input) throws ODataDeserializerException { return deserializer.toError(input); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java index 25b405a11..f38d795bf 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java @@ -48,25 +48,25 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataAnnotatable; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataDeletedEntity.Reason; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataDeltaLink; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataLinked; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotatable; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientDeletedEntity.Reason; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientDeltaLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientLinked; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; +import org.apache.olingo.commons.api.domain.ClientValuable; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmBindingTarget; import org.apache.olingo.commons.api.edm.EdmComplexType; @@ -87,10 +87,10 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.geo.Geospatial; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; -import org.apache.olingo.commons.core.domain.ODataAnnotationImpl; -import org.apache.olingo.commons.core.domain.ODataDeletedEntityImpl; -import org.apache.olingo.commons.core.domain.ODataDeltaLinkImpl; -import org.apache.olingo.commons.core.domain.ODataPropertyImpl; +import org.apache.olingo.commons.core.domain.ClientAnnotationImpl; +import org.apache.olingo.commons.core.domain.ClientDeletedEntityImpl; +import org.apache.olingo.commons.core.domain.ClientDeltaLinkImpl; +import org.apache.olingo.commons.core.domain.ClientPropertyImpl; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.commons.core.serialization.ContextURLParser; @@ -111,17 +111,17 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public boolean add(final ODataEntity entity, final ODataProperty property) { + public boolean add(final ClientEntity entity, final ClientProperty property) { return entity.getProperties().add(property); } - protected boolean add(final ODataEntitySet entitySet, final ODataEntity entity) { + protected boolean add(final ClientEntitySet entitySet, final ClientEntity entity) { return entitySet.getEntities().add(entity); } @Override - public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) { - final ODataServiceDocument serviceDocument = new ODataServiceDocument(); + public ClientServiceDocument getODataServiceDocument(final ServiceDocument resource) { + final ClientServiceDocument serviceDocument = new ClientServiceDocument(); for (ServiceDocumentItem entitySet : resource.getEntitySets()) { serviceDocument.getEntitySets(). @@ -146,7 +146,7 @@ public class ODataBinderImpl implements ODataBinder { return serviceDocument; } - private void updateValuable(final Valuable propertyResource, final ODataValuable odataValuable) { + private void updateValuable(final Valuable propertyResource, final ClientValuable odataValuable) { final Object propertyValue = getValue(odataValuable.getValue()); if (odataValuable.hasPrimitiveValue()) { propertyResource.setType(odataValuable.getPrimitiveValue().getTypeName()); @@ -160,10 +160,10 @@ public class ODataBinderImpl implements ODataBinder { propertyResource.setType(odataValuable.getComplexValue().getTypeName()); propertyResource.setValue(ValueType.COMPLEX, propertyValue); } else if (odataValuable.hasCollectionValue()) { - final ODataCollectionValue collectionValue = + final ClientCollectionValue collectionValue = odataValuable.getCollectionValue(); propertyResource.setType(collectionValue.getTypeName()); - final ODataValue value = collectionValue.iterator().hasNext() ? collectionValue.iterator().next() : null; + final ClientValue value = collectionValue.iterator().hasNext() ? collectionValue.iterator().next() : null; ValueType valueType = ValueType.COLLECTION_PRIMITIVE; if (value == null) { valueType = ValueType.COLLECTION_PRIMITIVE; @@ -179,8 +179,8 @@ public class ODataBinderImpl implements ODataBinder { } } - private void annotations(final ODataAnnotatable odataAnnotatable, final Annotatable annotatable) { - for (ODataAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { + private void annotations(final ClientAnnotatable odataAnnotatable, final Annotatable annotatable) { + for (ClientAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { final Annotation annotation = new Annotation(); annotation.setTerm(odataAnnotation.getTerm()); @@ -192,7 +192,7 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public EntityCollection getEntitySet(final ODataEntitySet odataEntitySet) { + public EntityCollection getEntitySet(final ClientEntitySet odataEntitySet) { final EntityCollection entitySet = new EntityCollection(); entitySet.setCount(odataEntitySet.getCount()); @@ -202,7 +202,7 @@ public class ODataBinderImpl implements ODataBinder { entitySet.setNext(next); } - for (ODataEntity entity : odataEntitySet.getEntities()) { + for (ClientEntity entity : odataEntitySet.getEntities()) { entitySet.getEntities().add(getEntity(entity)); } @@ -211,12 +211,12 @@ public class ODataBinderImpl implements ODataBinder { return entitySet; } - protected void links(final ODataLinked odataLinked, final Linked linked) { + protected void links(final ClientLinked odataLinked, final Linked linked) { // ------------------------------------------------------------- // Append navigation links (handling inline entity / entity set as well) // ------------------------------------------------------------- // handle navigation links - for (ODataLink link : odataLinked.getNavigationLinks()) { + for (ClientLink link : odataLinked.getNavigationLinks()) { // append link LOG.debug("Append navigation link\n{}", link); linked.getNavigationLinks().add(getLink(link)); @@ -226,22 +226,22 @@ public class ODataBinderImpl implements ODataBinder { // ------------------------------------------------------------- // Append association links // ------------------------------------------------------------- - for (ODataLink link : odataLinked.getAssociationLinks()) { + for (ClientLink link : odataLinked.getAssociationLinks()) { LOG.debug("Append association link\n{}", link); linked.getAssociationLinks().add(getLink(link)); } // ------------------------------------------------------------- for (Link link : linked.getNavigationLinks()) { - final ODataLink odataLink = odataLinked.getNavigationLink(link.getTitle()); - if (!(odataLink instanceof ODataInlineEntity) && !(odataLink instanceof ODataInlineEntitySet)) { + final ClientLink odataLink = odataLinked.getNavigationLink(link.getTitle()); + if (!(odataLink instanceof ClientInlineEntity) && !(odataLink instanceof ClientInlineEntitySet)) { annotations(odataLink, link); } } } @Override - public Entity getEntity(final ODataEntity odataEntity) { + public Entity getEntity(final ClientEntity odataEntity) { final Entity entity = new Entity(); entity.setType(odataEntity.getTypeName() == null ? null : odataEntity.getTypeName().toString()); @@ -272,7 +272,7 @@ public class ODataBinderImpl implements ODataBinder { // ------------------------------------------------------------- // Append edit-media links // ------------------------------------------------------------- - for (ODataLink link : odataEntity.getMediaEditLinks()) { + for (ClientLink link : odataEntity.getMediaEditLinks()) { LOG.debug("Append edit-media link\n{}", link); entity.getMediaEditLinks().add(getLink(link)); } @@ -284,7 +284,7 @@ public class ODataBinderImpl implements ODataBinder { entity.setMediaETag(odataEntity.getMediaETag()); } - for (ODataProperty property : odataEntity.getProperties()) { + for (ClientProperty property : odataEntity.getProperties()) { entity.getProperties().add(getProperty(property)); } @@ -294,7 +294,7 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public Link getLink(final ODataLink link) { + public Link getLink(final ClientLink link) { final Link linkResource = new Link(); linkResource.setRel(link.getRel()); linkResource.setTitle(link.getName()); @@ -302,15 +302,15 @@ public class ODataBinderImpl implements ODataBinder { linkResource.setType(link.getType().toString()); linkResource.setMediaETag(link.getMediaETag()); - if (link instanceof ODataInlineEntity) { + if (link instanceof ClientInlineEntity) { // append inline entity - final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity(); + final ClientEntity inlineEntity = ((ClientInlineEntity) link).getEntity(); LOG.debug("Append in-line entity\n{}", inlineEntity); linkResource.setInlineEntity(getEntity(inlineEntity)); - } else if (link instanceof ODataInlineEntitySet) { + } else if (link instanceof ClientInlineEntitySet) { // append inline entity set - final ODataEntitySet InlineEntitySet = ((ODataInlineEntitySet) link).getEntitySet(); + final ClientEntitySet InlineEntitySet = ((ClientInlineEntitySet) link).getEntitySet(); LOG.debug("Append in-line entity set\n{}", InlineEntitySet); linkResource.setInlineEntitySet(getEntitySet(InlineEntitySet)); @@ -320,7 +320,7 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public Property getProperty(final ODataProperty property) { + public Property getProperty(final ClientProperty property) { final Property propertyResource = new Property(); propertyResource.setName(property.getName()); @@ -330,7 +330,7 @@ public class ODataBinderImpl implements ODataBinder { return propertyResource; } - protected Object getValue(final ODataValue value) { + protected Object getValue(final ClientValue value) { Object valueResource = null; if (value == null) { return null; @@ -341,7 +341,7 @@ public class ODataBinderImpl implements ODataBinder { valueResource = value.asPrimitive().toValue(); } else if (value.isComplex()) { List complexProperties = new ArrayList(); - for (final ODataProperty propertyValue : value.asComplex()) { + for (final ClientProperty propertyValue : value.asComplex()) { complexProperties.add(getProperty(propertyValue)); } final ComplexValue lcValueResource = new ComplexValue(); @@ -351,10 +351,10 @@ public class ODataBinderImpl implements ODataBinder { valueResource = lcValueResource; } else if (value.isCollection()) { - final ODataCollectionValue _value = value.asCollection(); + final ClientCollectionValue _value = value.asCollection(); ArrayList lcValueResource = new ArrayList(); - for (final ODataValue collectionValue : _value) { + for (final ClientValue collectionValue : _value) { lcValueResource.add(getValue(collectionValue)); } valueResource = lcValueResource; @@ -362,7 +362,7 @@ public class ODataBinderImpl implements ODataBinder { return valueResource; } - private void odataAnnotations(final Annotatable annotatable, final ODataAnnotatable odataAnnotatable) { + private void odataAnnotations(final Annotatable annotatable, final ClientAnnotatable odataAnnotatable) { for (Annotation annotation : annotatable.getAnnotations()) { FullQualifiedName fqn = null; if (client instanceof EdmEnabledODataClient) { @@ -380,14 +380,14 @@ public class ODataBinderImpl implements ODataBinder { } } - final ODataAnnotation odataAnnotation = - new ODataAnnotationImpl(annotation.getTerm(), getODataValue(fqn, annotation, null, null)); + final ClientAnnotation odataAnnotation = + new ClientAnnotationImpl(annotation.getTerm(), getODataValue(fqn, annotation, null, null)); odataAnnotatable.getAnnotations().add(odataAnnotation); } } @Override - public ODataEntitySet getODataEntitySet(final ResWrap resource) { + public ClientEntitySet getODataEntitySet(final ResWrap resource) { if (LOG.isDebugEnabled()) { final StringWriter writer = new StringWriter(); try { @@ -405,7 +405,7 @@ public class ODataBinderImpl implements ODataBinder { final URI next = resource.getPayload().getNext(); - final ODataEntitySet entitySet = next == null + final ClientEntitySet entitySet = next == null ? client.getObjectFactory().newEntitySet() : client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString())); @@ -427,29 +427,29 @@ public class ODataBinderImpl implements ODataBinder { } protected void odataNavigationLinks(final EdmType edmType, - final Linked linked, final ODataLinked odataLinked, final String metadataETag, final URI base) { + final Linked linked, final ClientLinked odataLinked, final String metadataETag, final URI base) { for (Link link : linked.getNavigationLinks()) { final String href = link.getHref(); final String title = link.getTitle(); final Entity inlineEntity = link.getInlineEntity(); final EntityCollection inlineEntitySet = link.getInlineEntitySet(); if (inlineEntity == null && inlineEntitySet == null) { - ODataLinkType linkType = null; + ClientLinkType linkType = null; if (edmType instanceof EdmStructuredType) { final EdmNavigationProperty navProp = ((EdmStructuredType) edmType).getNavigationProperty(title); if (navProp != null) { linkType = navProp.isCollection() ? - ODataLinkType.ENTITY_SET_NAVIGATION : - ODataLinkType.ENTITY_NAVIGATION; + ClientLinkType.ENTITY_SET_NAVIGATION : + ClientLinkType.ENTITY_NAVIGATION; } } if (linkType == null) { linkType = link.getType() == null ? - ODataLinkType.ENTITY_NAVIGATION : - ODataLinkType.fromString(link.getRel(), link.getType()); + ClientLinkType.ENTITY_NAVIGATION : + ClientLinkType.fromString(link.getRel(), link.getType()); } - odataLinked.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION ? + odataLinked.addLink(linkType == ClientLinkType.ENTITY_NAVIGATION ? client.getObjectFactory().newEntityNavigationLink(title, URIUtils.getURI(base, href)) : client.getObjectFactory().newEntitySetNavigationLink(title, URIUtils.getURI(base, href))); } else if (inlineEntity != null) { @@ -461,24 +461,24 @@ public class ODataBinderImpl implements ODataBinder { } } - for (ODataLink link : odataLinked.getNavigationLinks()) { - if (!(link instanceof ODataInlineEntity) && !(link instanceof ODataInlineEntitySet)) { + for (ClientLink link : odataLinked.getNavigationLinks()) { + if (!(link instanceof ClientInlineEntity) && !(link instanceof ClientInlineEntitySet)) { odataAnnotations(linked.getNavigationLink(link.getName()), link); } } } - private ODataInlineEntity createODataInlineEntity(final Entity inlineEntity, + private ClientInlineEntity createODataInlineEntity(final Entity inlineEntity, final URI uri, final String title, final String metadataETag) { - return new ODataInlineEntity(uri, ODataLinkType.ENTITY_NAVIGATION, title, + return new ClientInlineEntity(uri, ClientLinkType.ENTITY_NAVIGATION, title, getODataEntity(new ResWrap( inlineEntity.getBaseURI() == null ? null : inlineEntity.getBaseURI(), metadataETag, inlineEntity))); } - private ODataInlineEntitySet createODataInlineEntitySet(final EntityCollection inlineEntitySet, + private ClientInlineEntitySet createODataInlineEntitySet(final EntityCollection inlineEntitySet, final URI uri, final String title, final String metadataETag) { - return new ODataInlineEntitySet(uri, ODataLinkType.ENTITY_SET_NAVIGATION, title, + return new ClientInlineEntitySet(uri, ClientLinkType.ENTITY_SET_NAVIGATION, title, getODataEntitySet(new ResWrap( inlineEntitySet.getBaseURI() == null ? null : inlineEntitySet.getBaseURI(), metadataETag, inlineEntitySet))); @@ -565,7 +565,7 @@ public class ODataBinderImpl implements ODataBinder { return type; } - private ODataLink createLinkFromNavigationProperty(final Property property, final String propertyTypeName) { + private ClientLink createLinkFromNavigationProperty(final Property property, final String propertyTypeName) { if (property.isCollection()) { EntityCollection inlineEntitySet = new EntityCollection(); for (final Object inlined : property.asCollection()) { @@ -584,7 +584,7 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public ODataEntity getODataEntity(final ResWrap resource) { + public ClientEntity getODataEntity(final ResWrap resource) { if (LOG.isDebugEnabled()) { final StringWriter writer = new StringWriter(); try { @@ -610,7 +610,7 @@ public class ODataBinderImpl implements ODataBinder { typeName = new FullQualifiedName(resource.getPayload().getType()); } - final ODataEntity entity = resource.getPayload().getSelfLink() == null + final ClientEntity entity = resource.getPayload().getSelfLink() == null ? client.getObjectFactory().newEntity(typeName) : client.getObjectFactory().newEntity(typeName, URIUtils.getURI(base, resource.getPayload().getSelfLink().getHref())); @@ -635,7 +635,7 @@ public class ODataBinderImpl implements ODataBinder { newMediaEditLink(link.getTitle(), URIUtils.getURI(base, link.getHref()))); } - for (ODataOperation operation : resource.getPayload().getOperations()) { + for (ClientOperation operation : resource.getPayload().getOperations()) { operation.setTarget(URIUtils.getURI(base, operation.getTarget())); entity.getOperations().add(operation); } @@ -670,12 +670,12 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public ODataProperty getODataProperty(final ResWrap resource) { + public ClientProperty getODataProperty(final ResWrap resource) { final Property payload = resource.getPayload(); final EdmTypeInfo typeInfo = buildTypeInfo(ContextURLParser.parse(resource.getContextURL()), resource.getMetadataETag(), payload.getName(), payload.getType()); - final ODataProperty property = new ODataPropertyImpl(payload.getName(), + final ClientProperty property = new ClientPropertyImpl(payload.getName(), getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(), payload, resource.getContextURL(), resource.getMetadataETag())); odataAnnotations(payload, property); @@ -717,10 +717,10 @@ public class ODataBinderImpl implements ODataBinder { return typeInfo; } - protected ODataProperty getODataProperty(final EdmType type, final Property resource) { + protected ClientProperty getODataProperty(final EdmType type, final Property resource) { final EdmTypeInfo typeInfo = buildTypeInfo(type == null ? null : type.getFullQualifiedName(), resource.getType()); - final ODataProperty property = new ODataPropertyImpl(resource.getName(), + final ClientProperty property = new ClientPropertyImpl(resource.getName(), getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(), resource, null, null)); odataAnnotations(resource, property); @@ -728,7 +728,7 @@ public class ODataBinderImpl implements ODataBinder { return property; } - protected ODataValue getODataValue(final FullQualifiedName type, + protected ClientValue getODataValue(final FullQualifiedName type, final Valuable valuable, final URI contextURL, final String metadataETag) { // fixes enum values treated as primitive when no type information is available @@ -739,7 +739,7 @@ public class ODataBinderImpl implements ODataBinder { } } - ODataValue value = null; + ClientValue value = null; if (valuable.isCollection()) { value = client.getObjectFactory().newCollectionValue(type == null ? null : "Collection(" + type.toString() + ")"); @@ -753,7 +753,7 @@ public class ODataBinderImpl implements ODataBinder { value = client.getObjectFactory().newEnumValue(type == null ? null : type.toString(), valuable.asEnum().toString()); } else if (valuable.isComplex()) { - final ODataComplexValue lcValue = + final ClientComplexValue lcValue = client.getObjectFactory().newComplexValue(type == null ? null : type.toString()); EdmComplexType edmType = null; @@ -813,7 +813,7 @@ public class ODataBinderImpl implements ODataBinder { : EdmPrimitiveTypeKind.valueOfFQN(type.toString())). build(); } else if (valuable.isComplex()) { - final ODataComplexValue cValue = + final ClientComplexValue cValue = client.getObjectFactory().newComplexValue(type == null ? null : type.toString()); if (!valuable.isNull()) { @@ -843,14 +843,14 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public ODataDelta getODataDelta(final ResWrap resource) { + public ClientDelta getODataDelta(final ResWrap resource) { final URI base = resource.getContextURL() == null ? resource.getPayload().getBaseURI() : ContextURLParser.parse(resource.getContextURL()).getServiceRoot(); final URI next = resource.getPayload().getNext(); - final ODataDelta delta = next == null + final ClientDelta delta = next == null ? client.getObjectFactory().newDelta() : client.getObjectFactory().newDelta(URIUtils.getURI(base, next.toASCIIString())); @@ -867,7 +867,7 @@ public class ODataBinderImpl implements ODataBinder { new ResWrap(resource.getContextURL(), resource.getMetadataETag(), entityResource))); } for (DeletedEntity deletedEntity : resource.getPayload().getDeletedEntities()) { - final ODataDeletedEntityImpl impl = new ODataDeletedEntityImpl(); + final ClientDeletedEntityImpl impl = new ClientDeletedEntityImpl(); impl.setId(URIUtils.getURI(base, deletedEntity.getId())); impl.setReason(Reason.valueOf(deletedEntity.getReason().name())); @@ -877,7 +877,7 @@ public class ODataBinderImpl implements ODataBinder { odataAnnotations(resource.getPayload(), delta); for (DeltaLink link : resource.getPayload().getAddedLinks()) { - final ODataDeltaLink impl = new ODataDeltaLinkImpl(); + final ClientDeltaLink impl = new ClientDeltaLinkImpl(); impl.setRelationship(link.getRelationship()); impl.setSource(URIUtils.getURI(base, link.getSource())); impl.setTarget(URIUtils.getURI(base, link.getTarget())); @@ -887,7 +887,7 @@ public class ODataBinderImpl implements ODataBinder { delta.getAddedLinks().add(impl); } for (DeltaLink link : resource.getPayload().getDeletedLinks()) { - final ODataDeltaLink impl = new ODataDeltaLinkImpl(); + final ClientDeltaLink impl = new ClientDeltaLinkImpl(); impl.setRelationship(link.getRelationship()); impl.setSource(URIUtils.getURI(base, link.getSource())); impl.setTarget(URIUtils.getURI(base, link.getTarget())); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java index c0af3af4e..80972befb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java @@ -33,12 +33,12 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.provider.CsdlSchema; @@ -73,14 +73,14 @@ public class ODataReaderImpl implements ODataReader { } @Override - public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) + public ClientServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) throws ODataDeserializerException { return client.getBinder().getODataServiceDocument( client.getDeserializer(format).toServiceDocument(input).getPayload()); } @Override - public ODataError readError(final InputStream inputStream, final ODataFormat format) + public ClientError readError(final InputStream inputStream, final ODataFormat format) throws ODataDeserializerException { return client.getDeserializer(format).toError(inputStream); } @@ -95,28 +95,28 @@ public class ODataReaderImpl implements ODataReader { res = new ResWrap( (URI) null, null, - reference.cast(new ODataEntitySetIterator( + reference.cast(new ODataEntitySetIterator( client, src, ODataFormat.fromString(format)))); - } else if (ODataEntitySet.class.isAssignableFrom(reference)) { + } else if (ClientEntitySet.class.isAssignableFrom(reference)) { final ResWrap resource = client.getDeserializer(ODataFormat.fromString(format)) .toEntitySet(src); res = new ResWrap( resource.getContextURL(), resource.getMetadataETag(), reference.cast(client.getBinder().getODataEntitySet(resource))); - } else if (ODataEntity.class.isAssignableFrom(reference)) { + } else if (ClientEntity.class.isAssignableFrom(reference)) { final ResWrap container = client.getDeserializer(ODataFormat.fromString(format)).toEntity(src); res = new ResWrap( container.getContextURL(), container.getMetadataETag(), reference.cast(client.getBinder().getODataEntity(container))); - } else if (ODataProperty.class.isAssignableFrom(reference)) { + } else if (ClientProperty.class.isAssignableFrom(reference)) { final ResWrap container = client.getDeserializer(ODataFormat.fromString(format)).toProperty(src); res = new ResWrap( container.getContextURL(), container.getMetadataETag(), reference.cast(client.getBinder().getODataProperty(container))); - } else if (ODataValue.class.isAssignableFrom(reference)) { + } else if (ClientValue.class.isAssignableFrom(reference)) { res = new ResWrap( (URI) null, null, @@ -130,14 +130,14 @@ public class ODataReaderImpl implements ODataReader { (URI) null, null, reference.cast(readMetadata(src))); - } else if (ODataServiceDocument.class.isAssignableFrom(reference)) { + } else if (ClientServiceDocument.class.isAssignableFrom(reference)) { final ResWrap resource = client.getDeserializer(ODataFormat.fromString(format)).toServiceDocument(src); res = new ResWrap( resource.getContextURL(), resource.getMetadataETag(), reference.cast(client.getBinder().getODataServiceDocument(resource.getPayload()))); - } else if (ODataError.class.isAssignableFrom(reference)) { + } else if (ClientError.class.isAssignableFrom(reference)) { res = new ResWrap( (URI) null, null, @@ -158,19 +158,19 @@ public class ODataReaderImpl implements ODataReader { } @Override - public ODataEntitySet readEntitySet(final InputStream input, final ODataFormat format) + public ClientEntitySet readEntitySet(final InputStream input, final ODataFormat format) throws ODataDeserializerException { return client.getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input)); } @Override - public ODataEntity readEntity(final InputStream input, final ODataFormat format) + public ClientEntity readEntity(final InputStream input, final ODataFormat format) throws ODataDeserializerException { return client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input)); } @Override - public ODataProperty readProperty(final InputStream input, final ODataFormat format) + public ClientProperty readProperty(final InputStream input, final ODataFormat format) throws ODataDeserializerException { return client.getBinder().getODataProperty(client.getDeserializer(format).toProperty(input)); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java index b28b692f5..81918865d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java @@ -32,9 +32,9 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.serialization.ODataWriter; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; @@ -47,7 +47,7 @@ public class ODataWriterImpl implements ODataWriter { } @Override - public InputStream writeEntities(final Collection entities, final ODataFormat format) + public InputStream writeEntities(final Collection entities, final ODataFormat format) throws ODataSerializerException { ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStreamWriter writer; @@ -57,7 +57,7 @@ public class ODataWriterImpl implements ODataWriter { writer = null; } try { - for (ODataEntity entity : entities) { + for (ClientEntity entity : entities) { client.getSerializer(format).write(writer, client.getBinder().getEntity(entity)); } @@ -68,13 +68,13 @@ public class ODataWriterImpl implements ODataWriter { } @Override - public InputStream writeEntity(final ODataEntity entity, final ODataFormat format) + public InputStream writeEntity(final ClientEntity entity, final ODataFormat format) throws ODataSerializerException { - return writeEntities(Collections.singleton(entity), format); + return writeEntities(Collections.singleton(entity), format); } @Override - public InputStream writeProperty(final ODataProperty property, final ODataFormat format) + public InputStream writeProperty(final ClientProperty property, final ODataFormat format) throws ODataSerializerException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStreamWriter writer; @@ -93,7 +93,7 @@ public class ODataWriterImpl implements ODataWriter { } @Override - public InputStream writeLink(final ODataLink link, final ODataFormat format) throws ODataSerializerException { + public InputStream writeLink(final ClientLink link, final ODataFormat format) throws ODataSerializerException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStreamWriter writer; try { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java index 608dc3a38..e1ac9c19b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java @@ -50,7 +50,7 @@ import org.apache.olingo.client.api.http.WrappingHttpClientFactory; import org.apache.olingo.client.api.uri.SegmentType; import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.geo.Geospatial; import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary; @@ -331,7 +331,7 @@ public final class URIUtils { return res; } - public static URI buildFunctionInvokeURI(final URI uri, final Map parameters) { + public static URI buildFunctionInvokeURI(final URI uri, final Map parameters) { final String rawQuery = uri.getRawQuery(); String baseURI = StringUtils.substringBefore(uri.toASCIIString(), "?" + rawQuery); if (baseURI.endsWith("()")) { @@ -339,7 +339,7 @@ public final class URIUtils { } final StringBuilder inlineParams = new StringBuilder(); - for (Map.Entry param : parameters.entrySet()) { + for (Map.Entry param : parameters.entrySet()) { inlineParams.append(param.getKey()).append("="); Object value = null; diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java index 5d5671a75..873b946c4 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java @@ -22,8 +22,8 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.AbstractTest; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.junit.Test; @@ -45,14 +45,14 @@ public class EntitySetTest extends AbstractTest { private void read(final ODataFormat format) throws IOException, ODataDeserializerException { final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format)); - final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet( + final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet( getClient().getDeserializer(format).toEntitySet(input)); assertNotNull(entitySet); assertEquals(2, entitySet.getEntities().size()); assertNull(entitySet.getNext()); - final ODataEntitySet written = + final ClientEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, getClient().getBinder().getEntitySet(entitySet))); assertEquals(entitySet, written); @@ -70,16 +70,16 @@ public class EntitySetTest extends AbstractTest { private void ref(final ODataFormat format) throws ODataDeserializerException { final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format)); - final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet( + final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet( getClient().getDeserializer(format).toEntitySet(input)); assertNotNull(entitySet); - for (ODataEntity entity : entitySet.getEntities()) { + for (ClientEntity entity : entitySet.getEntities()) { assertNotNull(entity.getId()); } entitySet.setCount(entitySet.getEntities().size()); - final ODataEntitySet written = + final ClientEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, getClient().getBinder().getEntitySet(entitySet))); assertEquals(entitySet, written); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java index 99358703a..de35c0219 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java @@ -33,15 +33,15 @@ import org.apache.olingo.client.core.AbstractTest; import org.apache.olingo.client.core.EdmEnabledODataClientImpl; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValuable; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; @@ -80,35 +80,35 @@ public class EntityTest extends AbstractTest { private void singleton(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); - final ODataProperty birthday = entity.getProperty("Birthday"); + final ClientProperty birthday = entity.getProperty("Birthday"); assertTrue(birthday.hasPrimitiveValue()); assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType()); - final ODataProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders"); + final ClientProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders"); assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue()); assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType()); int checked = 0; - for (ODataLink link : entity.getNavigationLinks()) { + for (ClientLink link : entity.getNavigationLinks()) { if ("Parent".equals(link.getName())) { checked++; - assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType()); + assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType()); } if ("Orders".equals(link.getName())) { checked++; if (format == ODataFormat.ATOM) { - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, link.getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType()); } } if ("Company".equals(link.getName())) { checked++; - assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType()); + assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType()); } } assertEquals(3, checked); @@ -121,7 +121,7 @@ public class EntityTest extends AbstractTest { // operations won't get serialized entity.getOperations().clear(); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -139,25 +139,25 @@ public class EntityTest extends AbstractTest { private void withEnums(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); - final ODataProperty skinColor = entity.getProperty("SkinColor"); + final ClientProperty skinColor = entity.getProperty("SkinColor"); assertTrue(skinColor.hasEnumValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName()); assertEquals("Red", skinColor.getEnumValue().getValue()); - final ODataProperty coverColors = entity.getProperty("CoverColors"); + final ClientProperty coverColors = entity.getProperty("CoverColors"); assertTrue(coverColors.hasCollectionValue()); - for (final Iterator itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) { - final ODataValue item = itor.next(); + for (final Iterator itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) { + final ClientValue item = itor.next(); assertTrue(item.isEnum()); } // operations won't get serialized entity.getOperations().clear(); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -176,15 +176,15 @@ public class EntityTest extends AbstractTest { private void withInlineEntitySet(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream( "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); - final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments"); + final ClientLink instruments = entity.getNavigationLink("MyPaymentInstruments"); assertNotNull(instruments); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, instruments.getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, instruments.getType()); - final ODataInlineEntitySet inline = instruments.asInlineEntitySet(); + final ClientInlineEntitySet inline = instruments.asInlineEntitySet(); assertNotNull(inline); assertEquals(3, inline.getEntitySet().getEntities().size()); @@ -192,7 +192,7 @@ public class EntityTest extends AbstractTest { inline.getEntitySet().setCount(3); // operations won't get serialized entity.getOperations().clear(); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -211,7 +211,7 @@ public class EntityTest extends AbstractTest { private void mediaEntity(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream( "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); @@ -219,7 +219,7 @@ public class EntityTest extends AbstractTest { assertNotNull(entity.getMediaContentSource()); assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag()); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -237,16 +237,16 @@ public class EntityTest extends AbstractTest { private void withStream(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); assertFalse(entity.isMediaEntity()); - final ODataLink editMedia = entity.getMediaEditLink("Photo"); + final ClientLink editMedia = entity.getMediaEditLink("Photo"); assertNotNull(editMedia); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -264,13 +264,13 @@ public class EntityTest extends AbstractTest { private void ref(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); assertNotNull(entity.getId()); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -288,17 +288,17 @@ public class EntityTest extends AbstractTest { private void complexNavigationProperties(final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); - final ODataComplexValue addressValue = entity.getProperty("Address").getComplexValue(); + final ClientComplexValue addressValue = entity.getProperty("Address").getComplexValue(); assertNotNull(addressValue); assertNotNull(addressValue.getNavigationLink("Country")); // ETag is not serialized entity.setETag(null); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -316,13 +316,13 @@ public class EntityTest extends AbstractTest { private void annotated(final ODataFormat format) throws EdmPrimitiveTypeException, Exception { final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(format)); - final ODataEntity entity = getClient().getBinder().getODataEntity( + final ClientEntity entity = getClient().getBinder().getODataEntity( getClient().getDeserializer(format).toEntity(input)); assertNotNull(entity); assertFalse(entity.getAnnotations().isEmpty()); - ODataAnnotation annotation = entity.getAnnotations().get(0); + ClientAnnotation annotation = entity.getAnnotations().get(0); assertEquals("com.contoso.display.highlight", annotation.getTerm()); assertEquals(true, annotation.getPrimitiveValue().toCastValue(Boolean.class)); @@ -334,7 +334,7 @@ public class EntityTest extends AbstractTest { assertEquals("com.contoso.display.style", annotation.getTerm()); assertTrue(annotation.hasComplexValue()); - final ODataLink orders = entity.getNavigationLink("Orders"); + final ClientLink orders = entity.getNavigationLink("Orders"); assertFalse(orders.getAnnotations().isEmpty()); annotation = orders.getAnnotations().get(0); @@ -344,7 +344,7 @@ public class EntityTest extends AbstractTest { assertEquals(2, annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataEntity written = getClient().getBinder().getODataEntity( + final ClientEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder().getEntity(entity))); assertEquals(entity, written); input.close(); @@ -364,12 +364,12 @@ public class EntityTest extends AbstractTest { private void derived(final ODataClient client, final ODataFormat format) throws Exception { final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format)); - final ODataEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input)); + final ClientEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input)); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress", - ((ODataValuable) entity.getProperty("HomeAddress")).getValue().getTypeName()); + ((ClientValuable) entity.getProperty("HomeAddress")).getValue().getTypeName()); input.close(); } diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java index c0067bcdb..21b1f82e7 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java @@ -20,7 +20,7 @@ package org.apache.olingo.client.core.v4; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.AbstractTest; -import org.apache.olingo.commons.api.domain.ODataError; +import org.apache.olingo.commons.api.domain.ClientError; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.junit.Test; @@ -35,15 +35,15 @@ public class ErrorTest extends AbstractTest { return v4Client; } - private ODataError error(final String name, final ODataFormat format) throws ODataDeserializerException { - final ODataError error = getClient().getDeserializer(format).toError( + private ClientError error(final String name, final ODataFormat format) throws ODataDeserializerException { + final ClientError error = getClient().getDeserializer(format).toError( getClass().getResourceAsStream(name + "." + getSuffix(format))); assertNotNull(error); return error; } private void simple(final ODataFormat format) throws ODataDeserializerException { - final ODataError error = error("error", format); + final ClientError error = error("error", format); assertEquals("501", error.getCode()); assertEquals("Unsupported functionality", error.getMessage()); assertEquals("query", error.getTarget()); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java index 0f6cb195c..49c7c388a 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java @@ -35,10 +35,10 @@ import org.apache.olingo.client.core.AbstractTest; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.Property; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -225,21 +225,21 @@ public class JSONTest extends AbstractTest { @Test public void issueOLINGO390() throws Exception { - final ODataEntity message = getClient().getObjectFactory(). + final ClientEntity message = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Exchange.Services.OData.Model.Message")); - final ODataComplexValue toRecipient = getClient().getObjectFactory(). + final ClientComplexValue toRecipient = getClient().getObjectFactory(). newComplexValue("Microsoft.Exchange.Services.OData.Model.Recipient"); toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Name", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challen_olingo_client"))); toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Address", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challenh@microsoft.com"))); - final ODataCollectionValue toRecipients = getClient().getObjectFactory(). + final ClientCollectionValue toRecipients = getClient().getObjectFactory(). newCollectionValue("Microsoft.Exchange.Services.OData.Model.Recipient"); toRecipients.add(toRecipient); message.getProperties().add(getClient().getObjectFactory().newCollectionProperty("ToRecipients", toRecipients)); - final ODataComplexValue body = + final ClientComplexValue body = getClient().getObjectFactory().newComplexValue("Microsoft.Exchange.Services.OData.Model.ItemBody"); body.add(getClient().getObjectFactory().newPrimitiveProperty("Content", getClient().getObjectFactory().newPrimitiveValueBuilder(). diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java index 572881234..760e8caa0 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java @@ -20,7 +20,7 @@ package org.apache.olingo.client.core.v4; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.AbstractTest; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.junit.Test; @@ -42,7 +42,7 @@ public class PrimitiveValueTest extends AbstractTest { expected.clear(); expected.set(2013, 0, 10, 21, 45, 17); - final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build(); assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind()); @@ -60,7 +60,7 @@ public class PrimitiveValueTest extends AbstractTest { expected.clear(); expected.set(2013, 0, 10); - final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). + final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.Date).setValue(expected).build(); assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind()); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java index 642f37b00..e8daeb8c1 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java @@ -20,10 +20,10 @@ package org.apache.olingo.client.core.v4; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.AbstractTest; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.apache.olingo.commons.api.serialization.ODataSerializerException; @@ -45,15 +45,15 @@ public class PropertyTest extends AbstractTest { private void _enum(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException { final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format)); - final ODataProperty property = getClient().getReader().readProperty(input, format); + final ClientProperty property = getClient().getReader().readProperty(input, format); assertNotNull(property); assertTrue(property.hasEnumValue()); - final ODataProperty written = getClient().getReader().readProperty( + final ClientProperty written = getClient().getReader().readProperty( getClient().getWriter().writeProperty(property, format), format); // This is needed because type information gets lost with serialization if (format == ODataFormat.XML) { - final ODataProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(), + final ClientProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(), getClient().getObjectFactory(). newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue())); @@ -73,21 +73,21 @@ public class PropertyTest extends AbstractTest { private void complex(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException { final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format)); - final ODataProperty property = getClient().getReader().readProperty(input, format); + final ClientProperty property = getClient().getReader().readProperty(input, format); assertNotNull(property); assertTrue(property.hasComplexValue()); assertEquals(3, property.getComplexValue().size()); - final ODataProperty written = getClient().getReader().readProperty( + final ClientProperty written = getClient().getReader().readProperty( getClient().getWriter().writeProperty(property, format), format); // This is needed because type information gets lost with JSON serialization - final ODataComplexValue typedValue = getClient().getObjectFactory(). + final ClientComplexValue typedValue = getClient().getObjectFactory(). newComplexValue(property.getComplexValue().getTypeName()); - for (final Iterator itor = written.getComplexValue().iterator(); itor.hasNext();) { - final ODataProperty prop = itor.next(); + for (final Iterator itor = written.getComplexValue().iterator(); itor.hasNext();) { + final ClientProperty prop = itor.next(); typedValue.add(prop); } - final ODataProperty comparable = getClient().getObjectFactory(). + final ClientProperty comparable = getClient().getObjectFactory(). newComplexProperty(property.getName(), typedValue); assertEquals(property, comparable); @@ -105,22 +105,22 @@ public class PropertyTest extends AbstractTest { private void collection(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException { final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format)); - final ODataProperty property = getClient().getReader().readProperty(input, format); + final ClientProperty property = getClient().getReader().readProperty(input, format); assertNotNull(property); assertTrue(property.hasCollectionValue()); assertEquals(3, property.getCollectionValue().size()); - final ODataProperty written = getClient().getReader().readProperty( + final ClientProperty written = getClient().getReader().readProperty( getClient().getWriter().writeProperty(property, format), format); // This is needed because type information gets lost with JSON serialization if (format == ODataFormat.XML) { - final ODataCollectionValue typedValue = getClient().getObjectFactory(). + final ClientCollectionValue typedValue = getClient().getObjectFactory(). newCollectionValue(property.getCollectionValue().getTypeName()); - for (final Iterator itor = written.getCollectionValue().iterator(); itor.hasNext();) { - final ODataValue value = itor.next(); + for (final Iterator itor = written.getCollectionValue().iterator(); itor.hasNext();) { + final ClientValue value = itor.next(); typedValue.add(value); } - final ODataProperty comparable = getClient().getObjectFactory(). + final ClientProperty comparable = getClient().getObjectFactory(). newCollectionProperty(property.getName(), typedValue); assertEquals(property, comparable); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java index 096591ca2..e0250767a 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java @@ -22,7 +22,7 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.client.core.AbstractTest; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataServiceDocument; +import org.apache.olingo.commons.api.domain.ClientServiceDocument; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataDeserializerException; import org.junit.Test; @@ -44,14 +44,14 @@ public class ServiceDocumentTest extends AbstractTest { return format == ODataFormat.XML ? "xml" : "json"; } - private ODataServiceDocument parse(final ODataFormat format) throws ODataDeserializerException { + private ClientServiceDocument parse(final ODataFormat format) throws ODataDeserializerException { ResWrap service = getClient().getDeserializer(format).toServiceDocument( getClass().getResourceAsStream("serviceDocument." + getFileExtension(format))); assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL()); assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag()); - final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload()); + final ClientServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload()); assertNotNull(serviceDocument); assertTrue(serviceDocument.getEntitySetNames().contains("Order Details")); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java index 167c5c312..a9db5246d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.commons.api.data; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientOperation; import java.net.URI; import java.util.ArrayList; @@ -33,7 +33,7 @@ public class Entity extends Linked { private Link editLink; private final List mediaEditLinks = new ArrayList(); - private final List operations = new ArrayList(); + private final List operations = new ArrayList(); private final List properties = new ArrayList(); @@ -122,7 +122,7 @@ public class Entity extends Linked { * * @return operations. */ - public List getOperations() { + public List getOperations() { return operations; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientPayload.java similarity index 92% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientPayload.java index 62cb4e142..fc5486006 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataPayload.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientPayload.java @@ -23,14 +23,14 @@ import java.net.URI; /** * OData entity. */ -public abstract class AbstractODataPayload extends ODataItem { +public abstract class AbstractClientPayload extends ClientItem { /** * Context URL. */ private URI contextURL; - public AbstractODataPayload(final String name) { + public AbstractClientPayload(final String name) { super(name); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientValue.java similarity index 79% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientValue.java index acd056dd8..af5b4233d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractClientValue.java @@ -26,14 +26,14 @@ import org.apache.commons.lang3.builder.ToStringStyle; /** * Abstract representation of an OData entity property value. */ -public abstract class AbstractODataValue implements ODataValue { +public abstract class AbstractClientValue implements ClientValue { /** * Type name; */ private final String typeName; - public AbstractODataValue(final String typeName) { + public AbstractClientValue(final String typeName) { this.typeName = typeName; } @@ -49,7 +49,7 @@ public abstract class AbstractODataValue implements ODataValue { */ @Override public boolean isPrimitive() { - return (this instanceof ODataPrimitiveValue); + return (this instanceof ClientPrimitiveValue); } /** @@ -58,8 +58,8 @@ public abstract class AbstractODataValue implements ODataValue { * @return primitive value. */ @Override - public ODataPrimitiveValue asPrimitive() { - return isPrimitive() ? (ODataPrimitiveValue) this : null; + public ClientPrimitiveValue asPrimitive() { + return isPrimitive() ? (ClientPrimitiveValue) this : null; } /** @@ -69,7 +69,7 @@ public abstract class AbstractODataValue implements ODataValue { */ @Override public boolean isComplex() { - return (this instanceof ODataComplexValue); + return (this instanceof ClientComplexValue); } /** @@ -78,8 +78,8 @@ public abstract class AbstractODataValue implements ODataValue { * @return complex value. */ @Override - public ODataComplexValue asComplex() { - return isComplex() ? (ODataComplexValue) this : null; + public ClientComplexValue asComplex() { + return isComplex() ? (ClientComplexValue) this : null; } /** @@ -89,7 +89,7 @@ public abstract class AbstractODataValue implements ODataValue { */ @Override public boolean isCollection() { - return (this instanceof ODataCollectionValue); + return (this instanceof ClientCollectionValue); } /** @@ -99,8 +99,8 @@ public abstract class AbstractODataValue implements ODataValue { */ @SuppressWarnings("unchecked") @Override - public ODataCollectionValue asCollection() { - return isCollection() ? (ODataCollectionValue) this : null; + public ClientCollectionValue asCollection() { + return isCollection() ? (ClientCollectionValue) this : null; } @Override diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotatable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotatable.java similarity index 91% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotatable.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotatable.java index fe10fba19..f9c511922 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotatable.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotatable.java @@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain; import java.util.List; -public interface ODataAnnotatable { +public interface ClientAnnotatable { - List getAnnotations(); + List getAnnotations(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotation.java similarity index 94% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotation.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotation.java index ec00417b8..1749c63fd 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataAnnotation.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientAnnotation.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.commons.api.domain; -public interface ODataAnnotation extends ODataValuable { +public interface ClientAnnotation extends ClientValuable { /** * Returns annotation name. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientCollectionValue.java similarity index 90% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientCollectionValue.java index 2444f2a1d..0497dc6f2 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientCollectionValue.java @@ -25,14 +25,14 @@ import java.util.Collection; * * @param The actual ODataValue interface. */ -public interface ODataCollectionValue extends ODataValue, Iterable { +public interface ClientCollectionValue extends ClientValue, Iterable { /** * Adds a value to the collection. * * @param value value to be added. */ - ODataCollectionValue add(ODataValue value); + ClientCollectionValue add(ClientValue value); /** * Checks if collection is empty. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientComplexValue.java similarity index 87% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientComplexValue.java index ad64559b4..3c2931a97 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientComplexValue.java @@ -24,7 +24,7 @@ import java.util.Map; * OData complex property value. * */ -public interface ODataComplexValue extends ODataValue, ODataLinked, ODataAnnotatable, Iterable { +public interface ClientComplexValue extends ClientValue, ClientLinked, ClientAnnotatable, Iterable { /** * Adds field to the complex type. @@ -32,7 +32,7 @@ public interface ODataComplexValue extends ODataValue, ODataLinked, ODataAnnotat * @param field field to be added. * @return this (for fluent-style calls) */ - ODataComplexValue add(ODataProperty field); + ClientComplexValue add(ClientProperty field); /** * Gets field. @@ -40,7 +40,7 @@ public interface ODataComplexValue extends ODataValue, ODataLinked, ODataAnnotat * @param name name of the field to be retrieved. * @return requested field. */ - ODataProperty get(String name); + ClientProperty get(String name); /** * Gets number of fields. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeletedEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeletedEntity.java similarity index 96% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeletedEntity.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeletedEntity.java index ba7401e81..3cdcb7bd6 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeletedEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeletedEntity.java @@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain; import java.net.URI; -public interface ODataDeletedEntity { +public interface ClientDeletedEntity { enum Reason { diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDelta.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDelta.java similarity index 82% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDelta.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDelta.java index 54927504d..7092e6f51 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDelta.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDelta.java @@ -20,12 +20,12 @@ package org.apache.olingo.commons.api.domain; import java.util.List; -public interface ODataDelta extends ODataEntitySet { +public interface ClientDelta extends ClientEntitySet { - List getDeletedEntities(); + List getDeletedEntities(); - List getAddedLinks(); + List getAddedLinks(); - List getDeletedLinks(); + List getDeletedLinks(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeltaLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeltaLink.java similarity index 94% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeltaLink.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeltaLink.java index 757def980..d12aedf11 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataDeltaLink.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientDeltaLink.java @@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain; import java.net.URI; -public interface ODataDeltaLink extends ODataAnnotatable { +public interface ClientDeltaLink extends ClientAnnotatable { URI getSource(); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntity.java similarity index 92% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntity.java index 363b5222c..39736cc38 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntity.java @@ -26,7 +26,7 @@ import java.util.List; /** * OData entity. */ -public interface ODataEntity extends ODataLinked, ODataAnnotatable, ODataInvokeResult { +public interface ClientEntity extends ClientLinked, ClientAnnotatable, ClientInvokeResult { /** * @return the type name of this entity. @@ -72,14 +72,14 @@ public interface ODataEntity extends ODataLinked, ODataAnnotatable, ODataInvokeR * @param title operation to look for * @return operation if found with given title, null otherwise */ - ODataOperation getOperation(String title); + ClientOperation getOperation(String title); /** * Gets operations. * * @return operations. */ - List getOperations(); + List getOperations(); /** * Searches for property with given name. @@ -87,14 +87,14 @@ public interface ODataEntity extends ODataLinked, ODataAnnotatable, ODataInvokeR * @param name property to look for * @return property if found with given name, null otherwise */ - ODataProperty getProperty(String name); + ClientProperty getProperty(String name); /** * Returns OData entity properties. * * @return OData entity properties. */ - List getProperties(); + List getProperties(); /** * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended @@ -127,14 +127,14 @@ public interface ODataEntity extends ODataLinked, ODataAnnotatable, ODataInvokeR * @param name candidate link name * @return media-edit link with given name, if available, otherwise null */ - ODataLink getMediaEditLink(final String name); + ClientLink getMediaEditLink(final String name); /** * Returns entity media edit links. * * @return OData entity links. */ - List getMediaEditLinks(); + List getMediaEditLinks(); /** * TRUE if read-only entity. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntitySet.java similarity index 93% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntitySet.java index 4175f8f75..36a816177 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEntitySet.java @@ -24,7 +24,7 @@ import java.util.List; /** * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available. */ -public interface ODataEntitySet extends ODataInvokeResult, ODataAnnotatable { +public interface ClientEntitySet extends ClientInvokeResult, ClientAnnotatable { /** * Gets next page link. @@ -38,7 +38,7 @@ public interface ODataEntitySet extends ODataInvokeResult, ODataAnnotatable { * * @return entity set's entities. */ - List getEntities(); + List getEntities(); /** * Gets in-line count. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEnumValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEnumValue.java similarity index 94% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEnumValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEnumValue.java index ef5852d7c..cc88a9460 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEnumValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientEnumValue.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.commons.api.domain; -public interface ODataEnumValue extends ODataValue { +public interface ClientEnumValue extends ClientValue { String getValue(); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientError.java similarity index 89% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientError.java index a910f0874..11b6ca804 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientError.java @@ -24,12 +24,12 @@ import java.util.Map; /** * OData error. */ -public class ODataError { +public class ClientError { private String code; private String message; private String target; - private List details; + private List details; private Map innerError; /** @@ -47,7 +47,7 @@ public class ODataError { * @param code * @return this for method chaining */ - public ODataError setCode(String code) { + public ClientError setCode(String code) { this.code = code; return this; } @@ -67,7 +67,7 @@ public class ODataError { * @param message * @return this for method chaining */ - public ODataError setMessage(String message) { + public ClientError setMessage(String message) { this.message = message; return this; } @@ -87,7 +87,7 @@ public class ODataError { * @param target * @return this for method chaining */ - public ODataError setTarget(String target) { + public ClientError setTarget(String target) { this.target = target; return this; } @@ -97,7 +97,7 @@ public class ODataError { * * @return ODataErrorDetail list. */ - public List getDetails() { + public List getDetails() { return details; } @@ -106,7 +106,7 @@ public class ODataError { * * @return this for method chaining. */ - public ODataError setDetails(List details) { + public ClientError setDetails(List details) { this.details = details; return this; } @@ -125,7 +125,7 @@ public class ODataError { * * @return this for method chaining. */ - public ODataError setInnerError(Map innerError) { + public ClientError setInnerError(Map innerError) { this.innerError = innerError; return this; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientErrorDetail.java similarity index 88% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientErrorDetail.java index 573525db9..77316ef53 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataErrorDetail.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientErrorDetail.java @@ -23,7 +23,7 @@ package org.apache.olingo.commons.api.domain; * {"code": "301","target": "$search" ,"message": "$search query option not supported"} * ],...}}. */ -public class ODataErrorDetail { +public class ClientErrorDetail { private String code; private String message; @@ -38,7 +38,7 @@ public class ODataErrorDetail { return code; } - public ODataErrorDetail setCode(final String code) { + public ClientErrorDetail setCode(final String code) { this.code = code; return this; } @@ -52,7 +52,7 @@ public class ODataErrorDetail { return message; } - public ODataErrorDetail setMessage(final String message) { + public ClientErrorDetail setMessage(final String message) { this.message = message; return this; } @@ -66,7 +66,7 @@ public class ODataErrorDetail { return target; } - public ODataErrorDetail setTarget(final String target) { + public ClientErrorDetail setTarget(final String target) { this.target = target; return this; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntity.java similarity index 77% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntity.java index 6ba0ad638..e3fb6991d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntity.java @@ -23,9 +23,9 @@ import java.net.URI; /** * OData in-line entity. */ -public class ODataInlineEntity extends ODataLink { +public class ClientInlineEntity extends ClientLink { - private final ODataEntity entity; + private final ClientEntity entity; /** * Constructor. @@ -35,7 +35,7 @@ public class ODataInlineEntity extends ODataLink { * @param title title. * @param entity entity. */ - public ODataInlineEntity(final URI uri, final ODataLinkType type, final String title, final ODataEntity entity) { + public ClientInlineEntity(final URI uri, final ClientLinkType type, final String title, final ClientEntity entity) { super(uri, type, title); this.entity = entity; @@ -50,8 +50,8 @@ public class ODataInlineEntity extends ODataLink { * @param title title. * @param entity entity. */ - public ODataInlineEntity(final URI baseURI, final String href, final ODataLinkType type, final String title, - final ODataEntity entity) { + public ClientInlineEntity(final URI baseURI, final String href, final ClientLinkType type, final String title, + final ClientEntity entity) { super(baseURI, href, type, title); this.entity = entity; @@ -62,7 +62,7 @@ public class ODataInlineEntity extends ODataLink { * * @return wrapped entity. */ - public ODataEntity getEntity() { + public ClientEntity getEntity() { return entity; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntitySet.java similarity index 76% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntitySet.java index c1cf32278..a14933f88 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInlineEntitySet.java @@ -23,9 +23,9 @@ import java.net.URI; /** * OData in-line entity set. */ -public class ODataInlineEntitySet extends ODataLink { +public class ClientInlineEntitySet extends ClientLink { - private ODataEntitySet entitySet; + private ClientEntitySet entitySet; /** * Constructor. @@ -35,8 +35,8 @@ public class ODataInlineEntitySet extends ODataLink { * @param title title. * @param entitySet entity set. */ - public ODataInlineEntitySet(final URI uri, final ODataLinkType type, - final String title, final ODataEntitySet entitySet) { + public ClientInlineEntitySet(final URI uri, final ClientLinkType type, + final String title, final ClientEntitySet entitySet) { super(uri, type, title); this.entitySet = entitySet; @@ -51,8 +51,8 @@ public class ODataInlineEntitySet extends ODataLink { * @param title title. * @param entitySet entity set. */ - public ODataInlineEntitySet(final URI baseURI, final String href, - final ODataLinkType type, final String title, final ODataEntitySet entitySet) { + public ClientInlineEntitySet(final URI baseURI, final String href, + final ClientLinkType type, final String title, final ClientEntitySet entitySet) { super(baseURI, href, type, title); this.entitySet = entitySet; @@ -63,7 +63,7 @@ public class ODataInlineEntitySet extends ODataLink { * * @return wrapped entity set. */ - public ODataEntitySet getEntitySet() { + public ClientEntitySet getEntitySet() { return entitySet; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInvokeResult.java similarity index 90% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInvokeResult.java index bfd0909be..a28c07881 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInvokeResult.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientInvokeResult.java @@ -21,10 +21,10 @@ package org.apache.olingo.commons.api.domain; /** * Marker interface for any OData domain object that can be returned by an operation invocation. * - * @see ODataEntitySet - * @see ODataEntity - * @see ODataProperty + * @see ClientEntitySet + * @see ClientEntity + * @see ClientProperty */ -public interface ODataInvokeResult { +public interface ClientInvokeResult { //No additional methods needed for now. } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientItem.java similarity index 81% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientItem.java index 589b249be..1279aea6c 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientItem.java @@ -30,12 +30,12 @@ import org.slf4j.LoggerFactory; /** * Abstract representation of OData entities and links. */ -public abstract class ODataItem { +public abstract class ClientItem { /** * Logger. */ - protected static final Logger LOG = LoggerFactory.getLogger(ODataItem.class); + protected static final Logger LOG = LoggerFactory.getLogger(ClientItem.class); /** * OData entity name/type. @@ -50,28 +50,28 @@ public abstract class ODataItem { /** * Constructor. * - * @param name ODataItem name (it's entity type for {@link ODataEntity}). + * @param name ODataItem name (it's entity type for {@link ClientEntity}). */ - public ODataItem(final String name) { + public ClientItem(final String name) { this.name = name; } /** - * @return ODataItem name (it's entity type for {@link ODataEntity}). + * @return ODataItem name (it's entity type for {@link ClientEntity}). */ public String getName() { return name; } /** - * @return ODataItem link (it's edit link for {@link ODataEntity}). + * @return ODataItem link (it's edit link for {@link ClientEntity}). */ public URI getLink() { return link; } /** - * Sets ODataItem link (it's edit link for {@link ODataEntity}). + * Sets ODataItem link (it's edit link for {@link ClientEntity}). * * @param link link. */ diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLink.java similarity index 78% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLink.java index 859367918..d19c3c59b 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLink.java @@ -27,13 +27,13 @@ import org.apache.olingo.commons.api.Constants; /** * OData link. */ -public class ODataLink extends ODataItem implements ODataAnnotatable { +public class ClientLink extends ClientItem implements ClientAnnotatable { public static class Builder { protected URI uri; - protected ODataLinkType type; + protected ClientLinkType type; protected String title; @@ -47,7 +47,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { return this; } - public Builder setType(final ODataLinkType type) { + public Builder setType(final ClientLinkType type) { this.type = type; return this; } @@ -57,8 +57,8 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { return this; } - public ODataLink build() { - return new ODataLink(uri, type, title); + public ClientLink build() { + return new ClientLink(uri, type, title); } } @@ -88,7 +88,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { /** * Link type. */ - protected final ODataLinkType type; + protected final ClientLinkType type; /** * Link rel. @@ -100,7 +100,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { */ protected String mediaETag; - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); /** * Constructor. @@ -109,7 +109,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { * @param type type. * @param title title. */ - public ODataLink(final URI uri, final ODataLinkType type, final String title) { + public ClientLink(final URI uri, final ClientLinkType type, final String title) { super(title); link = uri; @@ -141,7 +141,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { * @param type type. * @param title title. */ - protected ODataLink(final URI baseURI, final String href, final ODataLinkType type, final String title) { + protected ClientLink(final URI baseURI, final String href, final ClientLinkType type, final String title) { this(getURI(baseURI, href), type, title); } @@ -151,16 +151,16 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { * * @return link type; */ - public ODataLinkType getType() { + public ClientLinkType getType() { return type; } - public ODataInlineEntity asInlineEntity() { - return (this instanceof ODataInlineEntity) ? (ODataInlineEntity) this : null; + public ClientInlineEntity asInlineEntity() { + return (this instanceof ClientInlineEntity) ? (ClientInlineEntity) this : null; } - public ODataInlineEntitySet asInlineEntitySet() { - return (this instanceof ODataInlineEntitySet) ? (ODataInlineEntitySet) this : null; + public ClientInlineEntitySet asInlineEntitySet() { + return (this instanceof ClientInlineEntitySet) ? (ClientInlineEntitySet) this : null; } /** @@ -181,7 +181,7 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { return mediaETag; } - public List getAnnotations() { + public List getAnnotations() { return annotations; } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinkType.java similarity index 83% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinkType.java index 5ae427cb8..8b13c33d7 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinkType.java @@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.format.ContentType; /** * OData link types. */ -public enum ODataLinkType { +public enum ClientLinkType { /** * Entity navigation link. @@ -56,15 +56,15 @@ public enum ODataLinkType { private String type; - private ODataLinkType(final String type) { + private ClientLinkType(final String type) { this.type = type; } - private ODataLinkType(final ContentType contentType) { + private ClientLinkType(final ContentType contentType) { this(contentType.toContentTypeString()); } - private ODataLinkType setType(final String type) { + private ClientLinkType setType(final String type) { this.type = type; return this; } @@ -77,21 +77,21 @@ public enum ODataLinkType { * @param type type. * @return ODataLinkType object. */ - public static ODataLinkType fromString(final String rel, final String type) { + public static ClientLinkType fromString(final String rel, final String type) { if (StringUtils.isNotBlank(rel) && rel.startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) { return MEDIA_EDIT.setType(StringUtils.isBlank(type) ? "*/*" : type); } - if (ODataLinkType.ENTITY_NAVIGATION.type.equals(type)) { + if (ClientLinkType.ENTITY_NAVIGATION.type.equals(type)) { return ENTITY_NAVIGATION; } - if (ODataLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) { + if (ClientLinkType.ENTITY_SET_NAVIGATION.type.equals(type)) { return ENTITY_SET_NAVIGATION; } - if (ODataLinkType.ASSOCIATION.type.equals(type)) { + if (ClientLinkType.ASSOCIATION.type.equals(type)) { return ASSOCIATION; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinked.java similarity index 87% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinked.java index fd9d96554..92b3a420d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientLinked.java @@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain; import java.util.List; -public interface ODataLinked { +public interface ClientLinked { /** * Puts the given link into one of available lists, based on its type. @@ -28,7 +28,7 @@ public interface ODataLinked { * @param link to be added * @return true if the given link was added in one of available lists */ - boolean addLink(ODataLink link); + boolean addLink(ClientLink link); /** * Removes the given link from any list (association, navigation, edit-media). @@ -36,7 +36,7 @@ public interface ODataLinked { * @param link to be removed * @return true if the given link was contained in one of available lists */ - boolean removeLink(ODataLink link); + boolean removeLink(ClientLink link); /** * Gets association link with given name, if available, otherwise null. @@ -44,14 +44,14 @@ public interface ODataLinked { * @param name candidate link name * @return association link with given name, if available, otherwise null */ - ODataLink getAssociationLink(String name); + ClientLink getAssociationLink(String name); /** * Returns all entity association links. * * @return OData entity links. */ - List getAssociationLinks(); + List getAssociationLinks(); /** * Gets navigation link with given name, if available, otherwise null. @@ -59,12 +59,12 @@ public interface ODataLinked { * @param name candidate link name * @return navigation link with given name, if available, otherwise null */ - ODataLink getNavigationLink(String name); + ClientLink getNavigationLink(String name); /** * Returns all entity navigation links (including inline entities / entity sets). * * @return OData entity links. */ - List getNavigationLinks(); + List getNavigationLinks(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientObjectFactory.java similarity index 69% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientObjectFactory.java index 3dee5e320..d9a2e9fd2 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientObjectFactory.java @@ -25,14 +25,14 @@ import java.net.URI; /** * Entry point for generating OData domain objects. */ -public interface ODataObjectFactory { +public interface ClientObjectFactory { /** * Instantiates a new entity set. * * @return entity set. */ - ODataEntitySet newEntitySet(); + ClientEntitySet newEntitySet(); /** * Instantiates a new entity set. @@ -40,7 +40,7 @@ public interface ODataObjectFactory { * @param next next link. * @return entity set. */ - ODataEntitySet newEntitySet(URI next); + ClientEntitySet newEntitySet(URI next); /** * Instantiates a new entity. @@ -48,7 +48,7 @@ public interface ODataObjectFactory { * @param typeName OData entity type name. * @return entity. */ - ODataEntity newEntity(FullQualifiedName typeName); + ClientEntity newEntity(FullQualifiedName typeName); /** * Instantiates a new entity. @@ -57,7 +57,7 @@ public interface ODataObjectFactory { * @param link self link. * @return entity. */ - ODataEntity newEntity(FullQualifiedName typeName, URI link); + ClientEntity newEntity(FullQualifiedName typeName, URI link); /** * Instantiates a new entity set (for deep insert). @@ -66,7 +66,7 @@ public interface ODataObjectFactory { * @param entitySet entity set. * @return in-line entity set. */ - ODataInlineEntitySet newDeepInsertEntitySet(String name, ODataEntitySet entitySet); + ClientInlineEntitySet newDeepInsertEntitySet(String name, ClientEntitySet entitySet); /** * Instantiates a new entity (for deep insert). @@ -75,7 +75,7 @@ public interface ODataObjectFactory { * @param entity entity. * @return in-line entity. */ - ODataInlineEntity newDeepInsertEntity(String name, ODataEntity entity); + ClientInlineEntity newDeepInsertEntity(String name, ClientEntity entity); /** * Instantiates a new entity set navigation link. @@ -84,7 +84,7 @@ public interface ODataObjectFactory { * @param link link. * @return entity set navigation link. */ - ODataLink newEntitySetNavigationLink(String name, URI link); + ClientLink newEntitySetNavigationLink(String name, URI link); /** * Instantiates a new singleton entity. @@ -92,7 +92,7 @@ public interface ODataObjectFactory { * @param typeName OData singleton entity type name. * @return new singleton entity. */ - ODataSingleton newSingleton(FullQualifiedName typeName); + ClientSingleton newSingleton(FullQualifiedName typeName); /** * Instantiates a new entity navigation link. @@ -101,19 +101,19 @@ public interface ODataObjectFactory { * @param link link. * @return entity navigation link. */ - ODataLink newEntityNavigationLink(String name, URI link); + ClientLink newEntityNavigationLink(String name, URI link); - ODataLink newAssociationLink(String name, URI link); + ClientLink newAssociationLink(String name, URI link); - ODataLink newMediaEditLink(String name, URI link); + ClientLink newMediaEditLink(String name, URI link); - ODataPrimitiveValue.Builder newPrimitiveValueBuilder(); + ClientPrimitiveValue.Builder newPrimitiveValueBuilder(); - ODataEnumValue newEnumValue(String typeName, String value); + ClientEnumValue newEnumValue(String typeName, String value); - ODataComplexValue newComplexValue(String typeName); + ClientComplexValue newComplexValue(String typeName); - ODataCollectionValue newCollectionValue(String typeName); + ClientCollectionValue newCollectionValue(String typeName); /** * Instantiates a new primitive property. @@ -122,7 +122,7 @@ public interface ODataObjectFactory { * @param value primitive value. * @return primitive property. */ - ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value); + ClientProperty newPrimitiveProperty(String name, ClientPrimitiveValue value); /** * Instantiates a new complex property. @@ -131,7 +131,7 @@ public interface ODataObjectFactory { * @param value value. * @return complex property. */ - ODataProperty newComplexProperty(String name, ODataComplexValue value); + ClientProperty newComplexProperty(String name, ClientComplexValue value); /** * Instantiates a new collection property. @@ -140,7 +140,7 @@ public interface ODataObjectFactory { * @param value value. * @return collection property. */ - ODataProperty newCollectionProperty(String name, ODataCollectionValue value); + ClientProperty newCollectionProperty(String name, ClientCollectionValue value); /** * Instantiates a new enum property. @@ -149,14 +149,14 @@ public interface ODataObjectFactory { * @param value value. * @return new enum property. */ - ODataProperty newEnumProperty(String name, ODataEnumValue value); + ClientProperty newEnumProperty(String name, ClientEnumValue value); /** * Instantiates a new delta property. * * @return new delta property. */ - ODataDelta newDelta(); + ClientDelta newDelta(); /** * Instantiates a new delta property. @@ -164,5 +164,5 @@ public interface ODataObjectFactory { * @param next next link for delta property * @return new delta property. */ - ODataDelta newDelta(URI next); + ClientDelta newDelta(URI next); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientOperation.java similarity index 98% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientOperation.java index 421a405f6..e5c584555 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataOperation.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientOperation.java @@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain; import java.net.URI; -public class ODataOperation { +public class ClientOperation { private String metadataAnchor; diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPrimitiveValue.java similarity index 78% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPrimitiveValue.java index 46c44160b..a3da64a0f 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPrimitiveValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPrimitiveValue.java @@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.EdmType; import java.util.UUID; -public interface ODataPrimitiveValue extends ODataValue { +public interface ClientPrimitiveValue extends ClientValue { interface Builder { @@ -35,25 +35,25 @@ public interface ODataPrimitiveValue extends ODataValue { Builder setValue(Object value); - ODataPrimitiveValue build(); + ClientPrimitiveValue build(); - ODataPrimitiveValue buildBoolean(Boolean value); + ClientPrimitiveValue buildBoolean(Boolean value); - ODataPrimitiveValue buildInt16(Short value); + ClientPrimitiveValue buildInt16(Short value); - ODataPrimitiveValue buildInt32(Integer value); + ClientPrimitiveValue buildInt32(Integer value); - ODataPrimitiveValue buildInt64(Long value); + ClientPrimitiveValue buildInt64(Long value); - ODataPrimitiveValue buildSingle(Float value); + ClientPrimitiveValue buildSingle(Float value); - ODataPrimitiveValue buildDouble(Double value); + ClientPrimitiveValue buildDouble(Double value); - ODataPrimitiveValue buildString(String value); + ClientPrimitiveValue buildString(String value); - ODataPrimitiveValue buildGuid(UUID value); + ClientPrimitiveValue buildGuid(UUID value); - ODataPrimitiveValue buildBinary(byte[] value); + ClientPrimitiveValue buildBinary(byte[] value); } EdmPrimitiveTypeKind getTypeKind(); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientProperty.java similarity index 91% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientProperty.java index 9007626c0..8d7a49031 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientProperty.java @@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.domain; /** * OData entity property. */ -public interface ODataProperty extends ODataInvokeResult, ODataAnnotatable, ODataValuable { +public interface ClientProperty extends ClientInvokeResult, ClientAnnotatable, ClientValuable { /** * Returns property name. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPropertyType.java similarity index 97% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPropertyType.java index e7b5b85c0..96ab25031 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientPropertyType.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.commons.api.domain; -public enum ODataPropertyType { +public enum ClientPropertyType { /** * Primitive (including geospatial). diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientServiceDocument.java similarity index 99% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientServiceDocument.java index 8bbff32bf..a2af9ab1f 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientServiceDocument.java @@ -23,7 +23,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; -public class ODataServiceDocument { +public class ClientServiceDocument { private final Map entitySets = new HashMap(); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataSingleton.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientSingleton.java similarity index 94% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataSingleton.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientSingleton.java index d328f4140..aa474b7e3 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataSingleton.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientSingleton.java @@ -18,6 +18,6 @@ */ package org.apache.olingo.commons.api.domain; -public interface ODataSingleton extends ODataEntity { +public interface ClientSingleton extends ClientEntity { //No additional methods needed for now. } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValuable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValuable.java similarity index 89% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValuable.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValuable.java index 7e0c60c58..636972ac6 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValuable.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValuable.java @@ -19,14 +19,14 @@ package org.apache.olingo.commons.api.domain; -public interface ODataValuable { +public interface ClientValuable { /** * Returns annotation value. * * @return annotation value. */ - ODataValue getValue(); + ClientValue getValue(); /** * Checks if has null value. @@ -47,7 +47,7 @@ public interface ODataValuable { * * @return primitive value if exists; null otherwise. */ - ODataPrimitiveValue getPrimitiveValue(); + ClientPrimitiveValue getPrimitiveValue(); /** * Checks if has collection value. @@ -61,7 +61,7 @@ public interface ODataValuable { * * @return collection value if exists; null otherwise. */ - ODataCollectionValue getCollectionValue(); + ClientCollectionValue getCollectionValue(); /** * Checks if has complex value. @@ -75,7 +75,7 @@ public interface ODataValuable { * * @return complex value if exists; null otherwise. */ - ODataComplexValue getComplexValue(); + ClientComplexValue getComplexValue(); /** * Checks if has enum value. @@ -89,6 +89,6 @@ public interface ODataValuable { * * @return enum value if exists; null otherwise. */ - ODataEnumValue getEnumValue(); + ClientEnumValue getEnumValue(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValue.java similarity index 90% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValue.java index 57069e88f..ba41bc073 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ClientValue.java @@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.domain; /** * Abstract representation of an OData entity property value. */ -public interface ODataValue { +public interface ClientValue { /** * Gets value type name. @@ -43,7 +43,7 @@ public interface ODataValue { * * @return primitive value. */ - ODataPrimitiveValue asPrimitive(); + ClientPrimitiveValue asPrimitive(); /** * Check is is a collection value. @@ -58,14 +58,14 @@ public interface ODataValue { * @param The actual ODataValue interface. * @return collection value. */ - ODataCollectionValue asCollection(); + ClientCollectionValue asCollection(); /** * Casts to complex value. * * @return complex value. */ - ODataComplexValue asComplex(); + ClientComplexValue asComplex(); /** * Check is is a linked complex value. @@ -86,6 +86,6 @@ public interface ODataValue { * * @return enum value. */ - ODataEnumValue asEnum(); + ClientEnumValue asEnum(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java index 21c18542e..cc47fe6b8 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java @@ -18,10 +18,10 @@ */ package org.apache.olingo.commons.api.edm.annotation; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientValue; public interface EdmConstantAnnotationExpression extends EdmAnnotationExpression { - ODataValue getValue(); + ClientValue getValue(); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java index 8e313b105..38ad91154 100755 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java @@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataError; +import org.apache.olingo.commons.api.domain.ClientError; import java.io.InputStream; @@ -61,5 +61,5 @@ public interface ODataDeserializer { * @param input stream to be parsed and de-serialized. * @return parsed ODataError object represented by the given InputStream */ - ODataError toError(InputStream input) throws ODataDeserializerException; + ClientError toError(InputStream input) throws ODataDeserializerException; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractClientEntitySet.java similarity index 82% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractClientEntitySet.java index f8535b052..d11b7997e 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractClientEntitySet.java @@ -18,12 +18,12 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.AbstractODataPayload; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.AbstractClientPayload; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import java.net.URI; -public abstract class AbstractODataEntitySet extends AbstractODataPayload implements ODataEntitySet { +public abstract class AbstractClientEntitySet extends AbstractClientPayload implements ClientEntitySet { /** * Link to the next page. @@ -40,7 +40,7 @@ public abstract class AbstractODataEntitySet extends AbstractODataPayload implem /** * Constructor. */ - public AbstractODataEntitySet() { + public AbstractClientEntitySet() { super(null); } @@ -49,7 +49,7 @@ public abstract class AbstractODataEntitySet extends AbstractODataPayload implem * * @param next next link. */ - public AbstractODataEntitySet(final URI next) { + public AbstractClientEntitySet(final URI next) { super(null); this.next = next; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientAnnotationImpl.java similarity index 67% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataAnnotationImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientAnnotationImpl.java index 1ca150b24..b5fae895b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataAnnotationImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientAnnotationImpl.java @@ -18,23 +18,23 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientValuable; +import org.apache.olingo.commons.api.domain.ClientValue; -public class ODataAnnotationImpl implements ODataAnnotation { +public class ClientAnnotationImpl implements ClientAnnotation { private final String term; - private final ODataValuable valuable; + private final ClientValuable valuable; - public ODataAnnotationImpl(final String term, final ODataValue value) { + public ClientAnnotationImpl(final String term, final ClientValue value) { this.term = term; - valuable = new ODataValuableImpl(value); + valuable = new ClientValuableImpl(value); } @Override @@ -43,7 +43,7 @@ public class ODataAnnotationImpl implements ODataAnnotation { } @Override - public ODataValue getValue() { + public ClientValue getValue() { return valuable.getValue(); } @@ -58,7 +58,7 @@ public class ODataAnnotationImpl implements ODataAnnotation { } @Override - public ODataPrimitiveValue getPrimitiveValue() { + public ClientPrimitiveValue getPrimitiveValue() { return valuable.getPrimitiveValue(); } @@ -68,7 +68,7 @@ public class ODataAnnotationImpl implements ODataAnnotation { } @Override - public ODataCollectionValue getCollectionValue() { + public ClientCollectionValue getCollectionValue() { return valuable.getCollectionValue(); } @@ -78,7 +78,7 @@ public class ODataAnnotationImpl implements ODataAnnotation { } @Override - public ODataComplexValue getComplexValue() { + public ClientComplexValue getComplexValue() { return valuable.getComplexValue(); } @@ -88,7 +88,7 @@ public class ODataAnnotationImpl implements ODataAnnotation { } @Override - public ODataEnumValue getEnumValue() { + public ClientEnumValue getEnumValue() { return valuable.getEnumValue(); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientCollectionValueImpl.java similarity index 80% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientCollectionValueImpl.java index c60831336..e7b53ff13 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientCollectionValueImpl.java @@ -23,20 +23,20 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.AbstractClientValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientValue; -public class ODataCollectionValueImpl extends AbstractODataValue - implements ODataCollectionValue, ODataValue { +public class ClientCollectionValueImpl extends AbstractClientValue + implements ClientCollectionValue, ClientValue { /** * Constructor. * * @param typeName type name. */ - public ODataCollectionValueImpl(final String typeName) { + public ClientCollectionValueImpl(final String typeName) { super(typeName == null || typeName.startsWith("Collection(") ? typeName : "Collection(" + typeName + ")"); } @@ -46,7 +46,7 @@ public class ODataCollectionValueImpl extends AbstractODa } @Override - public ODataEnumValue asEnum() { + public ClientEnumValue asEnum() { return null; } @@ -58,7 +58,7 @@ public class ODataCollectionValueImpl extends AbstractODa @Override public Collection asJavaCollection() { final List result = new ArrayList(); - for (ODataValue value : values) { + for (ClientValue value : values) { if (value.isPrimitive()) { result.add(value.asPrimitive().toValue()); } else if (value.isComplex()) { @@ -85,7 +85,7 @@ public class ODataCollectionValueImpl extends AbstractODa */ @Override @SuppressWarnings("unchecked") - public ODataCollectionValue add(final ODataValue value) { + public ClientCollectionValue add(final ClientValue value) { values.add((OV) value); return this; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientComplexValueImpl.java similarity index 69% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientComplexValueImpl.java index efb5744eb..3881c3a9e 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientComplexValueImpl.java @@ -24,38 +24,38 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.AbstractClientValue; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientProperty; -public class ODataComplexValueImpl extends AbstractODataValue implements ODataComplexValue { +public class ClientComplexValueImpl extends AbstractClientValue implements ClientComplexValue { /** * Navigation links (might contain in-line entities or entity sets). */ - private final List navigationLinks = new ArrayList(); + private final List navigationLinks = new ArrayList(); /** * Association links. */ - private final List associationLinks = new ArrayList(); + private final List associationLinks = new ArrayList(); - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); /** * Complex type fields. */ - private final Map fields = new LinkedHashMap(); + private final Map fields = new LinkedHashMap(); /** * Constructor. * * @param typeName type name. */ - public ODataComplexValueImpl(final String typeName) { + public ClientComplexValueImpl(final String typeName) { super(typeName); } @@ -65,7 +65,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo } @Override - public ODataEnumValue asEnum() { + public ClientEnumValue asEnum() { return null; } @@ -75,7 +75,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo } @Override - public boolean addLink(final ODataLink link) { + public boolean addLink(final ClientLink link) { boolean result = false; switch (link.getType()) { @@ -98,13 +98,13 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo } @Override - public boolean removeLink(final ODataLink link) { + public boolean removeLink(final ClientLink link) { return associationLinks.remove(link) || navigationLinks.remove(link); } - private ODataLink getLink(final List links, final String name) { - ODataLink result = null; - for (ODataLink link : links) { + private ClientLink getLink(final List links, final String name) { + ClientLink result = null; + for (ClientLink link : links) { if (name.equals(link.getName())) { result = link; break; @@ -115,29 +115,29 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo } @Override - public ODataLink getNavigationLink(final String name) { + public ClientLink getNavigationLink(final String name) { return getLink(navigationLinks, name); } @Override - public List getNavigationLinks() { + public List getNavigationLinks() { return navigationLinks; } @Override - public ODataLink getAssociationLink(final String name) { + public ClientLink getAssociationLink(final String name) { return getLink(associationLinks, name); } @Override - public List getAssociationLinks() { + public List getAssociationLinks() { return associationLinks; } @Override public Map asJavaMap() { final Map result = new LinkedHashMap(); - for (Map.Entry entry : fields.entrySet()) { + for (Map.Entry entry : fields.entrySet()) { Object value = null; if (entry.getValue().hasPrimitiveValue()) { value = entry.getValue().getPrimitiveValue().toValue(); @@ -156,7 +156,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo } @Override - public List getAnnotations() { + public List getAnnotations() { return annotations; } @@ -166,7 +166,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo * @param field field to be added. */ @Override - public ODataComplexValue add(final ODataProperty field) { + public ClientComplexValue add(final ClientProperty field) { fields.put(field.getName(), field); return this; } @@ -178,7 +178,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo * @return requested field. */ @Override - public ODataProperty get(final String name) { + public ClientProperty get(final String name) { return fields.get(name); } @@ -188,7 +188,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo * @return fields iterator. */ @Override - public Iterator iterator() { + public Iterator iterator() { return fields.values().iterator(); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeletedEntityImpl.java similarity index 82% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeletedEntityImpl.java index 4021996d6..9df7a1852 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeletedEntityImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeletedEntityImpl.java @@ -18,18 +18,18 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.ODataDeletedEntity; -import org.apache.olingo.commons.api.domain.ODataItem; +import org.apache.olingo.commons.api.domain.ClientDeletedEntity; +import org.apache.olingo.commons.api.domain.ClientItem; import java.net.URI; -public class ODataDeletedEntityImpl extends ODataItem implements ODataDeletedEntity { +public class ClientDeletedEntityImpl extends ClientItem implements ClientDeletedEntity { private URI id; private Reason reason; - public ODataDeletedEntityImpl() { + public ClientDeletedEntityImpl() { super(null); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaImpl.java similarity index 58% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaImpl.java index f8d6fdff6..1c1e5212c 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaImpl.java @@ -18,42 +18,42 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.ODataDeletedEntity; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataDeltaLink; +import org.apache.olingo.commons.api.domain.ClientDeletedEntity; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientDeltaLink; import java.net.URI; import java.util.ArrayList; import java.util.List; -public class ODataDeltaImpl extends ODataEntitySetImpl implements ODataDelta { +public class ClientDeltaImpl extends ClientEntitySetImpl implements ClientDelta { - private final List deletedEntities = new ArrayList(); + private final List deletedEntities = new ArrayList(); - private final List addedLinks = new ArrayList(); + private final List addedLinks = new ArrayList(); - private final List deletedLinks = new ArrayList(); + private final List deletedLinks = new ArrayList(); - public ODataDeltaImpl() { + public ClientDeltaImpl() { super(); } - public ODataDeltaImpl(final URI next) { + public ClientDeltaImpl(final URI next) { super(next); } @Override - public List getDeletedEntities() { + public List getDeletedEntities() { return deletedEntities; } @Override - public List getAddedLinks() { + public List getAddedLinks() { return addedLinks; } @Override - public List getDeletedLinks() { + public List getDeletedLinks() { return deletedLinks; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaLinkImpl.java similarity index 78% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaLinkImpl.java index 5a39382cd..a21f7ae8b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataDeltaLinkImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientDeltaLinkImpl.java @@ -18,15 +18,15 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataDeltaLink; -import org.apache.olingo.commons.api.domain.ODataItem; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientDeltaLink; +import org.apache.olingo.commons.api.domain.ClientItem; import java.net.URI; import java.util.ArrayList; import java.util.List; -public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink { +public class ClientDeltaLinkImpl extends ClientItem implements ClientDeltaLink { private URI source; @@ -34,9 +34,9 @@ public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink { private URI target; - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); - public ODataDeltaLinkImpl() { + public ClientDeltaLinkImpl() { super(null); } @@ -71,7 +71,7 @@ public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink { } @Override - public List getAnnotations() { + public List getAnnotations() { return annotations; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntityImpl.java similarity index 70% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntityImpl.java index f3bbe0c6b..0c2ef2907 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntityImpl.java @@ -23,16 +23,16 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.apache.olingo.commons.api.domain.AbstractODataPayload; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; +import org.apache.olingo.commons.api.domain.AbstractClientPayload; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; import org.apache.olingo.commons.api.edm.FullQualifiedName; -public class ODataEntityImpl extends AbstractODataPayload implements ODataEntity, ODataSingleton { +public class ClientEntityImpl extends AbstractClientPayload implements ClientEntity, ClientSingleton { /** * Entity id. @@ -63,29 +63,29 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit */ private URI editLink; - private final List properties = new ArrayList(); + private final List properties = new ArrayList(); - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); private final FullQualifiedName typeName; /** * Navigation links (might contain in-line entities or entity sets). */ - private final List navigationLinks = new ArrayList(); + private final List navigationLinks = new ArrayList(); /** * Association links. */ - private final List associationLinks = new ArrayList(); + private final List associationLinks = new ArrayList(); /** * Media edit links. */ - private final List mediaEditLinks = new ArrayList(); + private final List mediaEditLinks = new ArrayList(); /** * Operations (legacy, functions, actions). */ - private final List operations = new ArrayList(); + private final List operations = new ArrayList(); - public ODataEntityImpl(final FullQualifiedName typeName) { + public ClientEntityImpl(final FullQualifiedName typeName) { super(typeName == null ? null : typeName.toString()); this.typeName = typeName; } @@ -106,9 +106,9 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit } @Override - public ODataOperation getOperation(final String title) { - ODataOperation result = null; - for (ODataOperation operation : operations) { + public ClientOperation getOperation(final String title) { + ClientOperation result = null; + for (ClientOperation operation : operations) { if (title.equals(operation.getTitle())) { result = operation; break; @@ -124,17 +124,17 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit * @return operations. */ @Override - public List getOperations() { + public List getOperations() { return operations; } @Override - public ODataProperty getProperty(final String name) { - ODataProperty result = null; + public ClientProperty getProperty(final String name) { + ClientProperty result = null; if (StringUtils.isNotBlank(name)) { - for (ODataProperty property : getProperties()) { + for (ClientProperty property : getProperties()) { if (name.equals(property.getName())) { result = property; break; @@ -146,7 +146,7 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit } @Override - public boolean addLink(final ODataLink link) { + public boolean addLink(final ClientLink link) { boolean result = false; switch (link.getType()) { @@ -170,13 +170,13 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit } @Override - public boolean removeLink(final ODataLink link) { + public boolean removeLink(final ClientLink link) { return associationLinks.remove(link) || navigationLinks.remove(link); } - private ODataLink getLink(final List links, final String name) { - ODataLink result = null; - for (ODataLink link : links) { + private ClientLink getLink(final List links, final String name) { + ClientLink result = null; + for (ClientLink link : links) { if (name.equals(link.getName())) { result = link; break; @@ -187,32 +187,32 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit } @Override - public ODataLink getNavigationLink(final String name) { + public ClientLink getNavigationLink(final String name) { return getLink(navigationLinks, name); } @Override - public List getNavigationLinks() { + public List getNavigationLinks() { return navigationLinks; } @Override - public ODataLink getAssociationLink(final String name) { + public ClientLink getAssociationLink(final String name) { return getLink(associationLinks, name); } @Override - public List getAssociationLinks() { + public List getAssociationLinks() { return associationLinks; } @Override - public ODataLink getMediaEditLink(final String name) { + public ClientLink getMediaEditLink(final String name) { return getLink(mediaEditLinks, name); } @Override - public List getMediaEditLinks() { + public List getMediaEditLinks() { return mediaEditLinks; } @@ -287,12 +287,12 @@ public class ODataEntityImpl extends AbstractODataPayload implements ODataEntit } @Override - public List getProperties() { + public List getProperties() { return properties; } @Override - public List getAnnotations() { + public List getAnnotations() { return annotations; } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntitySetImpl.java similarity index 66% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntitySetImpl.java index b6853c139..4e4d79bbe 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEntitySetImpl.java @@ -18,32 +18,32 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; import java.net.URI; import java.util.ArrayList; import java.util.List; -public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet { +public class ClientEntitySetImpl extends AbstractClientEntitySet implements ClientEntitySet { private URI deltaLink; - private final List entities = new ArrayList(); + private final List entities = new ArrayList(); - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); - public ODataEntitySetImpl() { + public ClientEntitySetImpl() { super(); } - public ODataEntitySetImpl(final URI next) { + public ClientEntitySetImpl(final URI next) { super(next); } @Override - public List getEntities() { + public List getEntities() { return entities; } @@ -58,7 +58,7 @@ public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataE } @Override - public List getAnnotations() { + public List getAnnotations() { return annotations; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEnumValueImpl.java similarity index 79% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEnumValueImpl.java index 9ef7ed132..12634d4e3 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEnumValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientEnumValueImpl.java @@ -18,14 +18,14 @@ */ package org.apache.olingo.commons.core.domain; -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; +import org.apache.olingo.commons.api.domain.AbstractClientValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; -public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue { +public class ClientEnumValueImpl extends AbstractClientValue implements ClientEnumValue { private final String value; - public ODataEnumValueImpl(final String typeName, final String value) { + public ClientEnumValueImpl(final String typeName, final String value) { super(typeName); this.value = value; } @@ -41,7 +41,7 @@ public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumV } @Override - public ODataEnumValue asEnum() { + public ClientEnumValue asEnum() { return this; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientObjectFactoryImpl.java new file mode 100644 index 000000000..ed4692f9e --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientObjectFactoryImpl.java @@ -0,0 +1,155 @@ +/* + * 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.commons.core.domain; + +import java.net.URI; + +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientDelta; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientInlineEntity; +import org.apache.olingo.commons.api.domain.ClientInlineEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientObjectFactory; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientSingleton; +import org.apache.olingo.commons.api.domain.ClientValue; +import org.apache.olingo.commons.api.edm.FullQualifiedName; + +public class ClientObjectFactoryImpl implements ClientObjectFactory { + + @Override + public ClientInlineEntitySet newDeepInsertEntitySet(final String name, final ClientEntitySet entitySet) { + return new ClientInlineEntitySet(null, ClientLinkType.ENTITY_SET_NAVIGATION, name, entitySet); + } + + @Override + public ClientInlineEntity newDeepInsertEntity(final String name, final ClientEntity entity) { + return new ClientInlineEntity(null, ClientLinkType.ENTITY_NAVIGATION, name, entity); + } + + @Override + public ClientEntitySet newEntitySet() { + return new ClientEntitySetImpl(); + } + + @Override + public ClientEntitySet newEntitySet(final URI next) { + return new ClientEntitySetImpl(next); + } + + @Override + public ClientEntity newEntity(final FullQualifiedName typeName) { + return new ClientEntityImpl(typeName); + } + + @Override + public ClientEntity newEntity(final FullQualifiedName typeName, final URI link) { + final ClientEntityImpl result = new ClientEntityImpl(typeName); + result.setLink(link); + return result; + } + + @Override + public ClientSingleton newSingleton(final FullQualifiedName typeName) { + return new ClientEntityImpl(typeName); + } + + @Override + public ClientLink newEntityNavigationLink(final String name, final URI link) { + return new ClientLink.Builder().setURI(link). + setType(ClientLinkType.ENTITY_NAVIGATION).setTitle(name).build(); + } + + @Override + public ClientLink newEntitySetNavigationLink(final String name, final URI link) { + return new ClientLink.Builder().setURI(link). + setType(ClientLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build(); + } + + @Override + public ClientLink newAssociationLink(final String name, final URI link) { + return new ClientLink.Builder().setURI(link). + setType(ClientLinkType.ASSOCIATION).setTitle(name).build(); + } + + @Override + public ClientLink newMediaEditLink(final String name, final URI link) { + return new ClientLink.Builder().setURI(link). + setType(ClientLinkType.MEDIA_EDIT).setTitle(name).build(); + } + + @Override + public ClientPrimitiveValue.Builder newPrimitiveValueBuilder() { + return new ClientPrimitiveValueImpl.BuilderImpl(); + } + + @Override + public ClientEnumValue newEnumValue(final String typeName, final String value) { + return new ClientEnumValueImpl(typeName, value); + } + + @Override + public ClientComplexValue newComplexValue(final String typeName) { + return new ClientComplexValueImpl(typeName); + } + + @Override + public ClientCollectionValue newCollectionValue(final String typeName) { + return new ClientCollectionValueImpl(typeName); + } + + @Override + public ClientProperty newPrimitiveProperty(final String name, final ClientPrimitiveValue value) { + return new ClientPropertyImpl(name, value); + } + + @Override + public ClientProperty newComplexProperty(final String name, final ClientComplexValue value) { + + return new ClientPropertyImpl(name, value); + } + + @Override + public ClientProperty newCollectionProperty(final String name, + final ClientCollectionValue value) { + + return new ClientPropertyImpl(name, value); + } + + @Override + public ClientProperty newEnumProperty(final String name, final ClientEnumValue value) { + return new ClientPropertyImpl(name, value); + } + + @Override + public ClientDelta newDelta() { + return new ClientDeltaImpl(); + } + + @Override + public ClientDelta newDelta(final URI next) { + return new ClientDeltaImpl(next); + } +} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPrimitiveValueImpl.java similarity index 82% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPrimitiveValueImpl.java index 64ef5dbb3..0f6ad2be5 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPrimitiveValueImpl.java @@ -21,10 +21,10 @@ package org.apache.olingo.commons.core.domain; import java.util.UUID; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.AbstractODataValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.AbstractClientValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -32,14 +32,14 @@ import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; -public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataValue, ODataPrimitiveValue { +public class ClientPrimitiveValueImpl extends AbstractClientValue implements ClientValue, ClientPrimitiveValue { public static class BuilderImpl implements Builder { - private final ODataPrimitiveValueImpl instance; + private final ClientPrimitiveValueImpl instance; public BuilderImpl() { - instance = new ODataPrimitiveValueImpl(); + instance = new ClientPrimitiveValueImpl(); } @Override @@ -81,7 +81,7 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData } @Override - public ODataPrimitiveValue build() { + public ClientPrimitiveValue build() { if (instance.type == null) { setType(EdmPrimitiveTypeKind.String); } @@ -89,47 +89,47 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData } @Override - public ODataPrimitiveValue buildBoolean(final Boolean value) { + public ClientPrimitiveValue buildBoolean(final Boolean value) { return setType(EdmPrimitiveTypeKind.Boolean).setValue(value).build(); } @Override - public ODataPrimitiveValue buildInt16(final Short value) { + public ClientPrimitiveValue buildInt16(final Short value) { return setType(EdmPrimitiveTypeKind.Int16).setValue(value).build(); } @Override - public ODataPrimitiveValue buildInt32(final Integer value) { + public ClientPrimitiveValue buildInt32(final Integer value) { return setType(EdmPrimitiveTypeKind.Int32).setValue(value).build(); } @Override - public ODataPrimitiveValue buildInt64(final Long value) { + public ClientPrimitiveValue buildInt64(final Long value) { return setType(EdmPrimitiveTypeKind.Int64).setValue(value).build(); } @Override - public ODataPrimitiveValue buildSingle(final Float value) { + public ClientPrimitiveValue buildSingle(final Float value) { return setType(EdmPrimitiveTypeKind.Single).setValue(value).build(); } @Override - public ODataPrimitiveValue buildDouble(final Double value) { + public ClientPrimitiveValue buildDouble(final Double value) { return setType(EdmPrimitiveTypeKind.Double).setValue(value).build(); } @Override - public ODataPrimitiveValue buildString(final String value) { + public ClientPrimitiveValue buildString(final String value) { return setType(EdmPrimitiveTypeKind.String).setValue(value).build(); } @Override - public ODataPrimitiveValue buildGuid(final UUID value) { + public ClientPrimitiveValue buildGuid(final UUID value) { return setType(EdmPrimitiveTypeKind.Guid).setValue(value).build(); } @Override - public ODataPrimitiveValue buildBinary(final byte[] value) { + public ClientPrimitiveValue buildBinary(final byte[] value) { return setType(EdmPrimitiveTypeKind.Binary).setValue(value).build(); } @@ -150,7 +150,7 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData */ private Object value; - protected ODataPrimitiveValueImpl() { + protected ClientPrimitiveValueImpl() { super(null); } @@ -210,7 +210,7 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData } @Override - public ODataEnumValue asEnum() { + public ClientEnumValue asEnum() { return null; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPropertyImpl.java similarity index 71% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPropertyImpl.java index da1bba1f0..e53c94bb8 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientPropertyImpl.java @@ -23,28 +23,28 @@ import java.util.List; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotatable; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotatable; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValuable; +import org.apache.olingo.commons.api.domain.ClientValue; -public class ODataPropertyImpl implements ODataProperty, ODataAnnotatable, ODataValuable { +public class ClientPropertyImpl implements ClientProperty, ClientAnnotatable, ClientValuable { - private final List annotations = new ArrayList(); + private final List annotations = new ArrayList(); private final String name; - private final ODataValue value; - private final ODataValuable valuable; + private final ClientValue value; + private final ClientValuable valuable; - public ODataPropertyImpl(final String name, final ODataValue value) { + public ClientPropertyImpl(final String name, final ClientValue value) { this.name = name; this.value = value; - this.valuable = new ODataValuableImpl(value); + this.valuable = new ClientValuableImpl(value); } /** @@ -63,7 +63,7 @@ public class ODataPropertyImpl implements ODataProperty, ODataAnnotatable, OData * @return property value. */ @Override - public ODataValue getValue() { + public ClientValue getValue() { return value; } @@ -93,7 +93,7 @@ public class ODataPropertyImpl implements ODataProperty, ODataAnnotatable, OData * @return primitive value if exists; null otherwise. */ @Override - public ODataPrimitiveValue getPrimitiveValue() { + public ClientPrimitiveValue getPrimitiveValue() { return hasPrimitiveValue() ? value.asPrimitive() : null; } @@ -133,22 +133,22 @@ public class ODataPropertyImpl implements ODataProperty, ODataAnnotatable, OData } @Override - public ODataEnumValue getEnumValue() { + public ClientEnumValue getEnumValue() { return valuable.getEnumValue(); } @Override - public ODataComplexValue getComplexValue() { + public ClientComplexValue getComplexValue() { return valuable.getComplexValue(); } @Override - public ODataCollectionValue getCollectionValue() { + public ClientCollectionValue getCollectionValue() { return valuable.getCollectionValue(); } @Override - public List getAnnotations() { + public List getAnnotations() { return annotations; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientValuableImpl.java similarity index 74% rename from lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java rename to lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientValuableImpl.java index dbb65eef5..561d3df97 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ClientValuableImpl.java @@ -22,23 +22,23 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientValuable; +import org.apache.olingo.commons.api.domain.ClientValue; -public class ODataValuableImpl implements ODataValuable { +public class ClientValuableImpl implements ClientValuable { - private final ODataValue value; + private final ClientValue value; - public ODataValuableImpl(final ODataValue value) { + public ClientValuableImpl(final ClientValue value) { this.value = value; } @Override - public ODataValue getValue() { + public ClientValue getValue() { return value; } @@ -53,7 +53,7 @@ public class ODataValuableImpl implements ODataValuable { } @Override - public ODataPrimitiveValue getPrimitiveValue() { + public ClientPrimitiveValue getPrimitiveValue() { return hasPrimitiveValue() ? value.asPrimitive() : null; } @@ -63,9 +63,9 @@ public class ODataValuableImpl implements ODataValuable { } @Override - public ODataCollectionValue getCollectionValue() { + public ClientCollectionValue getCollectionValue() { return hasCollectionValue() - ? getValue(). asCollection() + ? getValue(). asCollection() : null; } @@ -75,7 +75,7 @@ public class ODataValuableImpl implements ODataValuable { } @Override - public ODataComplexValue getComplexValue() { + public ClientComplexValue getComplexValue() { return hasComplexValue() ? getValue().asComplex() : null; @@ -87,7 +87,7 @@ public class ODataValuableImpl implements ODataValuable { } @Override - public ODataEnumValue getEnumValue() { + public ClientEnumValue getEnumValue() { return hasEnumValue() ? getValue().asEnum() : null; diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java deleted file mode 100644 index eb82364a6..000000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java +++ /dev/null @@ -1,155 +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.commons.core.domain; - -import java.net.URI; - -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataDelta; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataInlineEntity; -import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataObjectFactory; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataSingleton; -import org.apache.olingo.commons.api.domain.ODataValue; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -public class ODataObjectFactoryImpl implements ODataObjectFactory { - - @Override - public ODataInlineEntitySet newDeepInsertEntitySet(final String name, final ODataEntitySet entitySet) { - return new ODataInlineEntitySet(null, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet); - } - - @Override - public ODataInlineEntity newDeepInsertEntity(final String name, final ODataEntity entity) { - return new ODataInlineEntity(null, ODataLinkType.ENTITY_NAVIGATION, name, entity); - } - - @Override - public ODataEntitySet newEntitySet() { - return new ODataEntitySetImpl(); - } - - @Override - public ODataEntitySet newEntitySet(final URI next) { - return new ODataEntitySetImpl(next); - } - - @Override - public ODataEntity newEntity(final FullQualifiedName typeName) { - return new ODataEntityImpl(typeName); - } - - @Override - public ODataEntity newEntity(final FullQualifiedName typeName, final URI link) { - final ODataEntityImpl result = new ODataEntityImpl(typeName); - result.setLink(link); - return result; - } - - @Override - public ODataSingleton newSingleton(final FullQualifiedName typeName) { - return new ODataEntityImpl(typeName); - } - - @Override - public ODataLink newEntityNavigationLink(final String name, final URI link) { - return new ODataLink.Builder().setURI(link). - setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build(); - } - - @Override - public ODataLink newEntitySetNavigationLink(final String name, final URI link) { - return new ODataLink.Builder().setURI(link). - setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build(); - } - - @Override - public ODataLink newAssociationLink(final String name, final URI link) { - return new ODataLink.Builder().setURI(link). - setType(ODataLinkType.ASSOCIATION).setTitle(name).build(); - } - - @Override - public ODataLink newMediaEditLink(final String name, final URI link) { - return new ODataLink.Builder().setURI(link). - setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build(); - } - - @Override - public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() { - return new ODataPrimitiveValueImpl.BuilderImpl(); - } - - @Override - public ODataEnumValue newEnumValue(final String typeName, final String value) { - return new ODataEnumValueImpl(typeName, value); - } - - @Override - public ODataComplexValue newComplexValue(final String typeName) { - return new ODataComplexValueImpl(typeName); - } - - @Override - public ODataCollectionValue newCollectionValue(final String typeName) { - return new ODataCollectionValueImpl(typeName); - } - - @Override - public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) { - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) { - - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newCollectionProperty(final String name, - final ODataCollectionValue value) { - - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) { - return new ODataPropertyImpl(name, value); - } - - @Override - public ODataDelta newDelta() { - return new ODataDeltaImpl(); - } - - @Override - public ODataDelta newDelta(final URI next) { - return new ODataDeltaImpl(next); - } -} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java index 15658ab10..7adeb3e87 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java @@ -23,38 +23,38 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression; import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression; import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression; -import org.apache.olingo.commons.core.domain.ODataCollectionValueImpl; -import org.apache.olingo.commons.core.domain.ODataEnumValueImpl; -import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl; +import org.apache.olingo.commons.core.domain.ClientCollectionValueImpl; +import org.apache.olingo.commons.core.domain.ClientEnumValueImpl; +import org.apache.olingo.commons.core.domain.ClientPrimitiveValueImpl; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotationExpression { - private final ODataValue value; + private final ClientValue value; public EdmConstantAnnotationExpressionImpl(final ConstantAnnotationExpression constExprConstruct) { if (constExprConstruct.getType() == ConstantAnnotationExpression.Type.EnumMember) { - final List enumValues = new ArrayList(); + final List enumValues = new ArrayList(); String enumTypeName = null; for (String split : StringUtils.split(constExprConstruct.getValue(), ' ')) { final String[] enumSplit = StringUtils.split(split, '/'); enumTypeName = enumSplit[0]; - enumValues.add(new ODataEnumValueImpl(enumSplit[0], enumSplit[1])); + enumValues.add(new ClientEnumValueImpl(enumSplit[0], enumSplit[1])); } if (enumValues.size() == 1) { value = enumValues.get(0); } else { - final ODataCollectionValueImpl collValue - = new ODataCollectionValueImpl(enumTypeName); - for (ODataValue enumValue : enumValues) { + final ClientCollectionValueImpl collValue + = new ClientCollectionValueImpl(enumTypeName); + for (ClientValue enumValue : enumValues) { collValue.add(enumValue); } value = collValue; @@ -96,7 +96,7 @@ public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotatio default: kind = EdmPrimitiveTypeKind.String; } - final ODataPrimitiveValueImpl.BuilderImpl primitiveValueBuilder = new ODataPrimitiveValueImpl.BuilderImpl(); + final ClientPrimitiveValueImpl.BuilderImpl primitiveValueBuilder = new ClientPrimitiveValueImpl.BuilderImpl(); primitiveValueBuilder.setType(kind); try { final EdmPrimitiveType primitiveType = EdmPrimitiveTypeFactory.getInstance(kind); @@ -133,7 +133,7 @@ public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotatio } @Override - public ODataValue getValue() { + public ClientValue getValue() { return value; } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java index 26cafc237..460e3678e 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java @@ -50,9 +50,9 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataPropertyType; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientPropertyType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -214,7 +214,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setValue(valueType, values); } - private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo) + private ClientPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo) throws XMLStreamException { XMLEvent child = null; @@ -227,24 +227,24 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - final ODataPropertyType type; + final ClientPropertyType type; if (child == null) { - type = typeInfo == null || typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.ENUM; + type = typeInfo == null || typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE : ClientPropertyType.ENUM; } else { if (child.isStartElement()) { if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; } else if (elementQName.equals(child.asStartElement().getName())) { - type = ODataPropertyType.COLLECTION; + type = ClientPropertyType.COLLECTION; } else { - type = ODataPropertyType.COMPLEX; + type = ClientPropertyType.COMPLEX; } } else if (child.isCharacters()) { type = typeInfo == null || typeInfo.isPrimitiveType() - ? ODataPropertyType.PRIMITIVE - : ODataPropertyType.ENUM; + ? ClientPropertyType.PRIMITIVE + : ClientPropertyType.ENUM; } else { - type = ODataPropertyType.EMPTY; + type = ClientPropertyType.EMPTY; } } @@ -286,9 +286,9 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setType(typeInfo.internal()); } - final ODataPropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) : - typeInfo.isCollection() ? ODataPropertyType.COLLECTION : - typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.COMPLEX; + final ClientPropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) : + typeInfo.isCollection() ? ClientPropertyType.COLLECTION : + typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE : ClientPropertyType.COMPLEX; if (nullAttr == null) { switch (propType) { @@ -316,10 +316,10 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY); } } else { - valuable.setValue(propType == ODataPropertyType.PRIMITIVE ? ValueType.PRIMITIVE : - propType == ODataPropertyType.ENUM ? ValueType.ENUM : - propType == ODataPropertyType.COMPLEX ? ValueType.COMPLEX : - propType == ODataPropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE, + valuable.setValue(propType == ClientPropertyType.PRIMITIVE ? ValueType.PRIMITIVE : + propType == ClientPropertyType.ENUM ? ValueType.ENUM : + propType == ClientPropertyType.COMPLEX ? ValueType.COMPLEX : + propType == ClientPropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE, null); } } @@ -649,7 +649,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria entity.getMediaEditLinks().add(link); } } else if (actionQName.equals(event.asStartElement().getName())) { - final ODataOperation operation = new ODataOperation(); + final ClientOperation operation = new ClientOperation(); final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA)); if (metadata != null) { @@ -800,8 +800,8 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - private ODataError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException { - final ODataError error = new ODataError(); + private ClientError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException { + final ClientError error = new ClientError(); boolean setCode = false; boolean codeSet = false; @@ -851,7 +851,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } @Override - public ODataError toError(final InputStream input) throws ODataDeserializerException { + public ClientError toError(final InputStream input) throws ODataDeserializerException { try { final XMLEventReader reader = getReader(input); final StartElement start = skipBeforeFirstStartElement(reader); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java index 7543eacf7..52a1bd345 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java @@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.geo.Geospatial; @@ -302,7 +302,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize links(writer, entity.getMediaEditLinks()); if (serverMode) { - for (ODataOperation operation : entity.getOperations()) { + for (ClientOperation operation : entity.getOperations()) { writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_ACTION); writer.writeAttribute(Constants.ATTR_METADATA, operation.getMetadataAnchor()); writer.writeAttribute(Constants.ATTR_TITLE, operation.getTitle()); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java index c9c715a0d..9977b068d 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java @@ -43,9 +43,9 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataPropertyType; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientPropertyType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -100,11 +100,11 @@ public class JsonDeserializer implements ODataDeserializer { JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode); if (inline instanceof ObjectNode) { - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); link.setInlineEntity(entityDeserializer.doDeserialize(inline.traverse(codec)).getPayload()); } else if (inline instanceof ArrayNode) { - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); final EntityCollection entitySet = new EntityCollection(); for (final Iterator entries = inline.elements(); entries.hasNext();) { @@ -136,7 +136,7 @@ public class JsonDeserializer implements ODataDeserializer { if (field.getValue().isValueNode()) { link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); } linked.getNavigationLinks().add(link); @@ -148,7 +148,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_ASSOCIATION_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ASSOCIATION.toString()); + link.setType(ClientLinkType.ASSOCIATION.toString()); linked.getAssociationLinks().add(link); toRemove.add(field.getKey()); @@ -168,7 +168,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); linked.getNavigationLinks().add(link); toRemove.add(setInline(field.getKey(), suffix, tree, codec, link)); @@ -180,7 +180,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field)); link.setHref(node.asText()); - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); linked.getNavigationLinks().add(link); toRemove.add(setInline(field.getKey(), Constants.JSON_BIND_LINK_SUFFIX, tree, codec, link)); } @@ -189,32 +189,32 @@ public class JsonDeserializer implements ODataDeserializer { } } - private Map.Entry guessPropertyType(final JsonNode node) { - ODataPropertyType type; + private Map.Entry guessPropertyType(final JsonNode node) { + ClientPropertyType type; String typeExpression = null; if (node.isValueNode() || node.isNull()) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; typeExpression = guessPrimitiveTypeKind(node).getFullQualifiedName().toString(); } else if (node.isArray()) { - type = ODataPropertyType.COLLECTION; + type = ClientPropertyType.COLLECTION; if (node.has(0) && node.get(0).isValueNode()) { typeExpression = "Collection(" + guessPrimitiveTypeKind(node.get(0)) + ')'; } } else if (node.isObject()) { if (node.has(Constants.ATTR_TYPE)) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; typeExpression = "Edm.Geography" + node.get(Constants.ATTR_TYPE).asText(); } else { - type = ODataPropertyType.COMPLEX; + type = ClientPropertyType.COMPLEX; } } else { - type = ODataPropertyType.EMPTY; + type = ClientPropertyType.EMPTY; } final EdmTypeInfo typeInfo = typeExpression == null ? null : new EdmTypeInfo.Builder().setTypeExpression(typeExpression).build(); - return new SimpleEntry(type, typeInfo); + return new SimpleEntry(type, typeInfo); } private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) { @@ -337,15 +337,15 @@ public class JsonDeserializer implements ODataDeserializer { EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType()) ? null : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build(); - final Map.Entry guessed = guessPropertyType(node); + final Map.Entry guessed = guessPropertyType(node); if (typeInfo == null) { typeInfo = guessed.getValue(); } - final ODataPropertyType propType = typeInfo == null ? guessed.getKey() - : typeInfo.isCollection() ? ODataPropertyType.COLLECTION - : typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE - : node.isValueNode() ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX; + final ClientPropertyType propType = typeInfo == null ? guessed.getKey() + : typeInfo.isCollection() ? ClientPropertyType.COLLECTION + : typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE + : node.isValueNode() ? ClientPropertyType.ENUM : ClientPropertyType.COMPLEX; switch (propType) { case COLLECTION: @@ -411,7 +411,7 @@ public class JsonDeserializer implements ODataDeserializer { } @Override - public ODataError toError(final InputStream input) throws ODataDeserializerException { + public ClientError toError(final InputStream input) throws ODataDeserializerException { try { parser = new JsonFactory(new ObjectMapper()).createParser(input); return new JsonODataErrorDeserializer(serverMode).doDeserialize(parser); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java index 703f6b6ed..47a25981f 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java @@ -35,8 +35,8 @@ import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.core.edm.EdmTypeInfo; @@ -154,7 +154,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_MEDIA_EDIT_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.MEDIA_EDIT.toString()); + link.setType(ClientLinkType.MEDIA_EDIT.toString()); entity.getMediaEditLinks().add(link); if (tree.has(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG))) { @@ -174,7 +174,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { } toRemove.add(field.getKey()); } else if (field.getKey().charAt(0) == '#') { - final ODataOperation operation = new ODataOperation(); + final ClientOperation operation = new ClientOperation(); operation.setMetadataAnchor(field.getKey()); final ObjectNode opNode = (ObjectNode) tree.get(field.getKey()); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java index b6a32ef14..9f5866415 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.core.edm.EdmTypeInfo; @@ -122,7 +122,7 @@ public class JsonEntitySerializer extends JsonSerializer { } if (serverMode) { - for (ODataOperation operation : entity.getOperations()) { + for (ClientOperation operation : entity.getOperations()) { jgen.writeObjectFieldStart("#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#")); jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle()); jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString()); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java index 89252dca3..9e225adef 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; @@ -38,9 +38,9 @@ public class JsonODataErrorDeserializer extends JsonDeserializer { super(serverMode); } - protected ODataError doDeserialize(final JsonParser parser) throws IOException { + protected ClientError doDeserialize(final JsonParser parser) throws IOException { - final ODataError error = new ODataError(); + final ClientError error = new ClientError(); final ObjectNode tree = parser.getCodec().readTree(parser); if (tree.has(Constants.JSON_ERROR)) { @@ -61,7 +61,7 @@ public class JsonODataErrorDeserializer extends JsonDeserializer { error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue()); } if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) { - List details = new ArrayList(); + List details = new ArrayList(); JsonODataErrorDetailDeserializer detailDeserializer = new JsonODataErrorDetailDeserializer(serverMode); for (JsonNode jsonNode : errorNode.get(Constants.ERROR_DETAILS)) { details.add(detailDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec())) diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java index 138bad3c5..0b5cddb6a 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; @@ -34,9 +34,9 @@ public class JsonODataErrorDetailDeserializer extends JsonDeserializer { super(serverMode); } - protected ResWrap doDeserialize(final JsonParser parser) throws IOException { + protected ResWrap doDeserialize(final JsonParser parser) throws IOException { - final ODataErrorDetail error = new ODataErrorDetail(); + final ClientErrorDetail error = new ClientErrorDetail(); final JsonNode errorNode = parser.getCodec().readTree(parser); if (errorNode.has(Constants.ERROR_CODE)) { error.setCode(errorNode.get(Constants.ERROR_CODE).textValue()); @@ -53,6 +53,6 @@ public class JsonODataErrorDetailDeserializer extends JsonDeserializer { error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue()); } - return new ResWrap((URI) null, null, error); + return new ResWrap((URI) null, null, error); } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java index 84ed5f719..2eae51971 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java @@ -40,7 +40,7 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.geo.Geospatial; @@ -157,14 +157,14 @@ public class JsonSerializer implements ODataSerializer { valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm()); } - ODataLinkType type = null; + ClientLinkType type = null; try { - type = ODataLinkType.fromString(link.getRel(), link.getType()); + type = ClientLinkType.fromString(link.getRel(), link.getType()); } catch (IllegalArgumentException e) { // ignore } - if (type == ODataLinkType.ENTITY_SET_NAVIGATION) { + if (type == ClientLinkType.ENTITY_SET_NAVIGATION) { final List uris; if (entitySetLinks.containsKey(link.getTitle())) { uris = entitySetLinks.get(link.getTitle()); diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java similarity index 82% rename from lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java rename to lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java index 8b184b251..f64f0d0b7 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java @@ -22,13 +22,13 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; /** * Server error. */ -public class ODataServerError extends ODataError { +public class ClientServerError extends ClientError { private Exception exception; private int statusCode; @@ -46,7 +46,7 @@ public class ODataServerError extends ODataError { * Sets the locale. * @return this for method chaining */ - public ODataServerError setLocale(Locale locale) { + public ClientServerError setLocale(Locale locale) { this.locale = locale; return this; } @@ -63,7 +63,7 @@ public class ODataServerError extends ODataError { * Sets the exception. * @return this for method chaining */ - public ODataServerError setException(Exception exception) { + public ClientServerError setException(Exception exception) { this.exception = exception; return this; } @@ -81,7 +81,7 @@ public class ODataServerError extends ODataError { * @param statusCode the status code which this error results in * @return this for method chaining */ - public ODataServerError setStatusCode(int statusCode) { + public ClientServerError setStatusCode(int statusCode) { this.statusCode = statusCode; return this; } @@ -92,7 +92,7 @@ public class ODataServerError extends ODataError { * for the HTTP error code specified in the response. MAY be null. * @return this for method chaining */ - public ODataServerError setCode(String code) { + public ClientServerError setCode(String code) { super.setCode(code); return this; } @@ -102,7 +102,7 @@ public class ODataServerError extends ODataError { * language-dependent representation of the error. MUST not be null. * @return this for method chaining */ - public ODataServerError setMessage(String message) { + public ClientServerError setMessage(String message) { super.setMessage(message); return this; } @@ -112,7 +112,7 @@ public class ODataServerError extends ODataError { * property in error). MAY be null. * @return this for method chaining */ - public ODataServerError setTarget(String target) { + public ClientServerError setTarget(String target) { super.setTarget(target); return this; } @@ -121,7 +121,7 @@ public class ODataServerError extends ODataError { * Sets error details. * @return this for method chaining. */ - public ODataServerError setDetails(List details) { + public ClientServerError setDetails(List details) { super.setDetails(details); return this; } @@ -130,7 +130,7 @@ public class ODataServerError extends ODataError { * Sets server defined key-value pairs for debug environment only. * @return this for method chaining. */ - public ODataServerError setInnerError(Map innerError) { + public ClientServerError setInnerError(Map innerError) { super.setInnerError(innerError); return this; } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java index f2da16e0a..fc5e37ab6 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java @@ -28,7 +28,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.api.serializer.SerializerException; @@ -71,7 +71,7 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce } @Override - public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + public void processError(ODataRequest request, ODataResponse response, ClientServerError serverError, ContentType requestedContentType) { try { ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType)); diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java index 145fb5b45..af2c11602 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java @@ -21,7 +21,7 @@ package org.apache.olingo.server.api.processor; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; /** * Processor which is called if any error/exception occurs inside the library or another processor. @@ -36,6 +36,6 @@ public interface ErrorProcessor extends Processor { * @param serverError the server error * @param responseFormat requested content type after content negotiation */ - public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + public void processError(ODataRequest request, ODataResponse response, ClientServerError serverError, ContentType responseFormat); } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java index c7f7bba4d..e82241546 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java @@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; /** OData serializer */ @@ -52,7 +52,7 @@ public interface ODataSerializer { * @param error the main error * @return inputStream containing the OData-formatted error */ - SerializerResult error(ODataServerError error) throws SerializerException; + SerializerResult error(ClientServerError error) throws SerializerException; /** * Writes entity-collection data into an InputStream. diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java index b83d383ab..d7fb341ee 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; import org.apache.olingo.server.api.deserializer.DeserializerException; @@ -55,40 +55,40 @@ public class ErrorHandler { public void handleException(Exception e, ODataRequest request, ODataResponse response) { if (e instanceof UriValidationException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriValidationException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriValidationException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserSemanticException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSemanticException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSemanticException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserSyntaxException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSyntaxException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSyntaxException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserException)e, null); handleServerError(request, response, serverError); } else if(e instanceof ContentNegotiatorException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((ContentNegotiatorException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((ContentNegotiatorException)e, null); handleServerError(request, response, serverError); } else if(e instanceof SerializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((SerializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((SerializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof BatchDeserializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((BatchDeserializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((BatchDeserializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof DeserializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((DeserializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((DeserializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof ODataHandlerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException)e, null); handleServerError(request, response, serverError); } else { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleServerError(request, response, serverError); } } void handleServerError(final ODataRequest request, final ODataResponse response, - final ODataServerError serverError) { + final ClientServerError serverError) { ContentType requestedContentType; try { UriInfo uriInfo = new Parser().parseUri(request.getRawODataPath(), request.getRawQueryPath(), @@ -103,7 +103,7 @@ public class ErrorHandler { processError(response, serverError, requestedContentType); } - void processError(ODataResponse response, ODataServerError serverError, + void processError(ODataResponse response, ClientServerError serverError, ContentType requestedContentType) { try { ODataSerializer serializer = this.odata.createSerializer(ODataFormat diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java index eb79c075f..6bbb706d0 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java @@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.EntitySerializerOptions; @@ -150,7 +150,7 @@ public class EntityResponse extends ServiceResponse { } } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java index 27675c366..e068bc557 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; @@ -82,7 +82,7 @@ public class EntitySetResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java index a6443582d..4f8719a59 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java @@ -23,7 +23,7 @@ import java.util.Map; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -61,7 +61,7 @@ public class MetadataResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java index 86ce46ffd..3326491c0 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java @@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; @@ -144,7 +144,7 @@ public class PropertyResponse extends ServiceResponse { writeNoContent(true); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java index 257f8c7ff..e20299a19 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java @@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; public class ResponseUtil { public static Property createPrimitive(final String name, final String type, final Object value) { @@ -62,7 +62,7 @@ public class ResponseUtil { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); link.setTitle(navigationPropertyName); entity.getNavigationLinks().add(link); } @@ -73,7 +73,7 @@ public class ResponseUtil { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); link.setTitle(navigationPropertyName); EntityCollection target = new EntityCollection(); target.getEntities().addAll(Arrays.asList(targets)); diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java index 0f3733c96..e8b74197d 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java @@ -23,7 +23,7 @@ import java.util.Map; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -62,7 +62,7 @@ public class ServiceDocumentResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java index e1625045f..e20ad2a23 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java @@ -22,7 +22,7 @@ import java.util.Locale; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ODataTranslatedException.ODataErrorMessage; import org.apache.olingo.server.api.deserializer.DeserializerException; @@ -34,14 +34,14 @@ import org.apache.olingo.server.core.uri.validator.UriValidationException; public class ODataExceptionHelper { - public static ODataServerError createServerErrorObject(UriValidationException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriValidationException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey()) || UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) { serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode()); @@ -51,8 +51,8 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(UriParserSyntaxException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserSyntaxException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode( UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT.equals(e.getMessageKey()) ? HttpStatusCode.NOT_ACCEPTABLE.getStatusCode() : @@ -60,20 +60,20 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(UriParserException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(ContentNegotiatorException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(ContentNegotiatorException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.NOT_ACCEPTABLE.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(ODataHandlerException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(ODataHandlerException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); if (ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED.equals(e.getMessageKey()) || ODataHandlerException.MessageKeys.PROCESSOR_NOT_IMPLEMENTED.equals(e.getMessageKey())) { serverError.setStatusCode(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode()); @@ -88,42 +88,42 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(SerializerException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(SerializerException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(final DeserializerException e, final Locale requestedLocale) { + public static ClientServerError createServerErrorObject(final DeserializerException e, final Locale requestedLocale) { return basicTranslatedError(e, requestedLocale) .setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); } - public static ODataServerError createServerErrorObject(ODataTranslatedException e, Locale requestedLocale) { + public static ClientServerError createServerErrorObject(ODataTranslatedException e, Locale requestedLocale) { return basicTranslatedError(e, requestedLocale); } - public static ODataServerError createServerErrorObject(ODataApplicationException e) { - ODataServerError serverError = basicServerError(e); + public static ClientServerError createServerErrorObject(ODataApplicationException e) { + ClientServerError serverError = basicServerError(e); serverError.setStatusCode(e.getStatusCode()); serverError.setLocale(e.getLocale()); serverError.setCode(e.getODataErrorCode()); return serverError; } - public static ODataServerError createServerErrorObject(Exception e) { - ODataServerError serverError = basicServerError(e); + public static ClientServerError createServerErrorObject(Exception e) { + ClientServerError serverError = basicServerError(e); serverError.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode()); serverError.setLocale(Locale.ENGLISH); return serverError; } - private static ODataServerError basicServerError(Exception e) { - return new ODataServerError().setException(e).setMessage(e.getMessage()); + private static ClientServerError basicServerError(Exception e) { + return new ClientServerError().setException(e).setMessage(e.getMessage()); } - private static ODataServerError basicTranslatedError(ODataTranslatedException e, Locale requestedLocale) { - ODataServerError serverError = basicServerError(e); + private static ClientServerError basicTranslatedError(ODataTranslatedException e, Locale requestedLocale) { + ClientServerError serverError = basicServerError(e); ODataErrorMessage translatedMessage = e.getTranslatedMessage(requestedLocale); serverError.setMessage(translatedMessage.getMessage()); serverError.setLocale(translatedMessage.getLocale()); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java index ad0bba040..282504a6f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java @@ -38,7 +38,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.deserializer.DeserializerException; import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor; @@ -111,34 +111,34 @@ public class ODataHandler { processInternal(request, response); } catch (final UriValidationException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserSemanticException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserSyntaxException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ContentNegotiatorException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (SerializerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (DeserializerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ODataHandlerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ODataApplicationException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleException(request, response, serverError); } catch (Exception e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleException(request, response, serverError); } return response; @@ -194,7 +194,7 @@ public class ODataHandler { } public void handleException(final ODataRequest request, final ODataResponse response, - final ODataServerError serverError) { + final ClientServerError serverError) { ErrorProcessor exceptionProcessor; try { diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java index 41750c72c..f7e7ecfcf 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java @@ -37,7 +37,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataHttpHandler; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.processor.Processor; @@ -80,7 +80,7 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler { private ODataResponse handleException(ODataRequest odRequest, Exception e) { ODataResponse resp = new ODataResponse(); - ODataServerError serverError; + ClientServerError serverError; if (e instanceof ODataHandlerException) { serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException) e, null); } else if (e instanceof ODataTranslatedException) { diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java index a6c3e8d15..e6ab0c936 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java @@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Parameter; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; @@ -358,14 +358,14 @@ public class ODataJsonDeserializer implements ODataDeserializer { final ExpandTreeBuilder childExpandBuilder = (expandBuilder != null) ? expandBuilder.expand(edmNavigationProperty) : null; if (jsonNode.isArray() && edmNavigationProperty.isCollection()) { - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); EntityCollection inlineEntitySet = new EntityCollection(); inlineEntitySet.getEntities().addAll(consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode, childExpandBuilder)); link.setInlineEntitySet(inlineEntitySet); } else if (!jsonNode.isArray() && (!jsonNode.isValueNode() || jsonNode.isNull()) && !edmNavigationProperty.isCollection()) { - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); if (!jsonNode.isNull()) { Entity inlineEntity = consumeEntityNode(edmNavigationProperty.getType(), (ObjectNode) jsonNode, childExpandBuilder); @@ -409,7 +409,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { } bindingLinkStrings.add(arrayValue.asText()); } - bindingLink.setType(ODataLinkType.ENTITY_COLLECTION_BINDING.toString()); + bindingLink.setType(ClientLinkType.ENTITY_COLLECTION_BINDING.toString()); bindingLink.setBindingLinks(bindingLinkStrings); } else { assertIsNullNode(key, jsonNode); @@ -418,7 +418,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key); } bindingLink.setBindingLink(jsonNode.asText()); - bindingLink.setType(ODataLinkType.ENTITY_BINDING.toString()); + bindingLink.setType(ClientLinkType.ENTITY_BINDING.toString()); } return bindingLink; } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java index 14381bbc0..354c81101 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java @@ -21,15 +21,15 @@ package org.apache.olingo.server.core.serializer.json; import java.io.IOException; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import org.apache.olingo.server.api.serializer.SerializerException; import com.fasterxml.jackson.core.JsonGenerator; public class ODataErrorSerializer { - public void writeErrorDocument(JsonGenerator json, final ODataError error) + public void writeErrorDocument(JsonGenerator json, final ClientError error) throws IOException, SerializerException { if (error == null) { throw new SerializerException("ODataError object MUST NOT be null!", @@ -43,7 +43,7 @@ public class ODataErrorSerializer { if (error.getDetails() != null) { json.writeArrayFieldStart(Constants.ERROR_DETAILS); - for (ODataErrorDetail detail : error.getDetails()) { + for (ClientErrorDetail detail : error.getDetails()) { json.writeStartObject(); writeODataError(json, detail.getCode(), detail.getMessage(), detail.getTarget()); json.writeEndObject(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java index 1de8562dc..3fe4fcb75 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java @@ -43,7 +43,7 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; @@ -115,7 +115,7 @@ public class ODataJsonSerializer implements ODataSerializer { } @Override - public SerializerResult error(final ODataServerError error) throws SerializerException { + public SerializerResult error(final ClientServerError error) throws SerializerException { CircleStreamBuffer buffer = new CircleStreamBuffer(); try { JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream()); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java index 2213c5a2b..67634955b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java @@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; @@ -102,7 +102,7 @@ public class ODataXmlSerializerImpl implements ODataSerializer { } @Override - public SerializerResult error(ODataServerError error) throws SerializerException { + public SerializerResult error(ClientServerError error) throws SerializerException { throw new SerializerException("error serialization not implemented for XML format", SerializerException.MessageKeys.NOT_IMPLEMENTED); } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ClientErrorSerializerTest.java similarity index 81% rename from lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java rename to lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ClientErrorSerializerTest.java index de5a25e5b..c30a719c3 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ClientErrorSerializerTest.java @@ -26,10 +26,10 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.io.IOUtils; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.server.api.OData; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.api.serializer.SerializerException; import org.junit.Before; @@ -39,7 +39,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.JsonNodeType; -public class ODataErrorSerializerTest { +public class ClientErrorSerializerTest { ODataSerializer ser; @@ -50,7 +50,7 @@ public class ODataErrorSerializerTest { @Test public void basicODataErrorNoCode() throws Exception { - ODataServerError error = new ODataServerError(); + ClientServerError error = new ClientServerError(); error.setMessage("ErrorMessage"); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); @@ -59,7 +59,7 @@ public class ODataErrorSerializerTest { @Test public void basicODataErrorWithCode() throws Exception { - ODataServerError error = new ODataServerError(); + ClientServerError error = new ClientServerError(); error.setCode("Code").setMessage("ErrorMessage"); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); @@ -68,7 +68,7 @@ public class ODataErrorSerializerTest { @Test public void basicODataErrorWithCodeAndTarget() throws Exception { - ODataServerError error = new ODataServerError(); + ClientServerError error = new ClientServerError(); error.setCode("Code").setMessage("ErrorMessage").setTarget("Target"); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); @@ -82,8 +82,8 @@ public class ODataErrorSerializerTest { @Test public void emptyDetailsList() throws Exception { - ODataServerError error = new ODataServerError(); - error.setMessage("ErrorMessage").setDetails(new ArrayList()); + ClientServerError error = new ClientServerError(); + error.setMessage("ErrorMessage").setDetails(new ArrayList()); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); assertEquals("{\"error\":{\"code\":null,\"message\":\"ErrorMessage\",\"details\":[]}}", jsonString); @@ -91,7 +91,7 @@ public class ODataErrorSerializerTest { @Test public void nothingSetAtODataErrorObject() throws Exception { - ODataServerError error = new ODataServerError(); + ClientServerError error = new ClientServerError(); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); assertEquals("{\"error\":{\"code\":null,\"message\":null}}", jsonString); @@ -99,9 +99,9 @@ public class ODataErrorSerializerTest { @Test public void singleDetailNothingSet() throws Exception { - List details = new ArrayList(); - details.add(new ODataErrorDetail()); - ODataServerError error = new ODataServerError().setDetails(details); + List details = new ArrayList(); + details.add(new ClientErrorDetail()); + ClientServerError error = new ClientServerError().setDetails(details); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); assertEquals("{\"error\":{\"code\":null,\"message\":null,\"details\":[{\"code\":null,\"message\":null}]}}", @@ -110,10 +110,10 @@ public class ODataErrorSerializerTest { @Test public void verifiedWithJacksonParser() throws Exception { - List details = new ArrayList(); - details.add(new ODataErrorDetail().setCode("detailCode").setMessage("detailMessage").setTarget("detailTarget")); - ODataServerError error = - new ODataServerError().setCode("Code").setMessage("Message").setTarget("Target").setDetails(details); + List details = new ArrayList(); + details.add(new ClientErrorDetail().setCode("detailCode").setMessage("detailMessage").setTarget("detailTarget")); + ClientServerError error = + new ClientServerError().setCode("Code").setMessage("Message").setTarget("Target").setDetails(details); InputStream stream = ser.error(error).getContent(); JsonNode tree = new ObjectMapper().readTree(stream); assertNotNull(tree); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java index dcb3bfd9b..452e52951 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java @@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; public class DataCreator { @@ -628,7 +628,7 @@ public class DataCreator { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); link.setTitle(navigationPropertyName); entity.getNavigationLinks().add(link); } @@ -639,7 +639,7 @@ public class DataCreator { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); link.setTitle(navigationPropertyName); EntityCollection target = new EntityCollection(); target.getEntities().addAll(Arrays.asList(targets)); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java index 20eb233c6..2a51b8db1 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java @@ -51,7 +51,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.edmx.EdmxReference; import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor; @@ -692,7 +692,7 @@ public class ODataHandlerTest { ErrorProcessor errorProcessor = mock(ErrorProcessor.class); dispatch(HttpMethod.POST, "ESAllPrim", "", HttpHeader.CONTENT_TYPE, "some/unsupported", errorProcessor); verifyZeroInteractions(processor); - verify(errorProcessor).processError(any(ODataRequest.class), any(ODataResponse.class), any(ODataServerError.class), + verify(errorProcessor).processError(any(ODataRequest.class), any(ODataResponse.class), any(ClientServerError.class), any(ContentType.class)); } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java index 0347941ce..192f9b769 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java @@ -27,7 +27,7 @@ import java.io.InputStream; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; @@ -46,7 +46,7 @@ public class ODataDeserializerDeepInsertTest extends AbstractODataDeserializerTe assertNotNull(navigationLink); assertEquals("NavPropertyETTwoPrimOne", navigationLink.getTitle()); - assertEquals(ODataLinkType.ENTITY_NAVIGATION.toString(), navigationLink.getType()); + assertEquals(ClientLinkType.ENTITY_NAVIGATION.toString(), navigationLink.getType()); assertNotNull(navigationLink.getInlineEntity()); assertNull(navigationLink.getInlineEntitySet()); } @@ -68,7 +68,7 @@ public class ODataDeserializerDeepInsertTest extends AbstractODataDeserializerTe assertNotNull(navigationLink); assertEquals("NavPropertyETTwoPrimMany", navigationLink.getTitle()); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION.toString(), navigationLink.getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION.toString(), navigationLink.getType()); assertNull(navigationLink.getInlineEntity()); assertNotNull(navigationLink.getInlineEntitySet()); assertEquals(1, navigationLink.getInlineEntitySet().getEntities().size()); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java index 8c01c2133..7886fbc66 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java @@ -40,7 +40,7 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmProperty; @@ -474,7 +474,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe assertNotNull(bindingToOne); assertEquals("NavPropertyETTwoPrimOne", bindingToOne.getTitle()); assertEquals("ESTwoPrim(2)", bindingToOne.getBindingLink()); - assertEquals(ODataLinkType.ENTITY_BINDING.toString(), bindingToOne.getType()); + assertEquals(ClientLinkType.ENTITY_BINDING.toString(), bindingToOne.getType()); assertTrue(bindingToOne.getBindingLinks().isEmpty()); assertNull(bindingToOne.getHref()); assertNull(bindingToOne.getRel()); @@ -484,7 +484,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe assertEquals("NavPropertyETTwoPrimMany", bindingToMany.getTitle()); assertNotNull(bindingToMany.getBindingLinks()); assertEquals(2, bindingToMany.getBindingLinks().size()); - assertEquals(ODataLinkType.ENTITY_COLLECTION_BINDING.toString(), bindingToMany.getType()); + assertEquals(ClientLinkType.ENTITY_COLLECTION_BINDING.toString(), bindingToMany.getType()); assertNull(bindingToMany.getBindingLink()); assertNull(bindingToMany.getHref()); assertNull(bindingToMany.getRel());