You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/22 12:35:57 UTC
[14/19] git commit: Invoke request factory re-factoring
Invoke request factory re-factoring
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/35e89699
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/35e89699
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/35e89699
Branch: refs/heads/olingo-266-tecsvc
Commit: 35e89699ea25b8d878fc312a837f7bc61ee0a67a
Parents: 377ddb9
Author: Francesco Chicchiriccò <--global>
Authored: Wed May 21 13:40:50 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Wed May 21 13:40:50 2014 +0200
----------------------------------------------------------------------
.../commons/AbstractInvocationHandler.java | 30 ++-
.../AbstractStructuredInvocationHandler.java | 4 +-
.../commons/EntitySetInvocationHandler.java | 11 +-
.../olingo/ext/proxy/commons/FilterImpl.java | 2 +-
.../commons/OperationInvocationHandler.java | 5 +-
.../olingo/ext/proxy/commons/SearchImpl.java | 2 +-
.../java/org/apache/olingo/fit/V4Services.java | 31 ++-
.../resources/V40/Accounts/102/entity.full.json | 34 +++
.../main/resources/V40/Accounts/102/entity.xml | 55 ++++
.../V40/Accounts/102/links/MyGiftCard.full.json | 15 ++
.../V40/Accounts/102/links/MyGiftCard.xml | 41 +++
.../MyPaymentInstruments(102901).full.json | 16 ++
.../102/links/MyPaymentInstruments(102901).xml | 40 +++
.../MyPaymentInstruments(102902).full.json | 16 ++
.../102/links/MyPaymentInstruments(102902).xml | 40 +++
.../102/links/MyPaymentInstruments.full.json | 62 +++++
.../Accounts/102/links/MyPaymentInstruments.xml | 95 +++++++
.../olingo/fit/v3/AbstractTestITCase.java | 4 +-
.../fit/v3/ActionOverloadingTestITCase.java | 155 ++++-------
.../apache/olingo/fit/v3/AsyncTestITCase.java | 8 +-
.../apache/olingo/fit/v3/BatchTestITCase.java | 26 +-
.../apache/olingo/fit/v3/CountTestITCase.java | 4 +-
.../olingo/fit/v3/EntityCreateTestITCase.java | 16 +-
.../olingo/fit/v3/EntityRetrieveTestITCase.java | 14 +-
.../olingo/fit/v3/EntitySetTestITCase.java | 8 +-
.../olingo/fit/v3/EntityUpdateTestITCase.java | 26 +-
.../apache/olingo/fit/v3/ErrorTestITCase.java | 20 +-
.../olingo/fit/v3/FilterFactoryTestITCase.java | 2 +-
.../apache/olingo/fit/v3/FilterTestITCase.java | 2 +-
.../apache/olingo/fit/v3/InvokeTestITCase.java | 120 ++-------
.../olingo/fit/v3/KeyAsSegmentTestITCase.java | 6 +-
.../apache/olingo/fit/v3/LinkTestITCase.java | 8 +-
.../olingo/fit/v3/MediaEntityTestITCase.java | 12 +-
.../olingo/fit/v3/OpenTypeTestITCase.java | 6 +-
.../olingo/fit/v3/PrimitiveKeysTestITCase.java | 2 +-
.../fit/v3/PropertyRetrieveTestITCase.java | 8 +-
.../olingo/fit/v3/PropertyTestITCase.java | 16 +-
.../olingo/fit/v3/PropertyValueTestITCase.java | 20 +-
.../olingo/fit/v3/QueryOptionsTestITCase.java | 12 +-
.../olingo/fit/v4/AbstractTestITCase.java | 4 +-
.../apache/olingo/fit/v4/AsyncTestITCase.java | 6 +-
.../apache/olingo/fit/v4/BatchTestITCase.java | 30 +--
.../fit/v4/BoundOperationInvokeTestITCase.java | 258 +++++++++++++------
.../apache/olingo/fit/v4/DeltaTestITCase.java | 2 +-
.../olingo/fit/v4/DerivedTypeTestITCase.java | 8 +-
.../olingo/fit/v4/EntityCreateTestITCase.java | 6 +-
.../olingo/fit/v4/EntityRetrieveTestITCase.java | 20 +-
.../olingo/fit/v4/EntitySetTestITCase.java | 8 +-
.../olingo/fit/v4/EntityUpdateTestITCase.java | 8 +-
.../olingo/fit/v4/ErrorResponseTestITCase.java | 2 +-
.../olingo/fit/v4/FilterFactoryTestITCase.java | 2 +-
.../olingo/fit/v4/KeyAsSegmentTestITCase.java | 4 +-
.../olingo/fit/v4/MediaEntityTestITCase.java | 8 +-
.../olingo/fit/v4/OpenTypeTestITCase.java | 6 +-
.../fit/v4/OperationImportInvokeTestITCase.java | 96 ++-----
.../olingo/fit/v4/PropertyTestITCase.java | 14 +-
.../olingo/fit/v4/PropertyValueTestITCase.java | 20 +-
.../olingo/fit/v4/QueryOptionsTestITCase.java | 22 +-
.../olingo/fit/v4/SingletonTestITCase.java | 6 +-
.../client/api/CommonEdmEnabledODataClient.java | 2 +-
.../olingo/client/api/CommonODataClient.java | 4 +-
.../api/communication/header/ODataHeaders.java | 31 +++
.../invoke/EdmEnabledInvokeRequestFactory.java | 65 ++++-
.../request/invoke/InvokeRequestFactory.java | 64 ++++-
.../client/api/v3/EdmEnabledODataClient.java | 2 +-
.../olingo/client/api/v3/ODataClient.java | 2 +-
.../client/api/v4/EdmEnabledODataClient.java | 2 +-
.../olingo/client/api/v4/ODataClient.java | 2 +-
.../olingo/client/core/AbstractODataClient.java | 3 +-
.../communication/header/ODataHeadersImpl.java | 49 +---
.../request/AbstractODataRequest.java | 5 +-
.../batch/v3/BatchRequestFactoryImpl.java | 2 +-
.../batch/v4/BatchRequestFactoryImpl.java | 2 +-
.../AbstractEdmEnabledInvokeRequestFactory.java | 172 +++++++++++++
.../invoke/AbstractInvokeRequestFactory.java | 55 +++-
.../v3/EdmEnabledInvokeRequestFactoryImpl.java | 78 +-----
.../invoke/v3/InvokeRequestFactoryImpl.java | 36 +--
.../v4/EdmEnabledInvokeRequestFactoryImpl.java | 78 +-----
.../invoke/v4/InvokeRequestFactoryImpl.java | 36 +--
.../AbstractRetrieveRequestFactory.java | 6 +-
.../v3/ODataLinkCollectionRequestImpl.java | 2 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 2 +-
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 2 +-
.../retrieve/v4/XMLMetadataRequestImpl.java | 2 +-
.../apache/olingo/client/core/uri/URIUtils.java | 20 --
.../core/v3/EdmEnabledODataClientImpl.java | 2 +-
.../olingo/client/core/v3/ODataClientImpl.java | 4 +-
.../core/v4/EdmEnabledODataClientImpl.java | 2 +-
.../olingo/client/core/v4/ODataClientImpl.java | 4 +-
.../client/core/uri/v3/URIBuilderTest.java | 26 +-
.../client/core/uri/v4/URIBuilderTest.java | 26 +-
91 files changed, 1399 insertions(+), 913 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java
----------------------------------------------------------------------
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 2ce424a..09b443b 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
@@ -35,12 +35,17 @@ 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.client.api.CommonEdmEnabledODataClient;
+import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
+import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmOperation;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.EntityContainerFactory;
import org.apache.olingo.ext.proxy.api.OperationType;
@@ -156,6 +161,25 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
handler);
}
+ @SuppressWarnings("unchecked")
+ private <RES extends ODataInvokeResult> Class<RES> getResultReference(final EdmReturnType returnType) {
+ Class<RES> result;
+
+ if (returnType == null) {
+ result = (Class<RES>) ODataNoContent.class;
+ } else {
+ if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
+ result = (Class<RES>) CommonODataEntitySet.class;
+ } else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
+ result = (Class<RES>) CommonODataEntity.class;
+ } else {
+ result = (Class<RES>) CommonODataProperty.class;
+ }
+ }
+
+ return result;
+ }
+
protected Object invokeOperation(
final Operation annotation,
final Method method,
@@ -193,7 +217,11 @@ abstract class AbstractInvocationHandler implements InvocationHandler {
// 3. invoke
final ODataInvokeResult result = client.getInvokeRequestFactory().getInvokeRequest(
- target, edmOperation, parameterValues).execute().getBody();
+ edmOperation instanceof EdmFunction ? HttpMethod.GET : HttpMethod.POST,
+ target,
+ getResultReference(edmOperation.getReturnType()),
+ parameterValues).
+ execute().getBody();
// 4. process invoke result
if (StringUtils.isBlank(annotation.returnType())) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
----------------------------------------------------------------------
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 6f44c64..45befde 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
@@ -222,7 +222,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
null,
((ODataInlineEntity) link).getEntity(),
property.targetContainer(),
- client.getURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
+ client.newURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
type,
false);
} else if (link instanceof ODataInlineEntitySet) {
@@ -259,7 +259,7 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
uri,
res.getBody(),
property.targetContainer(),
- client.getURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
+ client.newURIBuilder(serviceRoot).appendEntitySetSegment(property.targetEntitySet()).build(),
type,
res.getETag(),
true);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
----------------------------------------------------------------------
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 4f4e45a..7aa8c22 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
@@ -90,8 +90,7 @@ class EntitySetInvocationHandler<
static EntitySetInvocationHandler getInstance(
final Class<?> ref, final EntityContainerInvocationHandler containerHandler, final String entitySetName) {
- final CommonURIBuilder<?> uriBuilder = containerHandler.getClient().
- getURIBuilder(containerHandler.getFactory().getServiceRoot());
+ final CommonURIBuilder<?> uriBuilder = containerHandler.getClient().newURIBuilder();
final StringBuilder entitySetSegment = new StringBuilder();
if (!containerHandler.isDefaultEntityContainer()) {
@@ -184,7 +183,7 @@ class EntitySetInvocationHandler<
@Override
public Long count() {
final ODataValueRequest req = client.getRetrieveRequestFactory().
- getValueRequest(client.getURIBuilder(this.uri.toASCIIString()).count().build());
+ getValueRequest(client.newURIBuilder(this.uri.toASCIIString()).count().build());
req.setFormat(ODataValueFormat.TEXT);
return Long.valueOf(req.execute().getBody().asPrimitive().toString());
}
@@ -247,7 +246,7 @@ class EntitySetInvocationHandler<
// not yet attached: search against the service
try {
LOG.debug("Search for '{}({})' into the service", typeRef.getSimpleName(), key);
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(this.uri.toASCIIString());
+ final CommonURIBuilder<?> uriBuilder = client.newURIBuilder(this.uri.toASCIIString());
if (key.getClass().getAnnotation(CompoundKey.class) == null) {
LOG.debug("Append key segment '{}'", key);
@@ -376,7 +375,7 @@ class EntitySetInvocationHandler<
final Class<S> ref = (Class<S>) ClassUtils.extractTypeArg(collTypeRef);
final Class<S> oref = (Class<S>) ClassUtils.extractTypeArg(this.collTypeRef);
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(this.uri.toASCIIString());
+ final CommonURIBuilder<?> uriBuilder = client.newURIBuilder(this.uri.toASCIIString());
final URI entitySetURI;
if (oref.equals(ref)) {
@@ -463,6 +462,6 @@ class EntitySetInvocationHandler<
@Override
public EntitySetIterator<T, KEY, EC> iterator() {
- return new EntitySetIterator<T, KEY, EC>(client.getURIBuilder(this.uri.toASCIIString()).build(), this);
+ return new EntitySetIterator<T, KEY, EC>(client.newURIBuilder(this.uri.toASCIIString()).build(), this);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FilterImpl.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FilterImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FilterImpl.java
index 4299dde..42ce646 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FilterImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FilterImpl.java
@@ -150,7 +150,7 @@ public class FilterImpl<T extends Serializable, EC extends AbstractEntityCollect
@Override
public EC getResult() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(this.baseURI.toASCIIString()).
+ final CommonURIBuilder<?> uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()).
appendDerivedEntityTypeSegment(new FullQualifiedName(
ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
----------------------------------------------------------------------
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 69e1f9b..d2f5bfc 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
@@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -154,8 +153,8 @@ class OperationInvocationHandler extends AbstractInvocationHandler implements Op
edmOperation = container.getActionImport(operation.name()).getUnboundAction();
}
- final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(this.serviceRoot).
- appendOperationCallSegment(URIUtils.operationImportURISegment(container, edmOperation.getName()));
+ final CommonURIBuilder<?> uriBuilder = getClient().newURIBuilder(this.serviceRoot).
+ appendOperationCallSegment(edmOperation.getName());
return new AbstractMap.SimpleEntry<URI, EdmOperation>(uriBuilder.build(), edmOperation);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
index 73a0585..fb65c6e 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/SearchImpl.java
@@ -75,7 +75,7 @@ public class SearchImpl<T extends Serializable, EC extends AbstractEntityCollect
@Override
public EC getResult() {
- final URIBuilder uriBuilder = client.getURIBuilder(this.baseURI.toASCIIString()).
+ final URIBuilder uriBuilder = client.newURIBuilder(this.baseURI.toASCIIString()).
appendDerivedEntityTypeSegment(new FullQualifiedName(
ClassUtils.getNamespace(typeRef), ClassUtils.getEntityTypeName(typeRef)).toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 52108a8..db88da0 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -457,7 +457,7 @@ public class V4Services extends AbstractServices {
}
@GET
- @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount")
+ @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount{paren:[\\(\\)]*}")
public Response functionGetEmployeesCount(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
@@ -488,7 +488,7 @@ public class V4Services extends AbstractServices {
}
@POST
- @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue")
+ @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue{paren:[\\(\\)]*}")
public Response actionIncreaseRevenue(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@@ -562,7 +562,7 @@ public class V4Services extends AbstractServices {
}
@POST
- @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight")
+ @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight{paren:[\\(\\)]*}")
public Response actionAddAccessRight(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
@@ -583,11 +583,16 @@ public class V4Services extends AbstractServices {
assert 1 == entry.getProperties().size();
assert entry.getProperty("accessRight") != null;
- entry.getProperty("accessRight").setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
+ final Property property = entry.getProperty("accessRight");
+ property.setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
+
+ final ResWrap<AtomPropertyImpl> result = new ResWrap<AtomPropertyImpl>(
+ URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX) + property.getType()),
+ null, (AtomPropertyImpl) property);
return xml.createResponse(
null,
- xml.writeProperty(acceptType, entry.getProperty("accessRight")),
+ xml.writeProperty(acceptType, result),
null,
acceptType);
} catch (Exception e) {
@@ -596,7 +601,7 @@ public class V4Services extends AbstractServices {
}
@POST
- @Path("/Customers(PersonID={personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress")
+ @Path("/Customers(PersonID={personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress{paren:[\\(\\)]*}")
public Response actionResetAddress(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -622,7 +627,7 @@ public class V4Services extends AbstractServices {
@GET
@Path("/ProductDetails(ProductID={productId},ProductDetailID={productDetailId})"
- + "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct")
+ + "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct{paren:[\\(\\)]*}")
public Response functionGetRelatedProduct(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -634,11 +639,12 @@ public class V4Services extends AbstractServices {
}
@POST
- @Path("/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI")
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI{paren:[\\(\\)]*}")
public Response actionRefreshDefaultPI(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+ @PathParam("entityId") String entityId,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
final String param) {
@@ -649,23 +655,24 @@ public class V4Services extends AbstractServices {
assert 1 == entry.getProperties().size();
assert entry.getProperty("newDate") != null;
- return functionGetDefaultPI(accept, format);
+ return functionGetDefaultPI(accept, entityId, format);
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
}
@GET
- @Path("/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI")
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI{paren:[\\(\\)]*}")
public Response functionGetDefaultPI(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+ @PathParam("entityId") String entityId,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
- return getContainedEntity(accept, "101", "MyPaymentInstruments", "101901", format);
+ return getContainedEntity(accept, entityId, "MyPaymentInstruments", entityId+ "901", format);
}
@GET
- @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo")
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo{paren:[\\(\\)]*}")
public Response functionGetAccountInfo(
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@PathParam("entityId") String entityId,
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/entity.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/entity.full.json b/fit/src/main/resources/V40/Accounts/102/entity.full.json
new file mode 100644
index 0000000..1682135
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/entity.full.json
@@ -0,0 +1,34 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
+ "@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)",
+ "@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)",
+ "AccountID": 102,
+ "Country": "US",
+ "AccountInfo": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ "FirstName": "Alex",
+ "LastName": "Green",
+ "MiddleName": "Hood"
+ },
+ "MyGiftCard@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/$ref",
+ "MyGiftCard@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard",
+ "MyPaymentInstruments@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments/$ref",
+ "MyPaymentInstruments@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments",
+ "ActiveSubscriptions@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions/$ref",
+ "ActiveSubscriptions@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions",
+ "AvailableSubscriptionTemplatess@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess/$ref",
+ "AvailableSubscriptionTemplatess@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess",
+ "#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
+ "target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
+ "target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
+ "target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/entity.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/entity.xml b/fit/src/main/resources/V40/Accounts/102/entity.xml
new file mode 100644
index 0000000..0b9cc63
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/entity.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts/$entity">
+ <id>http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="edit" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/ActiveSubscriptions"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/AvailableSubscriptionTemplatess"/>
+ <title/>
+ <updated>2014-04-14T12:45:00Z</updated>
+ <author>
+ <name/>
+ </author>
+ <m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+ title="Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+ target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"/>
+ <m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+ title="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+ target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"/>
+ <m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+ title="Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+ target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"/>
+ <content type="application/xml">
+ <m:properties>
+ <d:AccountID m:type="Int32">102</d:AccountID>
+ <d:Country>US</d:Country>
+ <d:AccountInfo m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo">
+ <d:FirstName>Alex</d:FirstName>
+ <d:LastName>Green</d:LastName>
+ <d:MiddleName>Hood</d:MiddleName>
+ </d:AccountInfo>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.full.json b/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.full.json
new file mode 100644
index 0000000..cf9d18a
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.full.json
@@ -0,0 +1,15 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyGiftCard/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
+ "@odata.id": "Accounts(102)/MyGiftCard",
+ "@odata.editLink": "Accounts(102)/MyGiftCard",
+ "GiftCardID": 301,
+ "GiftCardNO": "AAA123A",
+ "Amount": 19.9,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2013-12-30T00:00:00Z",
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount",
+ "target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.xml b/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.xml
new file mode 100644
index 0000000..b1927b3
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyGiftCard.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyGiftCard/$entity">
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.GiftCard" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <id />
+ <title />
+ <updated>2014-04-23T13:48:48Z</updated>
+ <author>
+ <name />
+ </author>
+ <m:action metadata="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
+ title="Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"
+ target="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"/>
+ <content type="application/xml">
+ <m:properties>
+ <d:GiftCardID m:type="Int32">301</d:GiftCardID>
+ <d:GiftCardNO>AAA123A</d:GiftCardNO>
+ <d:Amount m:type="Double">19.9</d:Amount>
+ <d:ExperationDate m:type="DateTimeOffset">2013-12-30T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).full.json b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).full.json
new file mode 100644
index 0000000..70c96de
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).full.json
@@ -0,0 +1,16 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ "@odata.id": "Accounts(102)/MyPaymentInstruments(102901)",
+ "@odata.editLink": "Accounts(102)/MyPaymentInstruments(102901)",
+ "PaymentInstrumentID": 102901,
+ "FriendlyName": "102 first PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2014-04-09T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).xml b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).xml
new file mode 100644
index 0000000..e519217
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102901).xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity">
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"/>
+ <id/>
+ <title/>
+ <updated>2014-04-14T12:47:37Z</updated>
+ <author>
+ <name/>
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">102901</d:PaymentInstrumentID>
+ <d:FriendlyName>102 first PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).full.json b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).full.json
new file mode 100644
index 0000000..d6082db
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).full.json
@@ -0,0 +1,16 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ "@odata.id": "Accounts(102)/MyPaymentInstruments(102902)",
+ "@odata.editLink": "Accounts(102)/MyPaymentInstruments(102902)",
+ "PaymentInstrumentID": 102902,
+ "FriendlyName": "102 first PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2014-04-09T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).xml b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).xml
new file mode 100644
index 0000000..7a056c4
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments(102902).xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments/$entity">
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/TheStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BillingStatements"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/BackupStoredPI"/>
+ <id/>
+ <title/>
+ <updated>2014-04-14T12:47:37Z</updated>
+ <author>
+ <name/>
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">102902</d:PaymentInstrumentID>
+ <d:FriendlyName>102 first PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.full.json b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.full.json
new file mode 100644
index 0000000..d056b5e
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.full.json
@@ -0,0 +1,62 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments",
+ "value": [{
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ "@odata.id": "Accounts(102)/MyPaymentInstruments(102901)",
+ "@odata.editLink": "Accounts(102)/MyPaymentInstruments(102901)",
+ "PaymentInstrumentID": 102901,
+ "FriendlyName": "102 first PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2014-04-09T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(102)/MyPaymentInstruments(102902)",
+ "@odata.editLink": "Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 102902,
+ "FriendlyName": "102 frist credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "6000000000000000",
+ "CVV": "234",
+ "HolderName": "Alex",
+ "Balance": 100.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-11-01T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(102)/MyPaymentInstruments(102903)",
+ "@odata.editLink": "Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 102903,
+ "FriendlyName": "102 second credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "8000000000000000",
+ "CVV": "012",
+ "HolderName": "James",
+ "Balance": 300.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-10-02T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.xml b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.xml
new file mode 100644
index 0000000..5defbc3
--- /dev/null
+++ b/fit/src/main/resources/V40/Accounts/102/links/MyPaymentInstruments.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<feed xml:base="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Accounts(102)/MyPaymentInstruments">
+ <id>http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/MyPaymentInstruments</id>
+ <title/>
+ <updated>2014-04-14T12:45:33Z</updated>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/TheStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BillingStatements"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102901)/BackupStoredPI"/>
+ <id/>
+ <title/>
+ <updated>2014-04-14T12:45:33Z</updated>
+ <author>
+ <name/>
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">102901</d:PaymentInstrumentID>
+ <d:FriendlyName>102 first PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2014-04-09T00:00:00Z</d:CreatedDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
+ <id/>
+ <title/>
+ <updated>2014-04-14T12:45:33Z</updated>
+ <author>
+ <name/>
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">102902</d:PaymentInstrumentID>
+ <d:FriendlyName>102 frist credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>6000000000000000</d:CardNumber>
+ <d:CVV>234</d:CVV>
+ <d:HolderName>Alex</d:HolderName>
+ <d:Balance m:type="Double">100</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-11-01T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Accounts(102)/MyPaymentInstruments(102903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"/>
+ <id/>
+ <title/>
+ <updated>2014-04-14T12:45:33Z</updated>
+ <author>
+ <name/>
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">102903</d:PaymentInstrumentID>
+ <d:FriendlyName>102 second credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>8000000000000000</d:CardNumber>
+ <d:CVV>012</d:CVV>
+ <d:HolderName>James</d:HolderName>
+ <d:Balance m:type="Double">300</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-10-02T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java
index fc2bbae..d9bf300 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java
@@ -329,7 +329,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
final ODataEntity original,
final String entitySetName) {
- final URIBuilder uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ final URIBuilder uriBuilder = getClient().newURIBuilder(serviceRootURL).
appendEntitySetSegment(entitySetName);
debugODataEntity(original, "About to create");
@@ -356,7 +356,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
final int actualObjectId,
final Collection<String> expands) {
- final URIBuilder uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ final URIBuilder uriBuilder = getClient().newURIBuilder(serviceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
// search expanded
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
index de6d62d..d9e617b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
@@ -19,7 +19,6 @@
package org.apache.olingo.fit.v3;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import java.util.LinkedHashMap;
@@ -27,120 +26,69 @@ import java.util.Map;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
import org.apache.olingo.client.api.uri.v3.URIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
import org.junit.Test;
public class ActionOverloadingTestITCase extends AbstractTestITCase {
@Test
public void retrieveProduct() throws EdmPrimitiveTypeException {
- final Edm edm = getClient().getRetrieveRequestFactory().
- getMetadataRequest(testActionOverloadingServiceRootURL).execute().getBody();
- assertNotNull(edm);
-
- final EdmEntityContainer container = edm.getSchemas().get(0).getEntityContainer();
- assertNotNull(container);
-
- int execs = 0;
- for (EdmActionImport actImp : container.getActionImports()) {
- if ("RetrieveProduct".equals(actImp.getName())) {
- // 1. unbound
- final EdmAction unbound = actImp.getUnboundAction();
- assertNotNull(unbound);
- assertEquals(EdmInt32.getInstance(), unbound.getReturnType().getType());
-
- final URIBuilder unboundBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
- appendOperationCallSegment(URIUtils.operationImportURISegment(container, actImp.getName()));
- final ODataInvokeResponse<ODataProperty> unboundRes = getClient().getInvokeRequestFactory().
- <ODataProperty>getInvokeRequest(unboundBuilder.build(), unbound).execute();
- assertNotNull(unboundRes);
- assertEquals(200, unboundRes.getStatusCode());
- assertEquals(Integer.valueOf(-10), unboundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
- execs++;
-
- // 2. bound to Product
- final EdmAction productBound = edm.getBoundAction(
- new FullQualifiedName(container.getNamespace(), actImp.getName()),
- new FullQualifiedName(container.getNamespace(), "Product"), false);
- assertNotNull(productBound);
- assertEquals(EdmInt32.getInstance(), productBound.getReturnType().getType());
-
- final ODataEntity product = getClient().getRetrieveRequestFactory().getEntityRequest(
- getClient().getURIBuilder(testActionOverloadingServiceRootURL).
- appendEntitySetSegment("Product").appendKeySegment(-10).build()).
- execute().getBody();
- assertNotNull(product);
-
- final ODataInvokeResponse<ODataProperty> productBoundRes = getClient().getInvokeRequestFactory().
- <ODataProperty>getInvokeRequest(product.getOperation(actImp.getName()).getTarget(), unbound).
- execute();
- assertNotNull(productBoundRes);
- assertEquals(200, productBoundRes.getStatusCode());
- assertEquals(Integer.valueOf(-10), productBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
- execs++;
-
- // 3. bound to OrderLine
- final EdmAction orderLineBound = edm.getBoundAction(
- new FullQualifiedName(container.getNamespace(), actImp.getName()),
- new FullQualifiedName(container.getNamespace(), "OrderLine"), false);
- assertNotNull(orderLineBound);
- assertEquals(EdmInt32.getInstance(), orderLineBound.getReturnType().getType());
-
- final Map<String, Object> key = new LinkedHashMap<String, Object>(2);
- key.put("OrderId", -10);
- key.put("ProductId", -10);
- final ODataEntity orderLine = getClient().getRetrieveRequestFactory().getEntityRequest(
- getClient().getURIBuilder(testActionOverloadingServiceRootURL).
- appendEntitySetSegment("OrderLine").appendKeySegment(key).build()).
- execute().getBody();
- assertNotNull(orderLine);
-
- final ODataInvokeResponse<ODataProperty> orderLineBoundRes = getClient().getInvokeRequestFactory().
- <ODataProperty>getInvokeRequest(orderLine.getOperation(actImp.getName()).getTarget(), unbound).
- execute();
- assertNotNull(orderLineBoundRes);
- assertEquals(200, orderLineBoundRes.getStatusCode());
- assertEquals(Integer.valueOf(-10), orderLineBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
- execs++;
- }
- }
- assertEquals(3, execs);
+ final String actionImportName = "RetrieveProduct";
+
+ // 1. unbound
+ final URIBuilder builder = getClient().newURIBuilder(testActionOverloadingServiceRootURL).
+ appendOperationCallSegment(actionImportName);
+ final ODataInvokeResponse<ODataProperty> unboundRes = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(builder.build(), ODataProperty.class).execute();
+ assertNotNull(unboundRes);
+ assertEquals(200, unboundRes.getStatusCode());
+ assertEquals(Integer.valueOf(-10), unboundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
+
+ // 2. bound to Product
+ final ODataEntity product = getClient().getRetrieveRequestFactory().getEntityRequest(
+ getClient().newURIBuilder(testActionOverloadingServiceRootURL).
+ appendEntitySetSegment("Product").appendKeySegment(-10).build()).
+ execute().getBody();
+ assertNotNull(product);
+
+ final ODataInvokeResponse<ODataProperty> productBoundRes = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(product.getOperation(actionImportName).getTarget(), ODataProperty.class).
+ execute();
+ assertNotNull(productBoundRes);
+ assertEquals(200, productBoundRes.getStatusCode());
+ assertEquals(Integer.valueOf(-10), productBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
+
+ // 3. bound to OrderLine
+ final Map<String, Object> key = new LinkedHashMap<String, Object>(2);
+ key.put("OrderId", -10);
+ key.put("ProductId", -10);
+ final ODataEntity orderLine = getClient().getRetrieveRequestFactory().getEntityRequest(
+ getClient().newURIBuilder(testActionOverloadingServiceRootURL).
+ appendEntitySetSegment("OrderLine").appendKeySegment(key).build()).
+ execute().getBody();
+ assertNotNull(orderLine);
+
+ final ODataInvokeResponse<ODataProperty> orderLineBoundRes = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(orderLine.getOperation(actionImportName).getTarget(), ODataProperty.class).
+ execute();
+ assertNotNull(orderLineBoundRes);
+ assertEquals(200, orderLineBoundRes.getStatusCode());
+ assertEquals(Integer.valueOf(-10), orderLineBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class));
}
@Test
public void increaseSalaries() {
- final Edm edm = getClient().getRetrieveRequestFactory().
- getMetadataRequest(testActionOverloadingServiceRootURL).execute().getBody();
- assertNotNull(edm);
-
- final EdmSchema schema = edm.getSchemas().get(0);
- assertNotNull(schema);
-
- EdmAction actImp = edm.getBoundAction(
- new FullQualifiedName(schema.getNamespace(), "IncreaseSalaries"),
- new FullQualifiedName(schema.getNamespace(), "Employee"),
- true);
+ final String actionImportName = "IncreaseSalaries";
final Map<String, ODataValue> parameters = new LinkedHashMap<String, ODataValue>(1);
parameters.put("n", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(5));
// 1. bound to employees
- assertNotNull(actImp);
- assertNull(actImp.getReturnType());
-
- final URIBuilder employeeBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
+ final URIBuilder employeeBuilder = getClient().newURIBuilder(testActionOverloadingServiceRootURL).
appendEntitySetSegment("Person").
appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee");
final ODataEntitySet employees = getClient().getRetrieveRequestFactory().getEntitySetRequest(
@@ -148,20 +96,13 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase {
assertNotNull(employees);
final ODataInvokeResponse<ODataNoContent> employeeRes = getClient().getInvokeRequestFactory().
- <ODataNoContent>getInvokeRequest(employeeBuilder.appendOperationCallSegment(actImp.getName()).build(),
- actImp, parameters).execute();
+ getActionInvokeRequest(employeeBuilder.appendOperationCallSegment(actionImportName).build(),
+ ODataNoContent.class, parameters).execute();
assertNotNull(employeeRes);
assertEquals(204, employeeRes.getStatusCode());
// 2. bound to special employees
- actImp = edm.getBoundAction(
- new FullQualifiedName(schema.getNamespace(), "IncreaseSalaries"),
- new FullQualifiedName(schema.getNamespace(), "SpecialEmployee"),
- true);
- assertNotNull(actImp);
- assertNull(actImp.getReturnType());
-
- final URIBuilder specEmpBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
+ final URIBuilder specEmpBuilder = getClient().newURIBuilder(testActionOverloadingServiceRootURL).
appendEntitySetSegment("Person").
appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee");
final ODataEntitySet specEmps = getClient().getRetrieveRequestFactory().getEntitySetRequest(
@@ -169,8 +110,8 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase {
assertNotNull(specEmps);
final ODataInvokeResponse<ODataNoContent> specEmpsRes = getClient().getInvokeRequestFactory().
- <ODataNoContent>getInvokeRequest(specEmpBuilder.appendOperationCallSegment(actImp.getName()).build(),
- actImp, parameters).execute();
+ getActionInvokeRequest(specEmpBuilder.appendOperationCallSegment(actionImportName).build(),
+ ODataNoContent.class, parameters).execute();
assertNotNull(specEmpsRes);
assertEquals(204, specEmpsRes.getStatusCode());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java
index e9ac0e3..d28bea2 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java
@@ -44,7 +44,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
@Test
public void retrieveEntitySet() throws InterruptedException, ExecutionException {
- final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product");
final Future<ODataRetrieveResponse<ODataEntitySet>> futureRes =
client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute();
@@ -62,7 +62,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
@Test
public void updateEntity() throws InterruptedException, ExecutionException {
- final URI uri = client.getURIBuilder(testStaticServiceRootURL).
+ final URI uri = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final ODataRetrieveResponse<ODataEntity> entityRes = client.getRetrieveRequestFactory().
@@ -93,7 +93,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
@Test
public void createMediaEntity() throws Exception {
- URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
+ URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
final String TO_BE_UPDATED = "async buffered stream sample";
final InputStream input = IOUtils.toInputStream(TO_BE_UPDATED);
@@ -119,7 +119,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
? created.getProperties().get(0).getPrimitiveValue().toCastValue(Integer.class)
: created.getProperties().get(1).getPrimitiveValue().toCastValue(Integer.class);
- builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").appendKeySegment(id);
+ builder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").appendKeySegment(id);
final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().getMediaEntityRequest(builder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
index cc634ef..18ebaad 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java
@@ -110,7 +110,7 @@ public class BatchTestITCase extends AbstractTestITCase {
URIBuilder targetURI;
ODataEntityCreateRequest<ODataEntity> createReq;
- targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
for (int i = 1; i <= 2; i++) {
// Create Customer into the changeset
createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -120,14 +120,14 @@ public class BatchTestITCase extends AbstractTestITCase {
changeset.addRequest(createReq);
}
- targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet");
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet");
createReq = client.getCUDRequestFactory().getEntityCreateRequest(
targetURI.build(),
getSampleCustomerProfile(105, "Sample customer", false));
createReq.setFormat(ODataPubFormat.JSON);
changeset.addRequest(createReq);
- targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
for (int i = 3; i <= 4; i++) {
// Create Customer into the changeset
createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -162,7 +162,7 @@ public class BatchTestITCase extends AbstractTestITCase {
final ODataChangeset changeset = streamManager.addChangeset();
ODataEntity customer = getSampleCustomerProfile(20, "sample customer", false);
- URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
+ URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
// add create request
final ODataEntityCreateRequest<ODataEntity> createReq =
@@ -177,7 +177,7 @@ public class BatchTestITCase extends AbstractTestITCase {
final ODataEntity customerChanges = client.getObjectFactory().newEntity(customer.getTypeName());
customerChanges.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info",
- client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo").
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo").
appendKeySegment(17).build()));
final ODataEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
@@ -244,7 +244,7 @@ public class BatchTestITCase extends AbstractTestITCase {
info.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
client.getObjectFactory().newPrimitiveValueBuilder().buildString("Sample information about customer 30")));
- URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo");
+ URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo");
ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), info);
@@ -258,7 +258,7 @@ public class BatchTestITCase extends AbstractTestITCase {
customer.getNavigationLinks().add(
client.getObjectFactory().newEntityNavigationLink("Info", URI.create("$" + createRequestRef)));
- uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
+ uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
// add create request
createReq = client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), customer);
@@ -289,7 +289,7 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(201, res.getStatusCode());
assertTrue(res instanceof ODataEntityCreateResponse);
- uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(30);
+ uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(30);
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(testStaticServiceRootURL, uriBuilder.build() + "/Info"));
@@ -312,7 +312,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// Add retrieve item
// -------------------------------------------
// prepare URI
- URIBuilder targetURI = client.getURIBuilder(testStaticServiceRootURL);
+ URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
targetURI.appendEntitySetSegment("Customer").appendKeySegment(-10).
expand("Logins").select("CustomerId,Logins/Username");
@@ -329,7 +329,7 @@ public class BatchTestITCase extends AbstractTestITCase {
final ODataChangeset changeset = streamManager.addChangeset();
// Update Product into the changeset
- targetURI = client.getURIBuilder(testStaticServiceRootURL).
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10);
final URI editLink = targetURI.build();
@@ -348,7 +348,7 @@ public class BatchTestITCase extends AbstractTestITCase {
changeset.addRequest(changeReq);
// Create Customer into the changeset
- targetURI = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer");
final ODataEntity original = getSampleCustomerProfile(1000, "Sample customer", false);
final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
@@ -357,7 +357,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// Delete customer created above
targetURI =
- client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(1000);
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(1000);
final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(targetURI.build());
changeset.addRequest(deleteReq);
// -------------------------------------------
@@ -367,7 +367,7 @@ public class BatchTestITCase extends AbstractTestITCase {
// -------------------------------------------
// prepare URI
- targetURI = client.getURIBuilder(testStaticServiceRootURL).
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10);
// create new request
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/35e89699/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java
index 9745ef5..56c7902 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java
@@ -31,7 +31,7 @@ public class CountTestITCase extends AbstractTestITCase {
@Test
public void entityCount() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ CommonURIBuilder<?> uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").count();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
@@ -45,7 +45,7 @@ public class CountTestITCase extends AbstractTestITCase {
@Test
public void invalidAccept() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final CommonURIBuilder<?> uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").count();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);