You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/03/12 11:25:20 UTC

[6/8] git commit: OLINGO-175 provided CRUD navigation links

OLINGO-175 provided CRUD navigation links


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/eff82c55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/eff82c55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/eff82c55

Branch: refs/heads/olingo200
Commit: eff82c55352759af2a9847bb46d79fdaec0a012f
Parents: 2372dc6
Author: fmartelli <fa...@gmail.com>
Authored: Wed Mar 12 09:34:18 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Wed Mar 12 09:34:18 2014 +0100

----------------------------------------------------------------------
 .../odatajclient/engine/it/LinkTestITCase.java  |   2 +-
 .../testservice/AbstractServices.java           | 183 +++++++++++++++++++
 .../testservice/utils/AbstractUtilities.java    |  10 +-
 .../odatajclient/testservice/utils/Commons.java |  15 +-
 .../testservice/utils/JSONUtilities.java        |  27 +++
 .../v3/Customer/-10/links/Logins('3').full.json |   4 +
 .../resources/v3/Login/'3'/entity.full.json     |  13 ++
 .../src/main/resources/v3/Login/'3'/entity.xml  |  42 +++++
 .../v3/OrderLine/-10 -10/entity.full.json       |   4 +-
 .../resources/v3/OrderLine/-10 -10/entity.xml   |   4 +-
 10 files changed, 292 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/LinkTestITCase.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/LinkTestITCase.java b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/LinkTestITCase.java
index 8146d45..284334e 100644
--- a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/LinkTestITCase.java
+++ b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/LinkTestITCase.java
@@ -45,7 +45,7 @@ import org.junit.Test;
 public class LinkTestITCase extends AbstractTestITCase {
 
     protected String getServiceRoot() {
-        return testDefaultServiceRootURL;
+        return testStaticServiceRootURL;
     }
 
     private ODataLinkCollection doRetrieveLinkURIs(final ODataFormat format, final String linkname) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/AbstractServices.java
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/AbstractServices.java b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/AbstractServices.java
index 15f0360..8214576 100644
--- a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/AbstractServices.java
+++ b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/AbstractServices.java
@@ -562,6 +562,178 @@ public abstract class AbstractServices {
         }
     }
 
+    @POST
+    @Path("/{entitySetName}({entityId})/$links/{linkName}")
+    public Response postLink(
+            @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+            @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+            @PathParam("entitySetName") String entitySetName,
+            @PathParam("entityId") String entityId,
+            @PathParam("linkName") String linkName,
+            String link,
+            @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+        try {
+            final Accept acceptType;
+            if (StringUtils.isNotBlank(format)) {
+                acceptType = Accept.valueOf(format.toUpperCase());
+            } else {
+                acceptType = Accept.parse(accept, getVersion());
+            }
+
+            if (acceptType == Accept.ATOM) {
+                throw new UnsupportedMediaTypeException("Unsupported media type");
+            }
+
+            final Accept content;
+            if (StringUtils.isNotBlank(contentType)) {
+                content = Accept.parse(contentType, getVersion());
+            } else {
+                content = acceptType;
+            }
+
+            final AbstractUtilities utils = getUtilities(acceptType);
+
+            final List<String> links;
+            if (content == Accept.XML || content == Accept.TEXT || content == Accept.ATOM) {
+                links = XMLUtilities.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
+            } else {
+                links = JSONUtilities.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
+            }
+
+            utils.putLinksInMemory(
+                    Commons.getEntityBasePath(entitySetName, entityId),
+                    entitySetName,
+                    entityId,
+                    linkName,
+                    links);
+
+            return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
+        } catch (Exception e) {
+            return xml.createFaultResponse(accept, e);
+        }
+    }
+
+    @MERGE
+    @Path("/{entitySetName}({entityId})/$links/{linkName}")
+    public Response mergeLink(
+            @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+            @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+            @PathParam("entitySetName") String entitySetName,
+            @PathParam("entityId") String entityId,
+            @PathParam("linkName") String linkName,
+            String link,
+            @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+        return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
+    }
+
+    @PATCH
+    @Path("/{entitySetName}({entityId})/$links/{linkName}")
+    public Response patchLink(
+            @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+            @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+            @PathParam("entitySetName") String entitySetName,
+            @PathParam("entityId") String entityId,
+            @PathParam("linkName") String linkName,
+            String link,
+            @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+        return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
+    }
+
+    @PUT
+    @Path("/{entitySetName}({entityId})/$links/{linkName}")
+    public Response putLink(
+            @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+            @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+            @PathParam("entitySetName") String entitySetName,
+            @PathParam("entityId") String entityId,
+            @PathParam("linkName") String linkName,
+            String link,
+            @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+        try {
+            final Accept acceptType;
+            if (StringUtils.isNotBlank(format)) {
+                acceptType = Accept.valueOf(format.toUpperCase());
+            } else {
+                acceptType = Accept.parse(accept, getVersion());
+            }
+
+            if (acceptType == Accept.ATOM) {
+                throw new UnsupportedMediaTypeException("Unsupported media type");
+            }
+
+            final Accept content;
+            if (StringUtils.isNotBlank(contentType)) {
+                content = Accept.parse(contentType, getVersion());
+            } else {
+                content = acceptType;
+            }
+
+            final AbstractUtilities utils = getUtilities(acceptType);
+
+            final List<String> links;
+            if (content == Accept.XML || content == Accept.TEXT || content == Accept.ATOM) {
+                links = XMLUtilities.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
+            } else {
+                links = JSONUtilities.extractLinkURIs(IOUtils.toInputStream(link)).getValue();
+            }
+
+            utils.putLinksInMemory(
+                    Commons.getEntityBasePath(entitySetName, entityId),
+                    entitySetName,
+                    linkName,
+                    links);
+
+            return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
+        } catch (Exception e) {
+            return xml.createFaultResponse(accept, e);
+        }
+    }
+
+    @DELETE
+    @Path("/{entitySetName}({entityId})/$links/{linkName}({linkId})")
+    public Response deleteLink(
+            @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
+            @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
+            @PathParam("entitySetName") String entitySetName,
+            @PathParam("entityId") String entityId,
+            @PathParam("linkName") String linkName,
+            @PathParam("linkId") String linkId,
+            @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+        try {
+            final Accept acceptType;
+            if (StringUtils.isNotBlank(format)) {
+                acceptType = Accept.valueOf(format.toUpperCase());
+            } else {
+                acceptType = Accept.parse(accept, getVersion());
+            }
+
+            if (acceptType == Accept.ATOM) {
+                throw new UnsupportedMediaTypeException("Unsupported media type");
+            }
+
+            final AbstractUtilities utils = getUtilities(acceptType);
+
+            final Map.Entry<String, List<String>> currents = JSONUtilities.extractLinkURIs(utils.readLinks(
+                    entitySetName, entityId, linkName, Accept.JSON_FULLMETA).getLinks());
+
+            final Map.Entry<String, List<String>> toBeRemoved = JSONUtilities.extractLinkURIs(utils.readLinks(
+                    entitySetName, entityId, linkName + "(" + linkId + ")", Accept.JSON_FULLMETA).getLinks());
+
+            final List<String> remains = currents.getValue();
+            remains.removeAll(toBeRemoved.getValue());
+
+            utils.putLinksInMemory(
+                    Commons.getEntityBasePath(entitySetName, entityId),
+                    entitySetName,
+                    linkName,
+                    remains);
+
+            return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
+        } catch (Exception e) {
+            return xml.createFaultResponse(accept, e);
+        }
+    }
+
     /**
      * Count sample.
      *
@@ -591,4 +763,15 @@ public abstract class AbstractServices {
             return xml.createFaultResponse(accept, e);
         }
     }
+
+    private AbstractUtilities getUtilities(final Accept accept) {
+        final AbstractUtilities utils;
+        if (accept == Accept.XML || accept == Accept.TEXT || accept == Accept.ATOM) {
+            utils = xml;
+        } else {
+            utils = json;
+        }
+
+        return utils;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/AbstractUtilities.java b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/AbstractUtilities.java
index e80c255..968bbbb 100644
--- a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/AbstractUtilities.java
+++ b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/AbstractUtilities.java
@@ -367,8 +367,8 @@ public abstract class AbstractUtilities {
         return fo.getContent().getInputStream();
     }
 
-    protected void putLinksInMemory(
-            final String path,
+    public void putLinksInMemory(
+            final String basePath,
             final String entitySetName,
             final String entityKey,
             final String linkName,
@@ -377,7 +377,7 @@ public abstract class AbstractUtilities {
 
         if (Commons.linkInfo.get(version).isFeed(entitySetName, linkName)) {
             try {
-                final Map.Entry<String, List<String>> currents = XMLUtilities.extractLinkURIs(
+                final Map.Entry<String, List<String>> currents = JSONUtilities.extractLinkURIs(
                         readLinks(entitySetName, entityKey, linkName, Accept.JSON_FULLMETA).getLinks());
                 uris.addAll(currents.getValue());
             } catch (Exception ignore) {
@@ -386,10 +386,10 @@ public abstract class AbstractUtilities {
 
         uris.addAll(links);
 
-        putLinksInMemory(path, entitySetName, linkName, uris);
+        putLinksInMemory(basePath, entitySetName, linkName, uris);
     }
 
-    protected void putLinksInMemory(
+    public void putLinksInMemory(
             final String basePath, final String entitySetName, final String linkName, final Collection<String> uris)
             throws IOException {
         fsManager.putInMemory(

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/Commons.java
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/Commons.java b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/Commons.java
index 801a6f2..403f3bc 100644
--- a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/Commons.java
+++ b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/Commons.java
@@ -30,6 +30,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -134,7 +135,11 @@ public abstract class Commons {
 
         for (String uri : link.getValue()) {
             builder.append("<uri>");
-            builder.append(DEFAULT_SERVICE_URL).append(uri);
+            if (URI.create(uri).isAbsolute()) {
+                builder.append(uri);
+            } else {
+                builder.append(DEFAULT_SERVICE_URL).append(uri);
+            }
             builder.append("</uri>");
         }
 
@@ -154,7 +159,13 @@ public abstract class Commons {
         final ArrayNode uris = new ArrayNode(JsonNodeFactory.instance);
 
         for (String uri : link.getValue()) {
-            uris.add(new ObjectNode(JsonNodeFactory.instance).put("uri", uri));
+            final String absoluteURI;
+            if (URI.create(uri).isAbsolute()) {
+                absoluteURI = uri;
+            } else {
+                absoluteURI = DEFAULT_SERVICE_URL + uri;
+            }
+            uris.add(new ObjectNode(JsonNodeFactory.instance).put("url", absoluteURI));
         }
 
         if (uris.size() == 1) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/JSONUtilities.java
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/JSONUtilities.java b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/JSONUtilities.java
index d5a3282..ab7c0ff 100644
--- a/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/JSONUtilities.java
+++ b/ODataJClient/test-service/src/main/java/com/msopentech/odatajclient/testservice/utils/JSONUtilities.java
@@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.node.TextNode;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -398,4 +399,30 @@ public class JSONUtilities extends AbstractUtilities {
 
         return IOUtils.toInputStream(toBeChangedObject.toString());
     }
+
+    public static Map.Entry<String, List<String>> extractLinkURIs(final InputStream is)
+            throws Exception {
+        final ObjectMapper mapper = new ObjectMapper();
+        final ObjectNode srcNode = (ObjectNode) mapper.readTree(is);
+        IOUtils.closeQuietly(is);
+
+        final List<String> links = new ArrayList<String>();
+
+        JsonNode uris = srcNode.get("value");
+        if (uris == null) {
+            final JsonNode url = srcNode.get("url");
+            if (url != null) {
+                links.add(url.textValue());
+            }
+        } else {
+            final Iterator<JsonNode> iter = ((ArrayNode) uris).iterator();
+            while (iter.hasNext()) {
+                links.add(iter.next().get("url").textValue());
+            }
+        }
+
+        final JsonNode next = srcNode.get(JSON_NEXTLINK_NAME);
+
+        return new SimpleEntry<String, List<String>>(next == null ? null : next.asText(), links);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/resources/v3/Customer/-10/links/Logins('3').full.json
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/resources/v3/Customer/-10/links/Logins('3').full.json b/ODataJClient/test-service/src/main/resources/v3/Customer/-10/links/Logins('3').full.json
new file mode 100644
index 0000000..3d33070
--- /dev/null
+++ b/ODataJClient/test-service/src/main/resources/v3/Customer/-10/links/Logins('3').full.json
@@ -0,0 +1,4 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/$metadata#Customer/$links/Logins/@Element",
+  "url": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/Login('3')"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.full.json
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.full.json b/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.full.json
new file mode 100644
index 0000000..a524d46
--- /dev/null
+++ b/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.full.json
@@ -0,0 +1,13 @@
+{
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/$metadata#Login/@Element",
+  "odata.type": "Microsoft.Test.OData.Services.AstoriaDefaultService.Login",
+  "odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/Login('3')",
+  "odata.editLink": "Login('3')",
+  "Customer@odata.navigationLinkUrl": "Login('3')/Customer",
+  "LastLogin@odata.navigationLinkUrl": "Login('3')/LastLogin",
+  "SentMessages@odata.navigationLinkUrl": "Login('3')/SentMessages",
+  "ReceivedMessages@odata.navigationLinkUrl": "Login('3')/ReceivedMessages",
+  "Orders@odata.navigationLinkUrl": "Login('3')/Orders",
+  "Username": "3",
+  "CustomerId": 1260024743
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.xml
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.xml b/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.xml
new file mode 100644
index 0000000..d72637e
--- /dev/null
+++ b/ODataJClient/test-service/src/main/resources/v3/Login/'3'/entity.xml
@@ -0,0 +1,42 @@
+<?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}/StaticService/V3/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/Login('3')</id>
+  <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
+  <link rel="edit" title="Login" href="Login('3')" />
+  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="Login('3')/Customer" />
+  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LastLogin" type="application/atom+xml;type=entry" title="LastLogin" href="Login('3')/LastLogin" />
+  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SentMessages" type="application/atom+xml;type=feed" title="SentMessages" href="Login('3')/SentMessages" />
+  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ReceivedMessages" type="application/atom+xml;type=feed" title="ReceivedMessages" href="Login('3')/ReceivedMessages" />
+  <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="Login('3')/Orders" />
+  <title />
+  <updated>2014-03-12T06:03:43Z</updated>
+  <author>
+    <name />
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:Username>3</d:Username>
+      <d:CustomerId m:type="Edm.Int32">1260024743</d:CustomerId>
+    </m:properties>
+  </content>
+</entry>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.full.json
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.full.json b/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.full.json
index 9123a3f..55e6ff9 100644
--- a/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.full.json	
+++ b/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.full.json	
@@ -1,7 +1,7 @@
 {
-  "odata.metadata": "http://11.10.10.6:8080/DefaultService.svc/$metadata#OrderLine/@Element",
+  "odata.metadata": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/$metadata#OrderLine/@Element",
   "odata.type": "Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine",
-  "odata.id": "http://11.10.10.6:8080/DefaultService.svc/OrderLine(OrderId=-10,ProductId=-10)",
+  "odata.id": "http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/OrderLine(OrderId=-10,ProductId=-10)",
   "odata.etag": "W/\"'lhvyagabhicdpqiqoxpztssvacdkxvoxdzksdsbykdrvnyg'\"",
           "odata.editLink": "OrderLine(OrderId=-10,ProductId=-10)",
   "Order@odata.navigationLinkUrl": "OrderLine(OrderId=-10,ProductId=-10)/Order",

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/eff82c55/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.xml
----------------------------------------------------------------------
diff --git a/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.xml b/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.xml
index 16cb52d..57228f2 100644
--- a/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.xml	
+++ b/ODataJClient/test-service/src/main/resources/v3/OrderLine/-10 -10/entity.xml	
@@ -19,8 +19,8 @@
     under the License.
 
 -->
-<entry xml:base="http://11.10.10.6:8080/DefaultService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag="W/&quot;'lhvyagabhicdpqiqoxpztssvacdkxvoxdzksdsbykdrvnyg'&quot;">
-  <id>http://11.10.10.6:8080/DefaultService.svc/OrderLine(OrderId=-10,ProductId=-10)</id>
+<entry xml:base="http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:etag="W/&quot;'lhvyagabhicdpqiqoxpztssvacdkxvoxdzksdsbykdrvnyg'&quot;">
+  <id>http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/OrderLine(OrderId=-10,ProductId=-10)</id>
   <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
   <link rel="edit" title="OrderLine" href="OrderLine(OrderId=-10,ProductId=-10)" />
   <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order" type="application/atom+xml;type=entry" title="Order" href="OrderLine(OrderId=-10,ProductId=-10)/Order" />