You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/29 09:22:48 UTC

[1/8] [OLINGO-363] Better metadata ETag management

Repository: olingo-odata4
Updated Branches:
  refs/heads/OLINGO-377-FIT ba3aa4ff6 -> b95779b2a


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
index 4f5e2bb..6b1965c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAMU9fZAkVX09s7Mfs7Mf98V58nVQUcIJN8t9wB23eDi7O7s3YW5v2F0OPNFU78zb3fZmuofunr1ZK0ARS1KFGiHCyRWlGEqJMXfRHNESUpIiETVWKEshlKYIJIYKMZEqjMTEJJb5vff643X3655+Pbt4f1zN9L73+36/3+/93q/fnH1d6jV06aCmL+flplxdQXmtrqjLWr5aV5Bq5quajvKo1si3G/X86v78bUfLR5Ep12RTLjWa9flH/2TvI//9tlZaktq6dH08MIVFw9TlqsnA+trnDh4f/s75z6elVFnKwMC2KV1VBnBjFNwYBTdGwcFDZQwGjQG0sSIMHgfk14ohh2klEzV6bvunn5w5/MIbmIEmSGJPbElgvFgEX/jjbVN/+L5P1gjpgzpaQjpSq8gwpU3lD8qr8ljLVOpjZcUwMZV7halsT45Kdy7svvAHaSldloawtOaRvqoQFPviyWiKmTRelvpXkW4ommpKWyiJdVldHps3dZg/3r5DukvqMWJrE0TBgsciOfRb9958e/XqF4h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ug+skm2QaCpMEueWcc9FCMHDbF34naSKOwu69eYEv4Y2/Oj7Rux9RbPkueuDzlamSzpfotGmjKeXcEcHR/rr9qEIUKcFrJPgeq9cwZb2jT2HGJ/BBIW+dhXlhjCb0TopwC7B+KodmG4kq6VE/ldMFPynLMRSqZkuu061puEIGlpUlsyrrNYypiwOpsCCSXdTUljFn/UxB1O7YxzUzNCJ+dvithiHXQTLv/3O81Pr/ToPX93ZbwYxSNnYDzPu64Wyu/4/ueFUmuAQYmkPDve3lOOdOb6UWkzHIUJ0KVpxFfoFyAekNnA5/7NKHzn/6g09dl5YGvb+DJTebMNNY0KydKr3Nwb6e9K380YXgW3C8IjqtJeGIEaglBYstsOfo2Z8P7oH+H4FFEOzTdAAA";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Address", org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.class);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
index 052883d..3310762 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
@@ -45,14 +45,14 @@ public final class ODataClientFactory {
   }
 
   public static org.apache.olingo.client.api.v4.EdmEnabledODataClient getEdmEnabledV4(final String serviceRoot) {
-    return getEdmEnabledV4(serviceRoot, null);
+    return getEdmEnabledV4(serviceRoot, null, null);
   }
 
   public static org.apache.olingo.client.api.v4.EdmEnabledODataClient getEdmEnabledV4(
-          final String serviceRoot, final Edm edm) {
+          final String serviceRoot, final Edm edm, final String metadataETag) {
 
     final org.apache.olingo.client.api.v4.EdmEnabledODataClient instance =
-            new org.apache.olingo.client.core.v4.EdmEnabledODataClientImpl(serviceRoot, edm);
+            new org.apache.olingo.client.core.v4.EdmEnabledODataClientImpl(serviceRoot, edm, metadataETag);
     instance.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
     return instance;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/EdmEnabledODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/EdmEnabledODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/EdmEnabledODataClientImpl.java
index 762275c..9e45852 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/EdmEnabledODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/EdmEnabledODataClientImpl.java
@@ -59,7 +59,7 @@ public class EdmEnabledODataClientImpl extends ODataClientImpl implements EdmEna
 
   @Override
   public Edm getCachedEdm() {
-    if (edm == null) {
+    if (this.edm == null) {
       getEdm(null);
     }
     return this.edm;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
index fb47366..5baac81 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.olingo.client.core.v4;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.communication.request.invoke.EdmEnabledInvokeRequestFactory;
 import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -38,12 +37,12 @@ public class EdmEnabledODataClientImpl extends ODataClientImpl implements EdmEna
 
   private EdmEnabledInvokeRequestFactory edmEnabledInvokeRequestFactory;
 
-  public EdmEnabledODataClientImpl(final String serviceRoot, final Edm edm) {
+  public EdmEnabledODataClientImpl(final String serviceRoot, final Edm edm, final String metadataETag) {
     super();
 
     this.serviceRoot = serviceRoot;
     this.edm = edm;
-    this.metadataETag = StringUtils.EMPTY;
+    this.metadataETag = metadataETag;
   }
 
   @Override
@@ -54,7 +53,7 @@ public class EdmEnabledODataClientImpl extends ODataClientImpl implements EdmEna
   @Override
   public Edm getEdm(final String metadataETag) {
     synchronized (this) {
-      if (this.metadataETag != null && !this.metadataETag.equals(metadataETag)) {
+      if (this.edm == null || (metadataETag != null && !metadataETag.equals(this.metadataETag))) {
         final EdmMetadataRequest metadataReq = getRetrieveRequestFactory().getMetadataRequest(serviceRoot);
         final ODataRetrieveResponse<Edm> metadataRes = metadataReq.execute();
         this.metadataETag = metadataRes.getETag();
@@ -66,7 +65,7 @@ public class EdmEnabledODataClientImpl extends ODataClientImpl implements EdmEna
 
   @Override
   public Edm getCachedEdm() {
-    if (edm == null) {
+    if (this.edm == null) {
       getEdm(null);
     }
     return this.edm;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index daa669a..4760103 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -18,6 +18,14 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Iterator;
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.AbstractTest;
@@ -26,12 +34,12 @@ import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
 import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.domain.v4.ODataValuable;
-import org.apache.olingo.commons.api.domain.v4.ODataValue;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.format.ODataFormat;
@@ -41,15 +49,6 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Iterator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class EntityTest extends AbstractTest {
 
   @Override
@@ -58,7 +57,7 @@ public class EntityTest extends AbstractTest {
   }
 
   private EdmEnabledODataClient getEdmEnabledClient() {
-    return new EdmEnabledODataClientImpl(null, null) {
+    return new EdmEnabledODataClientImpl(null, null, null) {
 
       private Edm edm;
 
@@ -355,7 +354,7 @@ public class EntityTest extends AbstractTest {
   }
 
   private void derived(final ODataClient client, final ODataFormat format) throws ODataDeserializerException {
-    final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));    
+    final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
     final ODataEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
     assertNotNull(entity);
 


[2/8] git commit: [OLINGO-363] Better metadata ETag management

Posted by mi...@apache.org.
[OLINGO-363] Better metadata ETag management


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

Branch: refs/heads/OLINGO-377-FIT
Commit: 05e41557f5796c7ce00b1bc4d34c5bb513b03e99
Parents: 633ef32
Author: Francesco Chicchiriccò <--global>
Authored: Mon Jul 28 10:05:27 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Mon Jul 28 10:05:27 2014 +0200

----------------------------------------------------------------------
 .../olingo/ext/proxy/AbstractService.java       |  4 ++--
 .../olingo/ext/pojogen/AbstractPOJOGenMojo.java | 17 ++++++++++-----
 .../src/main/resources/service.vm               |  8 ++++---
 .../olingo/fit/proxy/v3/AbstractTestITCase.java |  1 -
 .../proxy/v3/ActionOverloadingTestITCase.java   |  1 -
 .../olingo/fit/proxy/v3/AsyncTestITCase.java    |  1 -
 .../olingo/fit/proxy/v3/ContextTestITCase.java  |  1 -
 .../fit/proxy/v3/EntityCreateTestITCase.java    |  1 -
 .../fit/proxy/v3/EntityRetrieveTestITCase.java  |  1 -
 .../fit/proxy/v3/EntitySetTestITCase.java       |  1 -
 .../fit/proxy/v3/EntityUpdateTestITCase.java    |  1 -
 .../olingo/fit/proxy/v3/FilterTestITCase.java   |  1 -
 .../olingo/fit/proxy/v3/InvokeTestITCase.java   |  1 -
 .../fit/proxy/v3/MediaEntityTestITCase.java     |  1 -
 .../olingo/fit/proxy/v3/OpenTypeTestITCase.java |  1 -
 .../fit/proxy/v3/PrimitiveKeysTestITCase.java   |  1 -
 .../olingo/fit/proxy/v3/PropertyTestITCase.java |  1 -
 .../fit/proxy/v3/actionoverloading/Service.java |  8 ++++---
 .../olingo/fit/proxy/v3/opentype/Service.java   |  8 ++++---
 .../fit/proxy/v3/primitivekeys/Service.java     |  8 ++++---
 .../fit/proxy/v3/staticservice/Service.java     |  8 ++++---
 .../olingo/fit/proxy/v4/AbstractTestITCase.java |  1 -
 .../proxy/v4/AuthEntityCreateTestITCase.java    |  1 -
 .../proxy/v4/AuthEntityRetrieveTestITCase.java  |  1 -
 .../v4/BoundOperationInvokeTestITCase.java      |  1 -
 .../olingo/fit/proxy/v4/ContextTestITCase.java  |  1 -
 .../fit/proxy/v4/DerivedTypeTestITCase.java     |  1 -
 .../fit/proxy/v4/EntityCreateTestITCase.java    |  1 -
 .../fit/proxy/v4/EntityRetrieveTestITCase.java  |  1 -
 .../fit/proxy/v4/EntitySetTestITCase.java       |  1 -
 .../fit/proxy/v4/EntityUpdateTestITCase.java    |  1 -
 .../olingo/fit/proxy/v4/FilterTestITCase.java   |  1 -
 .../fit/proxy/v4/KeyAsSegmentTestITCase.java    |  1 -
 .../fit/proxy/v4/MediaEntityTestITCase.java     |  1 -
 ...TransactionalAuthEntityCreateTestITCase.java |  1 -
 .../NonTransactionalEntityCreateTestITCase.java |  1 -
 .../NonTransactionalEntityUpdateTestITCase.java |  1 -
 .../NonTransactionalMediaEntityTestITCase.java  |  1 -
 .../olingo/fit/proxy/v4/OpenTypeTestITCase.java |  1 -
 .../v4/OperationImportInvokeTestITCase.java     |  1 -
 .../olingo/fit/proxy/v4/PropertyTestITCase.java |  1 -
 .../fit/proxy/v4/SingletonTestITCase.java       |  1 -
 .../v4/UnauthorizedEntityCreateTestITCase.java  |  1 -
 .../olingo/fit/proxy/v4/demo/Service.java       |  8 ++++---
 .../olingo/fit/proxy/v4/opentype/Service.java   |  8 ++++---
 .../fit/proxy/v4/staticservice/Service.java     |  8 ++++---
 .../olingo/client/core/ODataClientFactory.java  |  6 ++---
 .../core/v3/EdmEnabledODataClientImpl.java      |  2 +-
 .../core/v4/EdmEnabledODataClientImpl.java      |  9 ++++----
 .../olingo/client/core/v4/EntityTest.java       | 23 ++++++++++----------
 50 files changed, 72 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
index d6124bd..a2a05fd 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
@@ -61,7 +61,7 @@ public abstract class AbstractService<C extends CommonEdmEnabledODataClient<?>>
 
   private PersistenceManager persistenceManager;
 
-  protected AbstractService(final String compressedMetadata,
+  protected AbstractService(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     ByteArrayInputStream bais = null;
@@ -85,7 +85,7 @@ public abstract class AbstractService<C extends CommonEdmEnabledODataClient<?>>
     final Edm edm = metadata == null ? null : new EdmClientImpl(version, metadata.getSchemaByNsOrAlias());
     this.client = version.compareTo(ODataServiceVersion.V40) < 0
             ? ODataClientFactory.getEdmEnabledV3(serviceRoot, edm)
-            : ODataClientFactory.getEdmEnabledV4(serviceRoot, edm);
+            : ODataClientFactory.getEdmEnabledV4(serviceRoot, edm, metadataETag);
     this.client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON_FULL_METADATA);
     this.transactional = transactional;
     this.context = new Context();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index d23d92b..df3d0d3 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -36,14 +36,15 @@ import java.util.zip.GZIPOutputStream;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.ImmutableTriple;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.olingo.client.api.CommonODataClient;
 import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.edm.xml.XMLMetadata;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
@@ -196,7 +197,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
 
   protected abstract CommonODataClient<?> getClient();
 
-  private Pair<XMLMetadata, Edm> getMetadata() throws FileNotFoundException {
+  private Triple<XMLMetadata, String, Edm> getMetadata() throws FileNotFoundException {
     if (StringUtils.isEmpty(serviceRootURL) && StringUtils.isEmpty(localEdm)) {
       throw new IllegalArgumentException("Must provide either serviceRootURL or localEdm");
     }
@@ -205,11 +206,14 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
     }
 
     XMLMetadata metadata = null;
+    String metadataETag = null;
     Edm edm = null;
     if (StringUtils.isNotEmpty(serviceRootURL)) {
       final EdmMetadataRequest req = getClient().getRetrieveRequestFactory().getMetadataRequest(serviceRootURL);
       metadata = req.getXMLMetadata();
-      edm = req.execute().getBody();
+      final ODataRetrieveResponse<Edm> res = req.execute();
+      metadataETag = res.getETag();
+      edm = res.getBody();
     } else if (StringUtils.isNotEmpty(localEdm)) {
       final FileInputStream fis = new FileInputStream(FileUtils.getFile(localEdm));
       try {
@@ -223,7 +227,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
     if (metadata == null || edm == null) {
       throw new IllegalStateException("Metadata not found");
     }
-    return new ImmutablePair<XMLMetadata, Edm>(metadata, edm);
+    return new ImmutableTriple<XMLMetadata, String, Edm>(metadata, metadataETag, edm);
   }
 
   @Override
@@ -237,7 +241,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
     Velocity.addProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
 
     try {
-      final Pair<XMLMetadata, Edm> metadata = getMetadata();
+      final Triple<XMLMetadata, String, Edm> metadata = getMetadata();
 
       for (EdmSchema schema : metadata.getRight().getSchemas()) {
         namespaces.add(schema.getNamespace().toLowerCase());
@@ -361,6 +365,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
 
       objs.clear();
       objs.put("metadata", new String(Base64.encodeBase64(baos.toByteArray()), "UTF-8"));
+      objs.put("metadataETag", metadata.getMiddle());
       objs.put("complexTypes", complexTypeNames);
       objs.put("enumTypes", enumTypeNames);
       objs.put("terms", termNames);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/ext/pojogen-maven-plugin/src/main/resources/service.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/service.vm b/ext/pojogen-maven-plugin/src/main/resources/service.vm
index ca411f3..6078c10 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/service.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/service.vm
@@ -32,6 +32,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "$metadata";
+  private static final String METADATA_ETAG = #if($metadataETag)"$metadataETag"#{else}null#{end};
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -41,7 +42,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -104,10 +106,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
 #foreach ($complexType in $complexTypes.entrySet())

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
index df2a003..7c53798 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ActionOverloadingTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ActionOverloadingTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ActionOverloadingTestITCase.java
index 5a13532..ecfa21e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ActionOverloadingTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ActionOverloadingTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
index 3645bf2..62c2a73 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AsyncTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
index 3d8c225..7ef2365 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/ContextTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityCreateTestITCase.java
index 56e4cba..bda7f9e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
index 3b0e396..ecbfca0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityRetrieveTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntitySetTestITCase.java
index 14b7c1c..aa3a66c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntitySetTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntitySetTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Car;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityUpdateTestITCase.java
index a7a8bec..fd2be17 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityUpdateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/EntityUpdateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/FilterTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/FilterTestITCase.java
index dc9d615..aea7c0d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/FilterTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/FilterTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import org.apache.olingo.ext.proxy.api.Sort;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
index 62c3d60..f1eb965 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/InvokeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
index d3d74cd..d4ded24 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/MediaEntityTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
index 1ffa7d4..a0e8b99 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
index aa5e73a..5b227e1 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PropertyTestITCase.java
index 9778ba3..0041103 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PropertyTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PropertyTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v3;
 
 import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Driver;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
index babc2fe..076f6c0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAM1de4wkx1nv2Z3dndmdfd3L59hJTgcktgOzvjs/zt7Ezr7ubuPZ2/XO3tmsCJvemZrdzs10t7t71jMBGweJfxACDFFki8RIwSa25CRSeIWXIISIJJIlZJsQIBIBoSBkHIwSBYwsi3p39XOqH2vn/jjtVHd9r6r66quq31f9/KvKiG0p5w1rr6qaam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O90IJ9zvFeQfJUe6ZtBY1y9mXbRx3q4KKk91g3Eyu5XK4qcq9cCpuNy6RvSianPJJ8+mRCq271FbtQLzqRZXdIIxunIKo7XadKHdR2YRWsjQ8MgfQvT6crtd10El8pWdq5BQycfcI3LQg0U/iMevHcMExUcDEyVyXLNBK1mIj+HwpWZ0SYlNTKd5NuloRmSnZ2B0
 lufiJos3j0JuvtxAeUUOf7dkyapp+LcN3noo1Y08iDhVFmMQi0I+aENbX+VjTh4PmFkLI6O62I749RJ5JkalDXaPIkGcDyIxjMot9hxI55iOCngwgMYFJwFY8cwehcdxHAz+SJXLubCSRc2dlidxxWySRO26Tsgg6nwy3CHoyKEGBNLH4oZ+T/jamDwdQOokp+b+To9HGuj8zItb3/Z3Bn0fDFXLee/J+GAtFcq6730RfIrIDkhx3dx8FTC8WKV94sqMc5R9Qm+Mf4YoGUPPJBN2xI7FiHb66ejlmAgnZAfEvog8LfY4kS7YGTrT17gax5FIEibm2RK9PiFv/+m8T4rch5ne3ZMwVRWFwWib0oa58x90bH/CeeJaLPRL1xiOEMSSHRqSq9xPuI00sam0EAdxkwZpsxaNbsAfTYZvKxFMfMnbT9Vh+HWt+pg4syPg3oIUvN+dy2axwZ2zctuAMu0Q2oW0ZHhpfz5GoPWSjVhck67uaQ0kNkvXcTxLaHuQK2+BXrPO6W5dejxvXImPo0jZ5n0wd/6Khd+1EVSZX7Qvddrt/FZ/y4aqS0DKfW5TZfvPWiPPs3JEHXHx+V++6d+bGubyA0InMm24+qLBsxhRrf54IiS63kBhfMeFIZEEPduAz1Vv/H6ZL0er/ngAA";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory", org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory.class);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
index b36d09d..95e51b7 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAKVYeWwUVRh/u13obk8oYiKeIVHBY5ayHC1VtFAgG7a06ZRKNkF9zLzdDs7lzNuyq9aDhH+MUTHGQBRNDCgkHgneVyIS4pGYGCBeMfGIwRjEkECIJsT4vTczuzPdbTtb+KNhvpnve9/3+33X29fOoFm2hboMKy9gE0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nkej9YMchOu+znFy8ef/3bC9V3/IkJDH0xmpark6fKFd+wAoXpVgpHf9yrdX6hAyszLBdzcvcCgnFfPXCumHBnzVB2TQy8AvkdoWtk08Q64FSXVn1cHLj7k5f4HIjnLEMbqtzAWyziXKXsUcV0ZbOpUf4C6uXO+uql2omRvUfeeuLK61YD+1nUJjnjznauOdUZgMq3dV8Hv8Rp5PX6MFk01YpUo6tNLyg6Pxv+D9C5eFMhFwAA";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV3.ContactDetails", org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservicev3.types.ContactDetails.class);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
index c13ef53..581d4a9 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAL1YfYhcVxW/OzvJzuxusskmLfgtBW1t9E12Z7PdZNO0m52kjJnNLpnNEgZqevPmzuyz7yvv3Zm+aW20oogf1EaqNGgrlFZTsCpVa7QKqUVshYIkobYi+IFGJEYCLcFCKJ577/vMTHbezGY6fwzvnffe+T7n/s75wUW0xrbQlGFVJWxieZlIhqroVUOSVYXoVJINi0ikrEmOpkr1rHRorjBHKC5jivOaqZ78V+nlV77x1wcSCDkW2h6PzcwRm1pYpiFep56aWlr3++eeTqC+AkrCiw5FWwrALiPYZQS7jGAHRCUDL2WAW2YPvDwNwrd1Jhw+y1Oi9R/6239O7Dp3iRlggifGYnuCyWUuuPuem14694vl88IF4x1r4cyOoAcXP/He1xMoUUDDzBtFYtUVmdgUZeP5IBf6aLqABurEshVDp2i08GlcxxkV69VMkVrw/bRzFB1D/XbsaIGpYfbM5H8/dnLv2+Wn/8ejNWADAw2DshuEsBpV1ExBsSmLyo7O/BGW9JuLn7/t2VdnjnO/jIb8siSsY3akCugGDTu51g+FqRT1Z6Wt4h/M3sSUlJiS0oxl4QbT1HnozAdO/A4/3o/68ihpK/cTx0QI9d2XZP/wUTa2r4rcG8xLv3309IU3/nvlOwmm5Xqs6wbFFFRjApliQxBtbNuGrHCy7dFkAz4mzmLDJB5tA0hSaGMWQooVHSx06UOCHn41TfSaFiasrdmgr3c3WMdqjSwSSxMUCNFEZyESBn7vhW+98uJnkp/lwVmDVQXbbjz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978O7YBIoofWyWP/aAog2TwMotM/3F/Gr3qoGK8um/WqHLUG838ffT+4H3WPUywp5dk2CQ1H/mLT1/93U6ojqIQAA";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     //CHECKSTYLE:ON (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
index 5f2edfe..c224e15 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAM1de2xk11m/tsf22J61va9k06TtaqE0Sek4u5tsHm6S+rW7bsZrx+NsgkVxr2fO2LeZuffm3juOXUhokfgHIWigqhLRBqlKIJFSkAqU8hKUUtFWioSSUAqtREEoCIWUoFaFoqjivO8593nuw033j5Xnzj3f63znO9855/edeeF1bdh1tDssZ6eu23prF9StrmHuWPVW1wCmV29ZDqiDdq++3+vW987XH1pprABPb+uevtyzu8/9++ZXvvob3/75QU3bd7Q71cjMbbueo7c8gdYXnrnj6pGvfe7ZQW2goVXgi/ue9p4GJDdDyM0QcjOEHHxozMCXZiC1mSX48ixkfls25rDZsgd6Qw/9y38+dc8rbyAFbGiJs8qWQHyRCT74oTNfeuVPdl8lJjiXWYr9hSntsY33vu0bg9pgQ6shazSBs2e0gOtp59VssCg0mm1oo3vAcQ3L9LRjjQ/re/pMVzd3ZpqeA9vP7j+iPa4Nucq9BVUVySOV/+PJ5y7+oP3s/+LeGnUhgZ4OhZ0mzPqe0Z1pGK6HeuWubPYQOf316790+2dfnHsC2+WYYJerRDukR7Whnezp+4vRXxJVPW3ofP0W8j9U+zgSso6ErM85jn6AJN3/2Etvf+pv9U8PaQPLWsU1PgL2bU3TBh6toP9ho/PKtmpiayArffkTf/XaP37nzU8NIiknddO0PN2DoiGGSLAJ2Nu661otAz922bOWBRuD/Y0DG7Bn05CT4R0swC7VDRNqSJ9PkOfiq2PA7PfEByN9F8rLPo3v6d0+2ABOjzyBXXRrti4iCv7On33yq1/8hcov4s4Z1ruG7tL+GDP1HnAhOSD0gQ1decVoOZZrdbz6BnTt+irqtDrr7Pqc61mOoS+Cjt7veuwxajwN+0DDPaHt8wdn8IMzmWLXnG9s1D/dX/6HP/z0/EO9
 QW0IxRyzzWxUQRow73JABzjIzHoXmh+ZwDA9T7tXbWDunZ9ZjyLARiFTZxCrMwjVmc2jzpLZRhp99+8+dF3zhzdWB7UK9KMetKN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9FSxBa/EBni0k3ucw81xFORKdDAIcXzRcVN9lmH1+ko+lKHxXgnIaVRNFUNkmEDv/xDqwu3oL4BtdcrnPUckCh/6LqScXdo1uu6DLjuO9F5gmWw7urAK3WmXrq2OEMSSH0n4YjjJO/BPzRheBaNZ18dfpFBoe34BpMl0b5EoeJj9gbedLi/l1tOWZOrTry3+vXviV+VIu2xXuzOXcI84ep9kluhlty0o50A082eBXqltj/uwUuEk3/+zEL8qJ7Q9yhW+QY3l3C9PrgZN6ZBRdWqe+8KOry3nL7LuZmhxZdi/2u92DqxiUgpumgIoT
 FsmxD/ahxmfrt/w/9KIx9MGiAAA=";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory", org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory.class);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
index 6a74d50..ca1166f 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
index 265e6db..47d4417 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
index 1c41a27..1b4fede 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
index 3811a50..fadbeb7 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
index 19bd356..041d6ec 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
index 77fb3d1..8779e11 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertNotNull;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
index 6f05792..aaff867 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
index 35d56ab..9ffcba5 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
index e976b35..ccf956d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
index 35f7754..d2fd6b4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 //CHECKSTYLE:OFF (Maven checkstyle)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
index 4f3d54e..9c826d9 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
index c3a1156..5e546bf 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
index a6188cb..c268f30 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
index 20229f2..dbb5101 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
index 2a2d725..46f236b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
index 66dc0e5..ccb070c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
index c8368c4..696532a 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.v4.EdmEnabledODataClient;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
index 203d877..2cbd7bd 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
index 1f2a94a..b6400e4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java
index 1bad3e6..0b0a376 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertNull;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
index dc2be67..5c0b8c6 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
index b179271..cfc116e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.fit.proxy.v4;
 
 import org.apache.olingo.client.api.http.HttpClientException;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
index d853209..2f79095 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAMVaDYwcVR1/t7f3fW2PaylShS6mFFrLbq+9lsJhy/Z2e6zs0eP2esHjw8zNvNsbmZ0Z3ry92yVS1ERiwA8aFCFVVKIEI42mRgIYI6ggmjQmfAUTglHRhAgGAyGKJvp/b753ZvZmrhUbcuzMzvt//N7v/b9mH3kTdRkE7dNINSvogriIs5oiq1UtKyoyVmlW1AjOYqmWbdSU7NJo9rrJ8i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rmbkGj68sGDgIApezUP83SVwVK1jaRVSTDO6p4GNatUH0sjetku6pghUuqGvtHzNGt93FMxU8GVY/dlmMuBJfSaRfEkzlEitStsTyicvPLJ1BAjMQzv7pivU0F6GqLWgbbhs9c4+A6F++U0I8SoIrKvJfrnt2UzXwiTnpMdSv3LHbkPXawcZ8HQl1Npnl1a42nQterDG94N1Xmg8tARuawvc/ySyuHDZwTMGyc4kXL3eoL1KsOw53vsZhu2Jo97yewPrdtu1vWXNHP3yn1ZtD0no5u8ynDeCVQzJbbpUoD975bZ7K4/UeeHbJ0HAVc1XwVfE/HHHBNYM6HihythSsFf7XoNeAHXNkkBkVvX4f6dxUNMgfahjDf1o+M/SQmwOU4esf8PWO9ECbNJE8fDEdH7qqo8zPM5y315aOk9lyKdf/Pp7f4O6dM6ytaF3WKkHdFSJoC82pzRZbZ9
 6BqC0EuuE/eKwuRI7nINh9Vhn/Fj4WsbQo2FpDjkYEY3k/zN8jNcNqtV4+Ajpqduk2rZtp2X74AzU3kqxAQ2UYRo1wOsALMo1IZiTXKuKUNJrTYxP3yq7xfBY1W9Lb0F272hbFvZeJZPVFGFW+cRHjt7JNZ8AR2Pg41kMFveazyfissXUUBb79IdwObArrppu/lC3DzzbunhcNhd15qsm2L3s+YNNGoTLB/EEViVMXJ5ZYajteemaWtTU9yOFIEcd1XzqsFCLZoG/gEUdZziYtRa/4ZWkf/IUpMK5kcPWtufQjmx8dyfqsnTGUj2y9kkmic5ronFY5A0ApHM0uzNw/78+E7hjhjAAAA==";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("ODataDemo.Address", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address.class);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/05e41557/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
index a6f0d5a..6823b5e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
@@ -30,6 +30,7 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   //CHECKSTYLE:OFF (Maven checkstyle)
   private static final String COMPRESSED_METADATA = "H4sIAAAAAAAAAK1Ya2wUVRS+3d2+n6EVtahIjGgCzFIoUKgWS7c0q9tSu4WQAprbnbvbkXk5c3fZJTyCUX6gRhFfDRGUCCoCGlBCNP5Af4gmxgTQ8Euif4WEREKM+sNz57E7090uM9U/TffsPeee853vnseeuI4qdQ11KVqKwypOTBBOEQU5pXAJUSAy5RKKRjjCS1xWErlMJ7dxMDZIKOYxxVFJFeOHP15y8M870wGEshpa6c1M77hONZygDlvn3u/a0Pj96aMBVBFD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wUp9gCBlbhRIklAvT7FFHRimnqp8Y6zAU7ucVF8n8Bw1KQnkUXAAA=";
+  private static final String METADATA_ETAG = null;
   //CHECKSTYLE:ON (Maven checkstyle)
 
   private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
@@ -39,7 +40,8 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
     if (!SERVICES.containsKey(serviceRoot)) {
-      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, version, serviceRoot, transactional);
+      final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG, 
+          version, serviceRoot, transactional);
       SERVICES.put(serviceRoot, instance);
     }
 
@@ -102,10 +104,10 @@ public class Service<C extends CommonEdmEnabledODataClient<?>> extends AbstractS
 
   private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
 
-  public Service(final String compressedMetadata,
+  public Service(final String compressedMetadata, final String metadataETag,
           final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
 
-    super(compressedMetadata, version, serviceRoot, transactional);
+    super(compressedMetadata, metadataETag,version, serviceRoot, transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
     complexTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.AccountInfo", org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo.class);


[5/8] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4

Posted by mi...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4


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

Branch: refs/heads/OLINGO-377-FIT
Commit: 67cc0c440664c7e740378e5709c6cffce7cc5d60
Parents: 72dc69d 16f35e9
Author: fmartelli <fa...@gmail.com>
Authored: Mon Jul 28 17:49:20 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Jul 28 17:49:20 2014 +0200

----------------------------------------------------------------------
 samples/client/pom.xml                          |  46 ++++
 .../http/AzureADOAuth2HttpClientFactory.java    | 217 +++++++++++++++++++
 .../core/http/CookieHttpClientFactory.java      |  54 +++++
 .../CustomConnectionsHttpClientFactory.java     | 123 +++++++++++
 .../core/http/ParametersHttpClientFactory.java  |  53 +++++
 .../http/ParametersHttpUriRequestFactory.java   |  53 +++++
 .../ProtocolInterceptorHttpClientFactory.java   |  75 +++++++
 .../http/RequestRetryHttpClientFactory.java     |  86 ++++++++
 .../http/SocketFactoryHttpClientFactory.java    |  77 +++++++
 .../core/http/StatefulHttpClientFactory.java    |  57 +++++
 10 files changed, 841 insertions(+)
----------------------------------------------------------------------



[6/8] git commit: [OLINGO-365] fix for link update via reference ID

Posted by mi...@apache.org.
[OLINGO-365] fix for link update via reference ID


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

Branch: refs/heads/OLINGO-377-FIT
Commit: a5e983c9b884be030f6bb548da3c512b44912206
Parents: 67cc0c4
Author: fmartelli <fa...@gmail.com>
Authored: Mon Jul 28 22:06:03 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Jul 28 22:06:03 2014 +0200

----------------------------------------------------------------------
 .../AbstractCollectionInvocationHandler.java    |  14 ++
 .../commons/AbstractPersistenceManager.java     | 133 +++++++++++++------
 .../proxy/commons/EntityInvocationHandler.java  |  16 ++-
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  |   7 +
 4 files changed, 128 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5e983c9/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
index f1b9eb5..b06b594 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
@@ -56,6 +56,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
 
   protected Collection<String> referenceItems;
 
+  protected Collection<T> newest;
+
   protected final URI baseURI;
 
   protected CommonURIBuilder<?> uri;
@@ -67,6 +69,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
   private final Map<Class<? extends AbstractTerm>, Object> annotationsByTerm =
           new HashMap<Class<? extends AbstractTerm>, Object>();
 
+  private boolean changed = false;
+
   public AbstractCollectionInvocationHandler(
           final AbstractService<?> service,
           final Collection<T> items,
@@ -78,6 +82,7 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
     this.itemRef = itemRef;
     this.items = items;
     this.referenceItems = new ArrayList<String>();
+    this.newest = new ArrayList<T>();
     this.uri = uri;
     this.baseURI = this.uri == null ? null : this.uri.build();
   }
@@ -176,6 +181,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
         service.getContext().entityContext().attachNew(handler);
       }
     }
+    changed = true;
+    newest.add(element);
     return items.add(element);
   }
 
@@ -191,6 +198,7 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
         return false;
       }
 
+      changed = true;
       return referenceItems.add(id.toASCIIString());
     }
 
@@ -249,6 +257,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
 
   @Override
   public boolean addAll(final Collection<? extends T> collection) {
+    changed = true;
+    newest.addAll(collection);
     return items.addAll(collection);
   }
 
@@ -325,4 +335,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
     this.uri = this.baseURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString());
     this.nextPageURI = null;
   }
+
+  public boolean isChanged() {
+    return changed;
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5e983c9/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
index 62b701a..03d9072 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
@@ -174,51 +174,13 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
               : ODataLinkType.ENTITY_NAVIGATION;
 
       final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
-
       for (Object proxy : type == ODataLinkType.ENTITY_SET_NAVIGATION
               ? (Collection<?>) property.getValue() : Collections.singleton(property.getValue())) {
 
         final EntityInvocationHandler target = (EntityInvocationHandler) Proxy.getInvocationHandler(proxy);
 
-        final AttachedEntityStatus status;
-        if (!service.getContext().entityContext().isAttached(target)) {
-          status = resolveNavigationLink(property.getKey(), target);
-        } else {
-          status = service.getContext().entityContext().getStatus(target);
-        }
-
-        LOG.debug("Found link to '{}({})'", target, status);
-
-        final URI editLink = target.getEntity().getEditLink();
-
-        if ((status == AttachedEntityStatus.ATTACHED || status == AttachedEntityStatus.LINKED) && !target.isChanged()) {
-          LOG.debug("Add link to '{}'", target);
-          entity.addLink(buildNavigationLink(
-                  property.getKey().name(),
-                  URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
-        } else {
-          if (!items.contains(target)) {
-            pos = processEntityContext(target, pos, items, delayedUpdates, changeset);
-            pos++;
-          }
-
-          final Integer targetPos = items.get(target);
-          if (targetPos == null) {
-            // schedule update for the current object
-            LOG.debug("Schedule '{}' from '{}' to '{}'", type.name(), handler, target);
-            toBeLinked.add(target);
-          } else if (status == AttachedEntityStatus.CHANGED) {
-            LOG.debug("Changed: '{}' from '{}' to (${}) '{}'", type.name(), handler, targetPos, target);
-            entity.addLink(buildNavigationLink(
-                    property.getKey().name(),
-                    URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
-          } else {
-            // create the link for the current object
-            LOG.debug("'{}' from '{}' to (${}) '{}'", type.name(), handler, targetPos, target);
-
-            entity.addLink(buildNavigationLink(property.getKey().name(), URI.create("$" + targetPos), type));
-          }
-        }
+        toBeLinked.addAll(processLinkChanges(
+                handler, target, property.getKey(), type, pos, items, delayedUpdates, changeset));
       }
 
       if (!toBeLinked.isEmpty()) {
@@ -236,6 +198,41 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
       }
     }
 
+    // Required by linking provided on existent object. Say: 
+    //                    container.getCustomers().getByKey(1).getOrders().add(order)
+    // Required by linking provided via entity reference ID. Say: 
+    //                    container.getCustomers().getByKey(1).getOrders().addRef(order)
+    for (Map.Entry<NavigationProperty, Object> property : handler.linkCache.entrySet()) {
+      if (property.getValue() instanceof Proxy) {
+        final InvocationHandler target = Proxy.getInvocationHandler(property.getValue());
+
+        if (target instanceof EntityCollectionInvocationHandler
+                && ((EntityCollectionInvocationHandler) target).isChanged()) {
+
+          final ODataLinkType type = Collection.class.isAssignableFrom(property.getValue().getClass())
+                  ? ODataLinkType.ENTITY_SET_NAVIGATION
+                  : ODataLinkType.ENTITY_NAVIGATION;
+
+          final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
+
+          for (Object proxy : ((EntityCollectionInvocationHandler) target).newest) {
+            final EntityInvocationHandler targetEntity = (EntityInvocationHandler) Proxy.getInvocationHandler(proxy);
+
+            toBeLinked.addAll(processLinkChanges(
+                    handler, targetEntity, property.getKey(), type, pos, items, delayedUpdates, changeset));
+          }
+
+          if (!toBeLinked.isEmpty()) {
+            delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, toBeLinked, type));
+          }
+
+          for (String ref : ((EntityCollectionInvocationHandler<?>) target).referenceItems) {
+            delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, ref));
+          }
+        }
+      }
+    }
+
     if (entity instanceof ODataEntity) {
       for (Map.Entry<String, AnnotatableInvocationHandler> entry : handler.getNavPropAnnotatableHandlers().entrySet()) {
 
@@ -305,6 +302,62 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
     return pos;
   }
 
+  protected Set<EntityInvocationHandler> processLinkChanges(
+          final EntityInvocationHandler source,
+          final EntityInvocationHandler target,
+          final NavigationProperty property,
+          final ODataLinkType type,
+          int pos,
+          final TransactionItems items,
+          final List<EntityLinkDesc> delayedUpdates,
+          final PersistenceChanges changeset) {
+
+    final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
+
+    final AttachedEntityStatus status;
+    if (!service.getContext().entityContext().isAttached(target)) {
+      status = resolveNavigationLink(property, target);
+    } else {
+      status = service.getContext().entityContext().getStatus(target);
+    }
+
+    LOG.debug("Found link to '{}({})'", target, status);
+
+    final URI editLink = target.getEntity().getEditLink();
+
+    if ((status == AttachedEntityStatus.ATTACHED || status == AttachedEntityStatus.LINKED) && !target.isChanged()) {
+      LOG.debug("Add link to '{}'", target);
+      source.getEntity().addLink(buildNavigationLink(
+              property.name(),
+              URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
+    } else {
+      if (!items.contains(target)) {
+        pos = processEntityContext(target, pos, items, delayedUpdates, changeset);
+        pos++;
+      }
+
+      final Integer targetPos = items.get(target);
+      if (targetPos == null) {
+        // schedule update for the current object
+        LOG.debug("Schedule '{}' from '{}' to '{}'", type.name(), source, target);
+        toBeLinked.add(target);
+      } else if (status == AttachedEntityStatus.CHANGED) {
+        LOG.debug("Changed: '{}' from '{}' to (${}) '{}'", type.name(), source, targetPos, target);
+        source.getEntity().addLink(buildNavigationLink(
+                property.name(),
+                URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
+      } else {
+        // create the link for the current object
+        LOG.debug("'{}' from '{}' to (${}) '{}'", type.name(), source, targetPos, target);
+
+        source.getEntity().addLink(
+                buildNavigationLink(property.name(), URI.create("$" + targetPos), type));
+      }
+    }
+
+    return toBeLinked;
+  }
+
   protected void processDelayedUpdates(
           final List<EntityLinkDesc> delayedUpdates,
           int pos,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5e983c9/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 054604b..51d62ad 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -294,10 +294,21 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
     return isChanged(true);
   }
 
-  public boolean isChanged(final boolean includeMedia) {
+  public boolean isChanged(final boolean deep) {
+    boolean linkedChanges = false;
+    for (Map.Entry<NavigationProperty, Object> link : linkCache.entrySet()) {
+      final InvocationHandler handler = Proxy.getInvocationHandler(link.getValue());
+      if (handler instanceof EntityInvocationHandler) {
+        linkedChanges = linkedChanges || ((EntityInvocationHandler) handler).isChanged();
+      } else if (handler instanceof EntityCollectionInvocationHandler) {
+        linkedChanges = linkedChanges || ((EntityCollectionInvocationHandler) handler).isChanged();
+      }
+    }
+
     return this.linkChanges.hashCode() != this.linksTag
             || this.propertyChanges.hashCode() != this.propertiesTag
-            || (includeMedia && (this.stream != null
+            || (deep && (linkedChanges
+            || this.stream != null
             || !this.streamedPropertyChanges.isEmpty()));
   }
 
@@ -355,6 +366,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
 
     if (navPropValue != null) {
       cacheLink(property, navPropValue);
+      attach();
     }
 
     return navPropValue;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5e983c9/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
index 15076d0..6db0317 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
@@ -115,6 +115,13 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
     container.getCustomers().getByKey(1).setOrders(orders);
     container.flush();
   }
+  
+  @Test
+  public void addViaReference2() {
+    final Order order = container.getOrders().getByKey(8).load();
+    container.getCustomers().getByKey(1).getOrders().addRef(order);
+    container.flush();
+  }
 
   @Test
   public void readAndCheckForPrimitive() {


[3/8] git commit: [OLINGO-381] provided samples for advanced HTTP client-side handling; the submodule is not included in olingo-parent, being not meant for any distribution nor artifact, but only as reference

Posted by mi...@apache.org.
[OLINGO-381] provided samples for advanced HTTP client-side handling; the submodule is not included in olingo-parent, being not meant for any distribution nor artifact, but only as reference


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

Branch: refs/heads/OLINGO-377-FIT
Commit: 16f35e90bd40f2115adb3eff0736b85cd56b5f05
Parents: 05e4155
Author: Francesco Chicchiriccò <--global>
Authored: Mon Jul 28 12:31:26 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Mon Jul 28 12:31:26 2014 +0200

----------------------------------------------------------------------
 samples/client/pom.xml                          |  46 ++++
 .../http/AzureADOAuth2HttpClientFactory.java    | 217 +++++++++++++++++++
 .../core/http/CookieHttpClientFactory.java      |  54 +++++
 .../CustomConnectionsHttpClientFactory.java     | 123 +++++++++++
 .../core/http/ParametersHttpClientFactory.java  |  53 +++++
 .../http/ParametersHttpUriRequestFactory.java   |  53 +++++
 .../ProtocolInterceptorHttpClientFactory.java   |  75 +++++++
 .../http/RequestRetryHttpClientFactory.java     |  86 ++++++++
 .../http/SocketFactoryHttpClientFactory.java    |  77 +++++++
 .../core/http/StatefulHttpClientFactory.java    |  57 +++++
 10 files changed, 841 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/client/pom.xml b/samples/client/pom.xml
new file mode 100644
index 0000000..87d64fe
--- /dev/null
+++ b/samples/client/pom.xml
@@ -0,0 +1,46 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>olingo-client-samples</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+  <description>Olingo client customization samples.</description>
+  
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>olingo-parent</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../..</relativePath>
+  </parent>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-client-proxy</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/AzureADOAuth2HttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/AzureADOAuth2HttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/AzureADOAuth2HttpClientFactory.java
new file mode 100644
index 0000000..e281bd9
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/AzureADOAuth2HttpClientFactory.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.Header;
+import org.apache.http.HttpException;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpRequestInterceptor;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.util.EntityUtils;
+import org.apache.olingo.client.core.http.AbstractOAuth2HttpClientFactory;
+import org.apache.olingo.client.core.http.OAuth2Exception;
+
+/**
+ * Shows how to work with OAuth 2.0 native applications protected by Azure Active Directory.
+ * <a href="http://msdn.microsoft.com/en-us/library/azure/dn645542.aspx">More information</a>.
+ */
+public class AzureADOAuth2HttpClientFactory extends AbstractOAuth2HttpClientFactory {
+
+  private final String clientId;
+
+  private final String redirectURI;
+
+  private final String resourceURI;
+
+  private final UsernamePasswordCredentials creds;
+
+  private ObjectNode token;
+
+  public AzureADOAuth2HttpClientFactory(final String authority, final String clientId,
+          final String redirectURI, final String resourceURI, final UsernamePasswordCredentials creds) {
+
+    super(URI.create(authority + "/oauth2/authorize"), URI.create(authority + "/oauth2/token"));
+    this.clientId = clientId;
+    this.redirectURI = redirectURI;
+    this.resourceURI = resourceURI;
+    this.creds = creds;
+  }
+
+  @Override
+  protected boolean isInited() throws OAuth2Exception {
+    return token != null;
+  }
+
+  private void fetchAccessToken(final DefaultHttpClient httpClient, final List<BasicNameValuePair> data) {
+    token = null;
+
+    InputStream tokenResponse = null;
+    try {
+      final HttpPost post = new HttpPost(oauth2TokenServiceURI);
+      post.setEntity(new UrlEncodedFormEntity(data, "UTF-8"));
+
+      final HttpResponse response = httpClient.execute(post);
+
+      tokenResponse = response.getEntity().getContent();
+      token = (ObjectNode) new ObjectMapper().readTree(tokenResponse);
+    } catch (Exception e) {
+      throw new OAuth2Exception(e);
+    } finally {
+      IOUtils.closeQuietly(tokenResponse);
+    }
+  }
+
+  @Override
+  protected void init() throws OAuth2Exception {
+    final DefaultHttpClient httpClient = wrapped.create(null, null);
+
+    // 1. access the OAuth2 grant service (with authentication)
+    String code = null;
+    try {
+      final URIBuilder builder = new URIBuilder(oauth2GrantServiceURI).
+              addParameter("response_type", "code").
+              addParameter("client_id", clientId).
+              addParameter("redirect_uri", redirectURI);
+
+      HttpResponse response = httpClient.execute(new HttpGet(builder.build()));
+
+      final String loginPage = EntityUtils.toString(response.getEntity());
+
+      String postURL = StringUtils.substringBefore(
+              StringUtils.substringAfter(loginPage, "<form id=\"credentials\" method=\"post\" action=\""),
+              "\">");
+      final String ppsx = StringUtils.substringBefore(
+              StringUtils.substringAfter(loginPage, "<input type=\"hidden\" id=\"PPSX\" name=\"PPSX\" value=\""),
+              "\"/>");
+      final String ppft = StringUtils.substringBefore(
+              StringUtils.substringAfter(loginPage, "<input type=\"hidden\" name=\"PPFT\" id=\"i0327\" value=\""),
+              "\"/>");
+
+      List<BasicNameValuePair> data = new ArrayList<BasicNameValuePair>();
+      data.add(new BasicNameValuePair("login", creds.getUserName()));
+      data.add(new BasicNameValuePair("passwd", creds.getPassword()));
+      data.add(new BasicNameValuePair("PPSX", ppsx));
+      data.add(new BasicNameValuePair("PPFT", ppft));
+
+      HttpPost post = new HttpPost(postURL);
+      post.setEntity(new UrlEncodedFormEntity(data, "UTF-8"));
+
+      response = httpClient.execute(post);
+
+      final String samlPage = EntityUtils.toString(response.getEntity());
+
+      postURL = StringUtils.substringBefore(
+              StringUtils.substringAfter(samlPage, "<form name=\"fmHF\" id=\"fmHF\" action=\""),
+              "\" method=\"post\" target=\"_top\">");
+      final String wctx = StringUtils.substringBefore(
+              StringUtils.substringAfter(samlPage, "<input type=\"hidden\" name=\"wctx\" id=\"wctx\" value=\""),
+              "\">");
+      final String wresult = StringUtils.substringBefore(StringUtils.substringAfter(samlPage,
+              "<input type=\"hidden\" name=\"wresult\" id=\"wresult\" value=\""), "\">");
+      final String wa = StringUtils.substringBefore(
+              StringUtils.substringAfter(samlPage, "<input type=\"hidden\" name=\"wa\" id=\"wa\" value=\""),
+              "\">");
+
+      data = new ArrayList<BasicNameValuePair>();
+      data.add(new BasicNameValuePair("wctx", wctx));
+      data.add(new BasicNameValuePair("wresult", wresult.replace("&quot;", "\"")));
+      data.add(new BasicNameValuePair("wa", wa));
+
+      post = new HttpPost(postURL);
+      post.setEntity(new UrlEncodedFormEntity(data, "UTF-8"));
+
+      response = httpClient.execute(post);
+
+      final Header locationHeader = response.getFirstHeader("Location");
+      if (response.getStatusLine().getStatusCode() != 302 || locationHeader == null) {
+        throw new OAuth2Exception("Unexpected response from server");
+      }
+
+      final String[] oauth2Info = StringUtils.split(
+              StringUtils.substringAfter(locationHeader.getValue(), "?"), '&');
+      code = StringUtils.substringAfter(oauth2Info[0], "=");
+
+      EntityUtils.consume(response.getEntity());
+    } catch (Exception e) {
+      throw new OAuth2Exception(e);
+    }
+
+    if (code == null) {
+      throw new OAuth2Exception("No OAuth2 grant");
+    }
+
+    // 2. ask the OAuth2 token service
+    final List<BasicNameValuePair> data = new ArrayList<BasicNameValuePair>();
+    data.add(new BasicNameValuePair("grant_type", "authorization_code"));
+    data.add(new BasicNameValuePair("code", code));
+    data.add(new BasicNameValuePair("client_id", clientId));
+    data.add(new BasicNameValuePair("redirect_uri", redirectURI));
+    data.add(new BasicNameValuePair("resource", resourceURI));
+
+    fetchAccessToken(httpClient, data);
+
+    if (token == null) {
+      throw new OAuth2Exception("No OAuth2 access token");
+    }
+  }
+
+  @Override
+  protected void accessToken(final DefaultHttpClient client) throws OAuth2Exception {
+    client.addRequestInterceptor(new HttpRequestInterceptor() {
+
+      @Override
+      public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
+        request.removeHeaders(HttpHeaders.AUTHORIZATION);
+        request.addHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token.get("access_token").asText());
+      }
+    });
+  }
+
+  @Override
+  protected void refreshToken(final DefaultHttpClient client) throws OAuth2Exception {
+    final List<BasicNameValuePair> data = new ArrayList<BasicNameValuePair>();
+    data.add(new BasicNameValuePair("grant_type", "refresh_token"));
+    data.add(new BasicNameValuePair("refresh_token", token.get("refresh_token").asText()));
+
+    fetchAccessToken(wrapped.create(null, null), data);
+
+    if (token == null) {
+      throw new OAuth2Exception("No OAuth2 refresh token");
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CookieHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CookieHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CookieHttpClientFactory.java
new file mode 100644
index 0000000..4857b11
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CookieHttpClientFactory.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import org.apache.http.client.CookieStore;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+
+/**
+ * Shows how to work with HTTP cookies.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/statemgmt.html#d5e669">More
+ * information</a>.
+ */
+public class CookieHttpClientFactory extends DefaultHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final CookieStore cookieStore = new BasicCookieStore();
+
+    // Populate cookies if needed
+    final BasicClientCookie cookie = new BasicClientCookie("name", "value");
+    cookie.setVersion(0);
+    cookie.setDomain(".mycompany.com");
+    cookie.setPath("/");
+    cookieStore.addCookie(cookie);
+
+    final DefaultHttpClient httpClient = super.create(method, uri);
+    httpClient.setCookieStore(cookieStore);
+
+    return httpClient;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CustomConnectionsHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CustomConnectionsHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CustomConnectionsHttpClientFactory.java
new file mode 100644
index 0000000..8975678
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/CustomConnectionsHttpClientFactory.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.ParseException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ClientConnectionOperator;
+import org.apache.http.conn.OperatedClientConnection;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.BasicClientConnectionManager;
+import org.apache.http.impl.conn.DefaultClientConnection;
+import org.apache.http.impl.conn.DefaultClientConnectionOperator;
+import org.apache.http.impl.conn.DefaultHttpResponseParser;
+import org.apache.http.io.HttpMessageParser;
+import org.apache.http.io.SessionInputBuffer;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BasicLineParser;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpParams;
+import org.apache.http.util.CharArrayBuffer;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.AbstractHttpClientFactory;
+
+/**
+ * Shows how to use custom client connections.
+ * <br/>
+ * In certain situations it may be necessary to customize the way HTTP messages get transmitted across the wire beyond
+ * what is possible using HTTP parameters in order to be able to deal non-standard, non-compliant behaviours. For
+ * instance, for web crawlers it may be necessary to force HttpClient into accepting malformed response heads in order
+ * to salvage the content of the messages.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/advanced.html#d5e1339">More
+ * information</a>.
+ */
+public class CustomConnectionsHttpClientFactory extends AbstractHttpClientFactory {
+
+  private static class MyLineParser extends BasicLineParser {
+
+    @Override
+    public Header parseHeader(final CharArrayBuffer buffer) throws ParseException {
+      try {
+        return super.parseHeader(buffer);
+      } catch (ParseException ex) {
+        // Suppress ParseException exception
+        return new BasicHeader("invalid", buffer.toString());
+      }
+    }
+
+  }
+
+  private static class MyClientConnection extends DefaultClientConnection {
+
+    @Override
+    protected HttpMessageParser<HttpResponse> createResponseParser(
+            final SessionInputBuffer buffer,
+            final HttpResponseFactory responseFactory,
+            final HttpParams params) {
+
+      return new DefaultHttpResponseParser(
+              buffer,
+              new MyLineParser(),
+              responseFactory,
+              params);
+    }
+
+  }
+
+  private static class MyClientConnectionOperator extends DefaultClientConnectionOperator {
+
+    public MyClientConnectionOperator(final SchemeRegistry registry) {
+      super(registry);
+    }
+
+    @Override
+    public OperatedClientConnection createConnection() {
+      return new MyClientConnection();
+    }
+
+  }
+
+  private static class MyClientConnManager extends BasicClientConnectionManager {
+
+    @Override
+    protected ClientConnectionOperator createConnectionOperator(final SchemeRegistry registry) {
+      return new MyClientConnectionOperator(registry);
+    }
+
+  }
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final DefaultHttpClient httpClient = new DefaultHttpClient(new MyClientConnManager());
+    httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT);
+
+    return httpClient;
+  }
+
+  @Override
+  public void close(final HttpClient httpClient) {
+    httpClient.getConnectionManager().shutdown();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpClientFactory.java
new file mode 100644
index 0000000..bdee1d0
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpClientFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import org.apache.http.HttpVersion;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+
+/**
+ * Shows how to customize the runtime behavior of HTTP client component.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/fundamentals.html#d5e299">More
+ * information</a>.
+ *
+ * @see ParametersHttpUriRequestFactory for how to customize at request level
+ */
+public class ParametersHttpClientFactory extends DefaultHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final DefaultHttpClient httpClient = super.create(method, uri);
+
+    httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0);
+    httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
+
+    final int timeout = 1000;
+    HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), timeout);
+    HttpConnectionParams.setSoTimeout(httpClient.getParams(), timeout);
+
+    return httpClient;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpUriRequestFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpUriRequestFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpUriRequestFactory.java
new file mode 100644
index 0000000..9ba0746
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ParametersHttpUriRequestFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import org.apache.http.HttpVersion;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
+
+/**
+ * Shows how to customize the runtime behavior of an HTTP request.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/fundamentals.html#d5e299">More
+ * information</a>.
+ *
+ * @see ParametersHttpClientFactory for how to customize at whole client level
+ */
+public class ParametersHttpUriRequestFactory extends DefaultHttpUriRequestFactory {
+
+  @Override
+  public HttpUriRequest create(final HttpMethod method, final URI uri) {
+    final HttpUriRequest request = super.create(method, uri);
+
+    request.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0);
+    request.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
+
+    final int timeout = 1000;
+    HttpConnectionParams.setConnectionTimeout(request.getParams(), timeout);
+    HttpConnectionParams.setSoTimeout(request.getParams(), timeout);
+
+    return request;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ProtocolInterceptorHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ProtocolInterceptorHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ProtocolInterceptorHttpClientFactory.java
new file mode 100644
index 0000000..72beab9
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/ProtocolInterceptorHttpClientFactory.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.io.IOException;
+import java.net.URI;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpRequestInterceptor;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseInterceptor;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.protocol.HttpContext;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+
+/**
+ * Shows how to install HTTP protocol interceptors, an easy handle to hook into HTTP request / response processing.
+ * <br/>
+ * Usually protocol interceptors are expected to act upon one specific header or a group of related headers of the
+ * incoming message, or populate the outgoing message with one specific header or a group of related headers. Protocol
+ * interceptors can also manipulate content entities enclosed with messages - transparent content compression /
+ * decompression being a good example. Usually this is accomplished by using the 'Decorator' pattern where a wrapper
+ * entity class is used to decorate the original entity. Several protocol interceptors can be combined to form one
+ * logical unit.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/fundamentals.html#protocol_interceptors">More
+ * information</a>.
+ */
+public class ProtocolInterceptorHttpClientFactory extends DefaultHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+
+    final DefaultHttpClient httpClient = super.create(method, uri);
+
+    httpClient.addRequestInterceptor(new HttpRequestInterceptor() {
+
+      @Override
+      public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
+        request.addHeader("CUSTOM_HEADER", "CUSTOM VALUE");
+      }
+
+    });
+
+    httpClient.addResponseInterceptor(new HttpResponseInterceptor() {
+
+      @Override
+      public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException {
+        if ("ANOTHER CUSTOM VALUE".equals(response.getFirstHeader("ANOTHER_CUSTOM_HEADER"))) {
+          // do something
+        }
+      }
+    });
+
+    return httpClient;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/RequestRetryHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/RequestRetryHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/RequestRetryHttpClientFactory.java
new file mode 100644
index 0000000..e39e07b
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/RequestRetryHttpClientFactory.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.ConnectException;
+import java.net.URI;
+import java.net.UnknownHostException;
+import javax.net.ssl.SSLException;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpRequest;
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.protocol.ExecutionContext;
+import org.apache.http.protocol.HttpContext;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+
+/**
+ * Shows how to install a custom exception recovery mechanism.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/fundamentals.html#d5e281">More
+ * information</a>.
+ */
+public class RequestRetryHttpClientFactory extends DefaultHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final HttpRequestRetryHandler myRetryHandler = new HttpRequestRetryHandler() {
+
+      @Override
+      public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) {
+        if (executionCount >= 5) {
+          // Do not retry if over max retry count
+          return false;
+        }
+        if (exception instanceof InterruptedIOException) {
+          // Timeout
+          return false;
+        }
+        if (exception instanceof UnknownHostException) {
+          // Unknown host
+          return false;
+        }
+        if (exception instanceof ConnectException) {
+          // Connection refused
+          return false;
+        }
+        if (exception instanceof SSLException) {
+          // SSL handshake exception
+          return false;
+        }
+        final HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
+        if (idempotent) {
+          // Retry if the request is considered idempotent 
+          return true;
+        }
+        return false;
+      }
+
+    };
+
+    final DefaultHttpClient httpClient = super.create(method, uri);
+    httpClient.setHttpRequestRetryHandler(myRetryHandler);
+    return httpClient;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
new file mode 100644
index 0000000..1d41005
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import java.security.cert.X509Certificate;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.conn.BasicClientConnectionManager;
+import org.apache.http.params.CoreProtocolPNames;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.AbstractHttpClientFactory;
+import org.apache.olingo.commons.api.ODataRuntimeException;
+
+/**
+ * Shows how to customize the way how the underlying network socket are managed by the HTTP component; the specific
+ * sample is about how to trust self-signed SSL certificates and also empowers connection management.
+ * <br/>
+ * HTTP connections make use of a java.net.Socket object internally to handle transmission of data across the wire.
+ * However they rely on the SchemeSocketFactory interface to create, initialize and connect sockets. This enables the
+ * users of HttpClient to provide application specific socket initialization code at runtime. PlainSocketFactory is the
+ * default factory for creating and initializing plain (unencrypted) sockets.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/connmgmt.html#d5e512">More
+ * information</a>.
+ */
+public class SocketFactoryHttpClientFactory extends AbstractHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final TrustStrategy acceptTrustStrategy = new TrustStrategy() {
+      @Override
+      public boolean isTrusted(final X509Certificate[] certificate, final String authType) {
+        return true;
+      }
+    };
+
+    final SchemeRegistry registry = new SchemeRegistry();
+    try {
+      final SSLSocketFactory ssf =
+              new SSLSocketFactory(acceptTrustStrategy, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+      registry.register(new Scheme(uri.getScheme(), uri.getPort(), ssf));
+    } catch (Exception e) {
+      throw new ODataRuntimeException(e);
+    }
+
+    final DefaultHttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(registry));
+    httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT);
+
+    return httpClient;
+  }
+
+  @Override
+  public void close(final HttpClient httpClient) {
+    httpClient.getConnectionManager().shutdown();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16f35e90/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/StatefulHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/StatefulHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/StatefulHttpClientFactory.java
new file mode 100644
index 0000000..4d69abd
--- /dev/null
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/StatefulHttpClientFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.samples.client.core.http;
+
+import java.net.URI;
+import org.apache.http.client.UserTokenHandler;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.protocol.HttpContext;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+
+/**
+ * Shows how to work with stateful HTTP connections.
+ * <br/>
+ * HttpClient relies on <tt>UserTokenHandler</tt> interface to determine if the given execution context is user specific
+ * or not. The token object returned by this handler is expected to uniquely identify the current user if the context is
+ * user specific or to be null if the context does not contain any resources or details specific to the current user.
+ * The user token will be used to ensure that user specific resources will not be shared with or reused by other users.
+ * <a
+ * href="http://svn.apache.org/repos/asf/httpcomponents/site/httpcomponents-client-4.2.x/tutorial/html/advanced.html#stateful_conn">More
+ * information</a>.
+ */
+public class StatefulHttpClientFactory extends DefaultHttpClientFactory {
+
+  @Override
+  public DefaultHttpClient create(final HttpMethod method, final URI uri) {
+    final DefaultHttpClient httpClient = super.create(method, uri);
+
+    httpClient.setUserTokenHandler(new UserTokenHandler() {
+
+      @Override
+      public Object getUserToken(final HttpContext context) {
+        return context.getAttribute("my-token");
+      }
+
+    });
+
+    return httpClient;
+  }
+
+}


[7/8] git commit: [OLINGO-365] revert previous commit

Posted by mi...@apache.org.
[OLINGO-365] revert previous commit


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

Branch: refs/heads/OLINGO-377-FIT
Commit: 8c68516dcb6665083a5b6767458a83879edb3d0a
Parents: a5e983c
Author: fmartelli <fa...@gmail.com>
Authored: Mon Jul 28 22:23:54 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Jul 28 22:23:54 2014 +0200

----------------------------------------------------------------------
 .../AbstractCollectionInvocationHandler.java    |   5 -
 .../commons/AbstractPersistenceManager.java     | 133 ++++++-------------
 .../proxy/commons/EntityInvocationHandler.java  |  13 +-
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  |  16 ++-
 4 files changed, 50 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c68516d/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
index b06b594..d276302 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
@@ -56,8 +56,6 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
 
   protected Collection<String> referenceItems;
 
-  protected Collection<T> newest;
-
   protected final URI baseURI;
 
   protected CommonURIBuilder<?> uri;
@@ -82,7 +80,6 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
     this.itemRef = itemRef;
     this.items = items;
     this.referenceItems = new ArrayList<String>();
-    this.newest = new ArrayList<T>();
     this.uri = uri;
     this.baseURI = this.uri == null ? null : this.uri.build();
   }
@@ -182,7 +179,6 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
       }
     }
     changed = true;
-    newest.add(element);
     return items.add(element);
   }
 
@@ -258,7 +254,6 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
   @Override
   public boolean addAll(final Collection<? extends T> collection) {
     changed = true;
-    newest.addAll(collection);
     return items.addAll(collection);
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c68516d/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
index 03d9072..62b701a 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
@@ -174,58 +174,61 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
               : ODataLinkType.ENTITY_NAVIGATION;
 
       final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
+
       for (Object proxy : type == ODataLinkType.ENTITY_SET_NAVIGATION
               ? (Collection<?>) property.getValue() : Collections.singleton(property.getValue())) {
 
         final EntityInvocationHandler target = (EntityInvocationHandler) Proxy.getInvocationHandler(proxy);
 
-        toBeLinked.addAll(processLinkChanges(
-                handler, target, property.getKey(), type, pos, items, delayedUpdates, changeset));
-      }
+        final AttachedEntityStatus status;
+        if (!service.getContext().entityContext().isAttached(target)) {
+          status = resolveNavigationLink(property.getKey(), target);
+        } else {
+          status = service.getContext().entityContext().getStatus(target);
+        }
 
-      if (!toBeLinked.isEmpty()) {
-        delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, toBeLinked, type));
-      }
+        LOG.debug("Found link to '{}({})'", target, status);
 
-      if (property.getValue() instanceof Proxy) {
-        final InvocationHandler target = Proxy.getInvocationHandler(property.getValue());
+        final URI editLink = target.getEntity().getEditLink();
 
-        if (target instanceof EntityCollectionInvocationHandler) {
-          for (String ref : ((EntityCollectionInvocationHandler<?>) target).referenceItems) {
-            delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, ref));
+        if ((status == AttachedEntityStatus.ATTACHED || status == AttachedEntityStatus.LINKED) && !target.isChanged()) {
+          LOG.debug("Add link to '{}'", target);
+          entity.addLink(buildNavigationLink(
+                  property.getKey().name(),
+                  URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
+        } else {
+          if (!items.contains(target)) {
+            pos = processEntityContext(target, pos, items, delayedUpdates, changeset);
+            pos++;
+          }
+
+          final Integer targetPos = items.get(target);
+          if (targetPos == null) {
+            // schedule update for the current object
+            LOG.debug("Schedule '{}' from '{}' to '{}'", type.name(), handler, target);
+            toBeLinked.add(target);
+          } else if (status == AttachedEntityStatus.CHANGED) {
+            LOG.debug("Changed: '{}' from '{}' to (${}) '{}'", type.name(), handler, targetPos, target);
+            entity.addLink(buildNavigationLink(
+                    property.getKey().name(),
+                    URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
+          } else {
+            // create the link for the current object
+            LOG.debug("'{}' from '{}' to (${}) '{}'", type.name(), handler, targetPos, target);
+
+            entity.addLink(buildNavigationLink(property.getKey().name(), URI.create("$" + targetPos), type));
           }
         }
       }
-    }
 
-    // Required by linking provided on existent object. Say: 
-    //                    container.getCustomers().getByKey(1).getOrders().add(order)
-    // Required by linking provided via entity reference ID. Say: 
-    //                    container.getCustomers().getByKey(1).getOrders().addRef(order)
-    for (Map.Entry<NavigationProperty, Object> property : handler.linkCache.entrySet()) {
+      if (!toBeLinked.isEmpty()) {
+        delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, toBeLinked, type));
+      }
+
       if (property.getValue() instanceof Proxy) {
         final InvocationHandler target = Proxy.getInvocationHandler(property.getValue());
 
-        if (target instanceof EntityCollectionInvocationHandler
-                && ((EntityCollectionInvocationHandler) target).isChanged()) {
-
-          final ODataLinkType type = Collection.class.isAssignableFrom(property.getValue().getClass())
-                  ? ODataLinkType.ENTITY_SET_NAVIGATION
-                  : ODataLinkType.ENTITY_NAVIGATION;
-
-          final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
-
-          for (Object proxy : ((EntityCollectionInvocationHandler) target).newest) {
-            final EntityInvocationHandler targetEntity = (EntityInvocationHandler) Proxy.getInvocationHandler(proxy);
-
-            toBeLinked.addAll(processLinkChanges(
-                    handler, targetEntity, property.getKey(), type, pos, items, delayedUpdates, changeset));
-          }
-
-          if (!toBeLinked.isEmpty()) {
-            delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, toBeLinked, type));
-          }
-
+        if (target instanceof EntityCollectionInvocationHandler) {
           for (String ref : ((EntityCollectionInvocationHandler<?>) target).referenceItems) {
             delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, ref));
           }
@@ -302,62 +305,6 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
     return pos;
   }
 
-  protected Set<EntityInvocationHandler> processLinkChanges(
-          final EntityInvocationHandler source,
-          final EntityInvocationHandler target,
-          final NavigationProperty property,
-          final ODataLinkType type,
-          int pos,
-          final TransactionItems items,
-          final List<EntityLinkDesc> delayedUpdates,
-          final PersistenceChanges changeset) {
-
-    final Set<EntityInvocationHandler> toBeLinked = new HashSet<EntityInvocationHandler>();
-
-    final AttachedEntityStatus status;
-    if (!service.getContext().entityContext().isAttached(target)) {
-      status = resolveNavigationLink(property, target);
-    } else {
-      status = service.getContext().entityContext().getStatus(target);
-    }
-
-    LOG.debug("Found link to '{}({})'", target, status);
-
-    final URI editLink = target.getEntity().getEditLink();
-
-    if ((status == AttachedEntityStatus.ATTACHED || status == AttachedEntityStatus.LINKED) && !target.isChanged()) {
-      LOG.debug("Add link to '{}'", target);
-      source.getEntity().addLink(buildNavigationLink(
-              property.name(),
-              URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
-    } else {
-      if (!items.contains(target)) {
-        pos = processEntityContext(target, pos, items, delayedUpdates, changeset);
-        pos++;
-      }
-
-      final Integer targetPos = items.get(target);
-      if (targetPos == null) {
-        // schedule update for the current object
-        LOG.debug("Schedule '{}' from '{}' to '{}'", type.name(), source, target);
-        toBeLinked.add(target);
-      } else if (status == AttachedEntityStatus.CHANGED) {
-        LOG.debug("Changed: '{}' from '{}' to (${}) '{}'", type.name(), source, targetPos, target);
-        source.getEntity().addLink(buildNavigationLink(
-                property.name(),
-                URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type));
-      } else {
-        // create the link for the current object
-        LOG.debug("'{}' from '{}' to (${}) '{}'", type.name(), source, targetPos, target);
-
-        source.getEntity().addLink(
-                buildNavigationLink(property.name(), URI.create("$" + targetPos), type));
-      }
-    }
-
-    return toBeLinked;
-  }
-
   protected void processDelayedUpdates(
           final List<EntityLinkDesc> delayedUpdates,
           int pos,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c68516d/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 51d62ad..e7e11b6 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -295,20 +295,9 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
   }
 
   public boolean isChanged(final boolean deep) {
-    boolean linkedChanges = false;
-    for (Map.Entry<NavigationProperty, Object> link : linkCache.entrySet()) {
-      final InvocationHandler handler = Proxy.getInvocationHandler(link.getValue());
-      if (handler instanceof EntityInvocationHandler) {
-        linkedChanges = linkedChanges || ((EntityInvocationHandler) handler).isChanged();
-      } else if (handler instanceof EntityCollectionInvocationHandler) {
-        linkedChanges = linkedChanges || ((EntityCollectionInvocationHandler) handler).isChanged();
-      }
-    }
-
     return this.linkChanges.hashCode() != this.linksTag
             || this.propertyChanges.hashCode() != this.propertiesTag
-            || (deep && (linkedChanges
-            || this.stream != null
+            || (deep && (this.stream != null
             || !this.streamedPropertyChanges.isEmpty()));
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c68516d/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
index 6db0317..e687d41 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
@@ -115,13 +115,6 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
     container.getCustomers().getByKey(1).setOrders(orders);
     container.flush();
   }
-  
-  @Test
-  public void addViaReference2() {
-    final Order order = container.getOrders().getByKey(8).load();
-    container.getCustomers().getByKey(1).getOrders().addRef(order);
-    container.flush();
-  }
 
   @Test
   public void readAndCheckForPrimitive() {
@@ -492,6 +485,15 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
   }
 
   @Test
+  public void createAndCallOperation() {
+    final Product product = container.newEntityInstance(Product.class);
+    product.setProductID(1001);
+    container.flush();
+
+    container.getProducts().getByKey(1000).operations().getProductDetails(1).execute();
+  }
+
+  @Test
   public void workingWithOperations() {
     // Primitive collections (available only skip and top)
     final PrimitiveCollection<String> prods1 = container.operations().


[8/8] git commit: Merge branch 'master' into OLINGO-377-FIT

Posted by mi...@apache.org.
Merge branch 'master' into OLINGO-377-FIT


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

Branch: refs/heads/OLINGO-377-FIT
Commit: b95779b2ae4b92aef0ffb35ba1bf29898f3e2ccc
Parents: ba3aa4f 8c68516
Author: Michael Bolz <mi...@sap.com>
Authored: Tue Jul 29 09:01:34 2014 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Tue Jul 29 09:01:34 2014 +0200

----------------------------------------------------------------------
 .../olingo/ext/proxy/AbstractService.java       |   4 +-
 .../olingo/ext/proxy/api/EntityCollection.java  |  15 ++
 .../apache/olingo/ext/proxy/api/EntityType.java |  14 ++
 .../ext/proxy/api/PrimitiveCollection.java      |   2 +
 .../AbstractCollectionInvocationHandler.java    |  41 +++-
 .../commons/AbstractPersistenceManager.java     | 130 +++++++----
 .../AbstractStructuredInvocationHandler.java    |  18 +-
 .../EntityCollectionInvocationHandler.java      |   2 +-
 .../proxy/commons/EntityInvocationHandler.java  |  14 +-
 .../PrimitiveCollectionInvocationHandler.java   |   7 +
 .../ext/proxy/context/EntityLinkDesc.java       |  19 ++
 .../olingo/ext/pojogen/AbstractPOJOGenMojo.java |  17 +-
 .../src/main/resources/service.vm               |   8 +-
 .../java/org/apache/olingo/fit/V4Services.java  |  11 +
 .../Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json      |   8 +
 .../olingo/fit/proxy/v3/AbstractTestITCase.java |   1 -
 .../proxy/v3/ActionOverloadingTestITCase.java   |   1 -
 .../olingo/fit/proxy/v3/AsyncTestITCase.java    |   1 -
 .../olingo/fit/proxy/v3/ContextTestITCase.java  |   1 -
 .../fit/proxy/v3/EntityCreateTestITCase.java    |   1 -
 .../fit/proxy/v3/EntityRetrieveTestITCase.java  |   1 -
 .../fit/proxy/v3/EntitySetTestITCase.java       |   1 -
 .../fit/proxy/v3/EntityUpdateTestITCase.java    |   1 -
 .../olingo/fit/proxy/v3/FilterTestITCase.java   |   1 -
 .../olingo/fit/proxy/v3/InvokeTestITCase.java   |   1 -
 .../fit/proxy/v3/MediaEntityTestITCase.java     |   1 -
 .../olingo/fit/proxy/v3/OpenTypeTestITCase.java |   1 -
 .../fit/proxy/v3/PrimitiveKeysTestITCase.java   |   1 -
 .../olingo/fit/proxy/v3/PropertyTestITCase.java |   1 -
 .../fit/proxy/v3/actionoverloading/Service.java |   8 +-
 .../olingo/fit/proxy/v3/opentype/Service.java   |   8 +-
 .../fit/proxy/v3/primitivekeys/Service.java     |   8 +-
 .../fit/proxy/v3/staticservice/Service.java     |   8 +-
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  | 112 +++++++++-
 .../olingo/fit/proxy/v4/AbstractTestITCase.java |   1 -
 .../proxy/v4/AuthEntityCreateTestITCase.java    |   1 -
 .../proxy/v4/AuthEntityRetrieveTestITCase.java  |   1 -
 .../v4/BoundOperationInvokeTestITCase.java      |   1 -
 .../olingo/fit/proxy/v4/ContextTestITCase.java  |   1 -
 .../fit/proxy/v4/DerivedTypeTestITCase.java     |   1 -
 .../fit/proxy/v4/EntityCreateTestITCase.java    |   1 -
 .../fit/proxy/v4/EntityRetrieveTestITCase.java  |   1 -
 .../fit/proxy/v4/EntitySetTestITCase.java       |   1 -
 .../fit/proxy/v4/EntityUpdateTestITCase.java    |   3 +-
 .../olingo/fit/proxy/v4/FilterTestITCase.java   |   1 -
 .../fit/proxy/v4/KeyAsSegmentTestITCase.java    |   1 -
 .../fit/proxy/v4/MediaEntityTestITCase.java     |   1 -
 ...TransactionalAuthEntityCreateTestITCase.java |   1 -
 .../NonTransactionalEntityCreateTestITCase.java |   1 -
 .../NonTransactionalEntityUpdateTestITCase.java |   1 -
 .../NonTransactionalMediaEntityTestITCase.java  |   1 -
 .../olingo/fit/proxy/v4/OpenTypeTestITCase.java |   1 -
 .../v4/OperationImportInvokeTestITCase.java     |   1 -
 .../olingo/fit/proxy/v4/PropertyTestITCase.java |   1 -
 .../fit/proxy/v4/SingletonTestITCase.java       |   1 -
 .../v4/UnauthorizedEntityCreateTestITCase.java  |   1 -
 .../olingo/fit/proxy/v4/demo/Service.java       |   8 +-
 .../olingo/fit/proxy/v4/opentype/Service.java   |   8 +-
 .../fit/proxy/v4/staticservice/Service.java     |   8 +-
 .../request/cud/v4/CUDRequestFactory.java       |  12 +
 .../cud/v4/ODataReferenceAddingRequest.java     |  30 +++
 .../v4/ODataReferenceAddingResponse.java        |  29 +++
 .../olingo/client/core/ODataClientFactory.java  |   6 +-
 .../request/cud/v4/CUDRequestFactoryImpl.java   |   6 +
 .../cud/v4/ODataReferenceAddingRequestImpl.java |  92 ++++++++
 .../core/v3/EdmEnabledODataClientImpl.java      |   2 +-
 .../core/v4/EdmEnabledODataClientImpl.java      |   9 +-
 .../olingo/client/core/v4/EntityTest.java       |  23 +-
 samples/client/pom.xml                          |  46 ++++
 .../http/AzureADOAuth2HttpClientFactory.java    | 217 +++++++++++++++++++
 .../core/http/CookieHttpClientFactory.java      |  54 +++++
 .../CustomConnectionsHttpClientFactory.java     | 123 +++++++++++
 .../core/http/ParametersHttpClientFactory.java  |  53 +++++
 .../http/ParametersHttpUriRequestFactory.java   |  53 +++++
 .../ProtocolInterceptorHttpClientFactory.java   |  75 +++++++
 .../http/RequestRetryHttpClientFactory.java     |  86 ++++++++
 .../http/SocketFactoryHttpClientFactory.java    |  77 +++++++
 .../core/http/StatefulHttpClientFactory.java    |  57 +++++
 78 files changed, 1426 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b95779b2/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b95779b2/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
----------------------------------------------------------------------


[4/8] git commit: [OLINGO-365] provided more tests

Posted by mi...@apache.org.
[OLINGO-365] provided more tests


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

Branch: refs/heads/OLINGO-377-FIT
Commit: 72dc69dc8e2b5270ab9dbbe40e6bd3b7e5e248ba
Parents: 05e4155
Author: fmartelli <fa...@gmail.com>
Authored: Mon Jul 28 17:48:57 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Jul 28 17:48:57 2014 +0200

----------------------------------------------------------------------
 .../olingo/ext/proxy/api/EntityCollection.java  |  15 +++
 .../apache/olingo/ext/proxy/api/EntityType.java |  14 ++
 .../ext/proxy/api/PrimitiveCollection.java      |   2 +
 .../AbstractCollectionInvocationHandler.java    |  32 ++++-
 .../commons/AbstractPersistenceManager.java     | 130 +++++++++++++------
 .../AbstractStructuredInvocationHandler.java    |  18 ++-
 .../EntityCollectionInvocationHandler.java      |   2 +-
 .../proxy/commons/EntityInvocationHandler.java  |   9 ++
 .../PrimitiveCollectionInvocationHandler.java   |   7 +
 .../ext/proxy/context/EntityLinkDesc.java       |  19 +++
 .../java/org/apache/olingo/fit/V4Services.java  |  11 ++
 .../Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json      |   8 ++
 .../fit/proxy/v4/APIBasicDesignTestITCase.java  | 103 ++++++++++++++-
 .../fit/proxy/v4/EntityUpdateTestITCase.java    |   2 +-
 .../request/cud/v4/CUDRequestFactory.java       |  12 ++
 .../cud/v4/ODataReferenceAddingRequest.java     |  30 +++++
 .../v4/ODataReferenceAddingResponse.java        |  29 +++++
 .../request/cud/v4/CUDRequestFactoryImpl.java   |   6 +
 .../cud/v4/ODataReferenceAddingRequestImpl.java |  92 +++++++++++++
 19 files changed, 492 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
index 587b9f1..9ff7fe5 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
@@ -23,4 +23,19 @@ import java.util.Collection;
 public interface EntityCollection<
         T extends StructuredType<?>, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
         extends StructuredCollection<T, EC, CT> {
+
+  /**
+   * Appends ref segment to the URI.
+   *
+   * @return the same query instance.
+   */
+  CT refs();
+
+  /**
+   * Add entity by its reference ID.
+   *
+   * @param element entity to be linked.
+   * @return <tt>TRUE</tt> if correctly added; <tt>FALSE</tt> otherwise.
+   */
+  <ET extends EntityType<?>> boolean addRef(ET element);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
index 45f375d..891b2db 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
@@ -19,4 +19,18 @@
 package org.apache.olingo.ext.proxy.api;
 
 public interface EntityType<T extends StructuredType<?>> extends StructuredType<T> {
+
+  /**
+   * Appends ref segment to the URI.
+   *
+   * @return the same query instance.
+   */
+  T refs();
+
+  /**
+   * Gets entity reference ID.
+   *
+   * @return entity reference ID.
+   */
+  String getEntityReferenceID();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
index 4ec4a54..329dce8 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/PrimitiveCollection.java
@@ -26,4 +26,6 @@ public interface PrimitiveCollection<T extends Serializable>
         CollectionQuery<PrimitiveCollection<T>>,
         Collection<T>,
         Serializable {
+
+  void delete();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
index 73369f8..f1b9eb5 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
@@ -33,9 +33,13 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
 import org.apache.commons.lang3.tuple.Triple;
 import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
 import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.ext.proxy.api.EntityType;
 import org.apache.olingo.ext.proxy.api.Sort;
 import org.apache.olingo.ext.proxy.api.annotations.Namespace;
 import org.apache.olingo.ext.proxy.api.annotations.Term;
@@ -50,6 +54,8 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
 
   protected Collection<T> items;
 
+  protected Collection<String> referenceItems;
+
   protected final URI baseURI;
 
   protected CommonURIBuilder<?> uri;
@@ -71,13 +77,13 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
 
     this.itemRef = itemRef;
     this.items = items;
+    this.referenceItems = new ArrayList<String>();
     this.uri = uri;
     this.baseURI = this.uri == null ? null : this.uri.build();
   }
 
   public Future<Collection<T>> executeAsync() {
     return service.getClient().getConfiguration().getExecutor().submit(new Callable<Collection<T>>() {
-
       @Override
       public Collection<T> call() throws Exception {
         return execute();
@@ -173,6 +179,30 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
     return items.add(element);
   }
 
+  public <ET extends EntityType<?>> boolean addRef(final ET element) {
+    if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
+      return false;
+    }
+
+    if (element instanceof Proxy && Proxy.getInvocationHandler(element) instanceof EntityInvocationHandler) {
+      final EntityInvocationHandler handler = EntityInvocationHandler.class.cast(Proxy.getInvocationHandler(element));
+      final URI id = ((ODataEntity) handler.getEntity()).getId();
+      if (id == null) {
+        return false;
+      }
+
+      return referenceItems.add(id.toASCIIString());
+    }
+
+    return false;
+  }
+
+  public void refs() {
+    if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V40) >= 0) {
+      ((URIBuilder) this.uri).appendRefSegment();
+    }
+  }
+
   @Override
   public int size() {
     return items.size();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
index c01af76..62b701a 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java
@@ -18,6 +18,7 @@
  */
 package org.apache.olingo.ext.proxy.commons;
 
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 import java.net.URI;
 import java.util.ArrayList;
@@ -33,6 +34,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.communication.header.ODataPreferences;
 import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
 import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v4.ODataReferenceAddingRequest;
 import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
 import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
 import org.apache.olingo.client.core.uri.URIUtils;
@@ -71,7 +73,6 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
   @Override
   public Future<List<ODataRuntimeException>> flushAsync() {
     return service.getClient().getConfiguration().getExecutor().submit(new Callable<List<ODataRuntimeException>>() {
-
       @Override
       public List<ODataRuntimeException> call() throws Exception {
         return flush();
@@ -93,7 +94,6 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
       if (((status != AttachedEntityStatus.ATTACHED
               && status != AttachedEntityStatus.LINKED) || attachedEntity.getEntity().isChanged())
               && !items.contains(attachedEntity.getEntity())) {
-
         pos++;
         pos = processEntityContext(attachedEntity.getEntity(), pos, items, delayedUpdates, changes);
       }
@@ -224,6 +224,16 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
       if (!toBeLinked.isEmpty()) {
         delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, toBeLinked, type));
       }
+
+      if (property.getValue() instanceof Proxy) {
+        final InvocationHandler target = Proxy.getInvocationHandler(property.getValue());
+
+        if (target instanceof EntityCollectionInvocationHandler) {
+          for (String ref : ((EntityCollectionInvocationHandler<?>) target).referenceItems) {
+            delayedUpdates.add(new EntityLinkDesc(property.getKey().name(), handler, ref));
+          }
+        }
+      }
     }
 
     if (entity instanceof ODataEntity) {
@@ -253,7 +263,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
           final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                   ? URI.create("$" + startingPos)
                   : URIUtils.getURI(
-                          service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
+                  service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
           queueUpdate(handler, targetURI, entity, changeset);
           pos++;
           items.put(handler, pos);
@@ -265,8 +275,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
           final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                   ? URI.create("$" + startingPos + "/$value")
                   : URIUtils.getURI(
-                          service.getClient().getServiceRoot(),
-                          handler.getEntity().getEditLink().toASCIIString() + "/$value");
+                  service.getClient().getServiceRoot(),
+                  handler.getEntity().getEditLink().toASCIIString() + "/$value");
 
           queueUpdateMediaEntity(handler, targetURI, handler.getStreamChanges(), changeset);
 
@@ -280,8 +290,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
       for (Map.Entry<String, EdmStreamValue> streamedChanges : handler.getStreamedPropertyChanges().entrySet()) {
         final URI targetURI = currentStatus == AttachedEntityStatus.NEW
                 ? URI.create("$" + startingPos) : URIUtils.getURI(
-                        service.getClient().getServiceRoot(),
-                        CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
+                service.getClient().getServiceRoot(),
+                CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
 
         queueUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset);
 
@@ -302,46 +312,60 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
           final PersistenceChanges changeset) {
 
     for (EntityLinkDesc delayedUpdate : delayedUpdates) {
-      pos++;
-      items.put(delayedUpdate.getSource(), pos);
-
-      final CommonODataEntity changes =
-              service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName());
+      if (StringUtils.isBlank(delayedUpdate.getReference())) {
 
-      AttachedEntityStatus status = service.getContext().entityContext().getStatus(delayedUpdate.getSource());
+        pos++;
+        items.put(delayedUpdate.getSource(), pos);
 
-      final URI sourceURI;
-      if (status == AttachedEntityStatus.CHANGED) {
-        sourceURI = URIUtils.getURI(
-                service.getClient().getServiceRoot(),
-                delayedUpdate.getSource().getEntity().getEditLink().toASCIIString());
-      } else {
-        int sourcePos = items.get(delayedUpdate.getSource());
-        sourceURI = URI.create("$" + sourcePos);
-      }
+        final CommonODataEntity changes =
+                service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName());
 
-      for (EntityInvocationHandler target : delayedUpdate.getTargets()) {
-        status = service.getContext().entityContext().getStatus(target);
+        AttachedEntityStatus status = service.getContext().entityContext().getStatus(delayedUpdate.getSource());
 
-        final URI targetURI;
+        final URI sourceURI;
         if (status == AttachedEntityStatus.CHANGED) {
-          targetURI = URIUtils.getURI(
-                  service.getClient().getServiceRoot(), target.getEntity().getEditLink().toASCIIString());
+          sourceURI = URIUtils.getURI(
+                  service.getClient().getServiceRoot(),
+                  delayedUpdate.getSource().getEntity().getEditLink().toASCIIString());
         } else {
-          int targetPos = items.get(target);
-          targetURI = URI.create("$" + targetPos);
+          int sourcePos = items.get(delayedUpdate.getSource());
+          sourceURI = URI.create("$" + sourcePos);
         }
 
-        changes.addLink(delayedUpdate.getType() == ODataLinkType.ENTITY_NAVIGATION
-                ? service.getClient().getObjectFactory().
-                newEntityNavigationLink(delayedUpdate.getSourceName(), targetURI)
-                : service.getClient().getObjectFactory().
-                newEntitySetNavigationLink(delayedUpdate.getSourceName(), targetURI));
+        for (EntityInvocationHandler target : delayedUpdate.getTargets()) {
+          status = service.getContext().entityContext().getStatus(target);
 
-        LOG.debug("'{}' from {} to {}", delayedUpdate.getType().name(), sourceURI, targetURI);
-      }
+          final URI targetURI;
+          if (status == AttachedEntityStatus.CHANGED) {
+            targetURI = URIUtils.getURI(
+                    service.getClient().getServiceRoot(), target.getEntity().getEditLink().toASCIIString());
+          } else {
+            int targetPos = items.get(target);
+            targetURI = URI.create("$" + targetPos);
+          }
+
+          changes.addLink(delayedUpdate.getType() == ODataLinkType.ENTITY_NAVIGATION
+                  ? service.getClient().getObjectFactory().
+                  newEntityNavigationLink(delayedUpdate.getSourceName(), targetURI)
+                  : service.getClient().getObjectFactory().
+                  newEntitySetNavigationLink(delayedUpdate.getSourceName(), targetURI));
 
-      queueUpdate(delayedUpdate.getSource(), sourceURI, changes, changeset);
+          LOG.debug("'{}' from {} to {}", delayedUpdate.getType().name(), sourceURI, targetURI);
+        }
+
+        queueUpdate(delayedUpdate.getSource(), sourceURI, changes, changeset);
+      } else {
+        URI sourceURI = URIUtils.getURI(
+                service.getClient().getServiceRoot(),
+                delayedUpdate.getSource().getEntity().getEditLink().toASCIIString()
+                + "/" + delayedUpdate.getSourceName() + "/$ref");
+
+        if (queueUpdateLinkViaRef(
+                delayedUpdate.getSource(), sourceURI, URI.create(delayedUpdate.getReference()), changeset)) {
+          pos++;
+          items.put(delayedUpdate.getSource(), pos);
+        }
+      }
     }
   }
 
@@ -435,10 +459,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
             service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
             ? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(handler.getEntityURI(),
-                    org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
+            org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
             : ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(handler.getEntityURI(),
-                    org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
+            org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
 
     req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
 
@@ -449,6 +473,30 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
     changeset.addChange(req, handler);
   }
 
+  private boolean queueUpdateLinkViaRef(
+          final EntityInvocationHandler handler,
+          final URI source,
+          final URI targetRef,
+          final PersistenceChanges changeset) {
+
+    LOG.debug("Update '{}'", targetRef);
+    if (service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) >= 1) {
+      final ODataReferenceAddingRequest req =
+              ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
+              getReferenceAddingRequest(source, targetRef);
+
+      req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
+
+      if (StringUtils.isNotBlank(handler.getETag())) {
+        req.setIfMatch(handler.getETag());
+      }
+
+      changeset.addChange(req, handler);
+      return true;
+    }
+    return false;
+  }
+
   private void queueUpdate(
           final EntityInvocationHandler handler,
           final URI uri,
@@ -461,10 +509,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
             service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
             ? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(uri,
-                    org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
+            org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
             : ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
             getEntityUpdateRequest(uri,
-                    org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
+            org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
 
     req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/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 72cf7ec..b1835a3 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
@@ -37,6 +37,7 @@ import java.util.concurrent.Callable;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
 import org.apache.olingo.client.core.uri.URIUtils;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
@@ -47,6 +48,7 @@ import org.apache.olingo.commons.api.domain.ODataLinked;
 import org.apache.olingo.commons.api.domain.ODataValue;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.ext.proxy.AbstractService;
 import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
 import org.apache.olingo.ext.proxy.api.ComplexCollection;
@@ -156,7 +158,9 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
 
   @Override
   public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
-    if ("expand".equals(method.getName()) || "select".equals(method.getName())) {
+    if ("expand".equals(method.getName())
+            || "select".equals(method.getName())
+            || "refs".equals(method.getName())) {
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {
@@ -238,7 +242,8 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
   public void delete(final String name) {
     if (baseURI != null) {
       getContext().entityContext().addFurtherDeletes(
-              getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).build());
+              getClient().newURIBuilder(baseURI.toASCIIString()).appendPropertySegment(name).appendValueSegment().
+              build());
     }
   }
 
@@ -254,7 +259,8 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
         entityContext.attach(handler, AttachedEntityStatus.DELETED);
       }
     } else if (baseURI != null) {
-      entityContext.addFurtherDeletes(baseURI);
+      entityContext.addFurtherDeletes(
+              getClient().newURIBuilder(baseURI.toASCIIString()).appendValueSegment().build());
     }
   }
 
@@ -632,6 +638,12 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
     this.uri.select(select);
   }
 
+  public void refs() {
+    if (getClient().getServiceVersion().compareTo(ODataServiceVersion.V40) >= 0) {
+      ((URIBuilder) this.uri).appendRefSegment();
+    }
+  }
+
   public void clearQueryOptions() {
     this.uri = baseURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString());
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
index 6f54781..1a16888 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityCollectionInvocationHandler.java
@@ -59,8 +59,8 @@ public class EntityCollectionInvocationHandler<T extends EntityType<?>>
             || "expand".equals(method.getName())
             || "select".equals(method.getName())
             || "nextPage".equals(method.getName())
+            || "refs".equals(method.getName())
             || "execute".equals(method.getName())) {
-
       invokeSelfMethod(method, args);
       return proxy;
     } else if (isSelfMethod(method, args)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 7cd8d3c..054604b 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -508,6 +508,15 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
     return getEntity() == null ? null : getEntity().getProperty(name);
   }
 
+  public String getEntityReferenceID() {
+    URI id = getEntity() == null ? null
+            : getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
+            ? ((org.apache.olingo.commons.api.domain.v3.ODataEntity) getEntity()).getLink()
+            : ((org.apache.olingo.commons.api.domain.v4.ODataEntity) getEntity()).getId();
+
+    return id == null ? null : id.toASCIIString();
+  }
+
   @Override
   public String toString() {
     return uuid.toString();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
index 4da4b1a..48908c9 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
@@ -114,6 +114,13 @@ public class PrimitiveCollectionInvocationHandler<T extends Serializable>
             resItems, null, Collections.<ODataAnnotation>emptyList());
   }
 
+  public void delete() {
+    if (baseURI != null) {
+      getContext().entityContext().addFurtherDeletes(
+              getClient().newURIBuilder(baseURI.toASCIIString()).appendValueSegment().build());
+    }
+  }
+
   @Override
   public boolean equals(final Object obj) {
     if (obj instanceof Proxy) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java
index b96dc2d..5a53181 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityLinkDesc.java
@@ -41,6 +41,8 @@ public class EntityLinkDesc implements Serializable {
 
   private final ODataLinkType type;
 
+  private final String reference;
+
   public EntityLinkDesc(
           final String sourceName,
           final EntityInvocationHandler source,
@@ -50,6 +52,7 @@ public class EntityLinkDesc implements Serializable {
     this.source = source;
     this.targets = target;
     this.type = type;
+    this.reference = null;
   }
 
   public EntityLinkDesc(
@@ -61,6 +64,18 @@ public class EntityLinkDesc implements Serializable {
     this.source = source;
     this.targets = Collections.<EntityInvocationHandler>singleton(target);
     this.type = type;
+    this.reference = null;
+  }
+
+  public EntityLinkDesc(
+          final String sourceName,
+          final EntityInvocationHandler source,
+          final String targetRef) {
+    this.sourceName = sourceName;
+    this.source = source;
+    this.targets = null;
+    this.type = null;
+    this.reference = targetRef;
   }
 
   public String getSourceName() {
@@ -79,6 +94,10 @@ public class EntityLinkDesc implements Serializable {
     return type;
   }
 
+  public String getReference() {
+    return reference;
+  }
+
   /**
    * {@inheritDoc }
    */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/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 347705d..5b59ddc 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -1365,6 +1365,17 @@ public class V4Services extends AbstractServices {
     return xml.createResponse(null, null, null, Status.NO_CONTENT);
   }
 
+  @POST
+  @Path("/Customers(1)/Orders/$ref")
+  public Response linkOrderViaRef(
+          @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+          @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+          @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+          final String entity) {
+
+    return xml.createResponse(null, null, null, Status.NO_CONTENT);
+  }
+
   @DELETE
   @Path("/Products({productId})/Categories({categoryId})/$ref")
   public Response deleteLinked(

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/fit/src/main/resources/V40/references/Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/references/Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json b/fit/src/main/resources/V40/references/Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json
new file mode 100644
index 0000000..0ff0ae3
--- /dev/null
+++ b/fit/src/main/resources/V40/references/Q3VzdG9tZXJzKDEpL09yZGVycw==.full.json
@@ -0,0 +1,8 @@
+{
+  "@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#$ref",
+  "value":
+          [
+            {"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Orders(7)"},
+            {"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Orders(8)"}
+          ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
index 5150268..15076d0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
@@ -54,8 +54,10 @@ import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.service
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
 import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
@@ -75,6 +77,46 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
   }
 
   @Test
+  public void readEntitySet() {
+    final OrderCollection orders = container.getOrders().execute();
+    assertFalse(orders.isEmpty());
+
+    final CustomerCollection customers = container.getCustomers().
+            orderBy("PersonID").
+            select("FirstName", "LastName", "Orders").
+            expand("Orders").
+            execute();
+
+    assertEquals(2, customers.size());
+    for (Customer customer : customers) {
+      assertNotNull(customer.getFirstName());
+      assertNotNull(customer.getLastName());
+    }
+  }
+
+  @Test
+  public void readWithReferences() {
+    final Person person = container.getOrders().getByKey(8).getCustomerForOrder().refs().load();
+    assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(PersonID=1)",
+            person.getEntityReferenceID());
+
+    final OrderCollection orders = container.getCustomers().getByKey(1).getOrders().refs().execute();
+    assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Orders(7)",
+            orders.iterator().next().getEntityReferenceID());
+  }
+
+  @Test
+  public void addViaReference() {
+    final Order order = container.getOrders().getByKey(8).load();
+
+    final OrderCollection orders = container.newEntityCollection(OrderCollection.class);
+    orders.addRef(order);
+
+    container.getCustomers().getByKey(1).setOrders(orders);
+    container.flush();
+  }
+
+  @Test
   public void readAndCheckForPrimitive() {
     final Customer customer = getContainer().getCustomers().getByKey(1);
     assertNotNull(customer);
@@ -244,6 +286,42 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
   }
 
   @Test
+  public void deleteSingleProperty() {
+    container.getCustomers().getByKey(1).delete("City");
+    container.flush();
+  }
+
+  @Test
+  public void deleteComplex() {
+    container.getCustomers().getByKey(1).getHomeAddress().delete();
+    container.flush();
+  }
+
+  @Test
+  public void deleteCollection() {
+    container.getCustomers().getByKey(1).getEmails().delete();
+    container.flush();
+  }
+
+  @Test
+  public void deleteEdmStreamProperty() throws IOException {
+    // ---------------------------------------
+    // Instantiate Demo Service
+    // ---------------------------------------
+    final org.apache.olingo.fit.proxy.v4.demo.Service<EdmEnabledODataClient> dservice =
+            org.apache.olingo.fit.proxy.v4.demo.Service.getV4(testDemoServiceRootURL);
+    dservice.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+    final DemoService dcontainer = dservice.getEntityContainer(DemoService.class);
+    assertNotNull(dcontainer);
+    dservice.getContext().detachAll();
+    // ---------------------------------------
+    dcontainer.getPersonDetails().getByKey(1).delete("Photo");
+    dcontainer.flush();
+
+    dservice.getContext().detachAll(); // avoid influences
+  }
+
+  @Test
   public void updateComplexProperty() {
     Address homeAddress = container.getCustomers().getByKey(1).getHomeAddress();
     homeAddress.setCity("Pescara");
@@ -327,7 +405,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
     // ---------------------------------------
     org.apache.olingo.fit.proxy.v3.staticservice.Service<org.apache.olingo.client.api.v3.EdmEnabledODataClient> v3serv =
             org.apache.olingo.fit.proxy.v3.staticservice.Service.getV3(
-                    "http://localhost:9080/stub/StaticService/V30/Static.svc");
+            "http://localhost:9080/stub/StaticService/V30/Static.svc");
     v3serv.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
     final DefaultContainer v3cont = v3serv.getEntityContainer(DefaultContainer.class);
     assertNotNull(v3cont);
@@ -378,11 +456,32 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
     // container.getOrders().getByKey(1).getCustomerForOrder().getEmails().execute().isEmpty());
     // Not supported by the test service BTW generates a single request as expected: 
     // <service root>/Orders(1)/CustomerForOrder/Emails
+
+    emails.add("fabio.martelli@tirasa.net");
+    container.getPeople().getByKey(1).setEmails(emails);
+
+    container.flush();
+
+    boolean found = false;
+    for (String email : container.getPeople().getByKey(1).getEmails().execute()) {
+      if (email.equals("fabio.martelli@tirasa.net")) {
+        found = true;
+      }
+    }
+
+    assertTrue(found);
+
+    getService().getContext().detachAll();
   }
 
   @Test
   public void workingWithSingletons() {
     assertNotNull(container.getCompany().getVipCustomer().load().getPersonID());
+
+    container.getCompany().setName("new name");
+    container.flush();
+
+    assertEquals("new name", container.getCompany().load().getName());
   }
 
   @Test
@@ -424,7 +523,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
     final AddressCollection ac = container.newComplexCollection(AddressCollection.class);
     final Person updated = container.getCustomers().getByKey(2).operations().
             resetAddress(ac, 0).select("Name").expand("Orders").execute();
-    assertNotNull(person);
+    assertNotNull(updated);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
index d2fd6b4..863d041 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
@@ -62,7 +62,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
 
   @Test
   public void update() {
-    Person person = getContainer().getPeople().getByKey(1).load();
+    Person person = getContainer().getPeople().getByKey(1);
 
     final Address address = person.getHomeAddress();
     address.setCity("XXX");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
index 14bf85a..6652809 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java
@@ -32,4 +32,16 @@ public interface CUDRequestFactory extends CommonCUDRequestFactory<UpdateType> {
   ODataEntityUpdateRequest<ODataSingleton> getSingletonUpdateRequest(
           UpdateType type, ODataSingleton entity);
 
+  /**
+   * A successful POST request to a navigation property's references collection adds a relationship to an existing
+   * entity. The request body MUST contain a single entity reference that identifies the entity to be added. See the
+   * appropriate format document for details. On successful completion, the response MUST be 204 No Content and contain
+   * an empty body.
+   *
+   * @param <E> concrete ODataEntity implementation
+   * @param targetURI entity set URI.
+   * @param entity entity to be created.
+   * @return new ODataEntityCreateRequest instance.
+   */
+  ODataReferenceAddingRequest getReferenceAddingRequest(URI targetURI, URI reference);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/ODataReferenceAddingRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/ODataReferenceAddingRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/ODataReferenceAddingRequest.java
new file mode 100644
index 0000000..d107eb3
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/ODataReferenceAddingRequest.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.communication.request.cud.v4;
+
+import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.response.v4.ODataReferenceAddingResponse;
+
+/**
+ * This class implements an OData delete request.
+ */
+public interface ODataReferenceAddingRequest
+        extends ODataBasicRequest<ODataReferenceAddingResponse>, ODataBatchableRequest {
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java
new file mode 100644
index 0000000..12781f4
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/v4/ODataReferenceAddingResponse.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.communication.response.v4;
+
+import org.apache.olingo.client.api.communication.response.*;
+
+/**
+ * This class implements the response to an OData delete request.
+ *
+ * @see org.apache.olingo.client.core.communication.request.cud.ODataDeleteRequest
+ */
+public interface ODataReferenceAddingResponse extends ODataResponse {
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
index 090ec1e..2a745c9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java
@@ -22,7 +22,9 @@ import java.net.URI;
 
 import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
 import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
+import org.apache.olingo.client.api.communication.request.cud.v4.ODataReferenceAddingRequest;
 import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
+import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.communication.request.cud.AbstractCUDRequestFactory;
 import org.apache.olingo.commons.api.domain.v4.ODataSingleton;
@@ -47,4 +49,8 @@ public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory<UpdateType>
     return super.getEntityUpdateRequest(targetURI, type, changes);
   }
 
+  @Override
+  public ODataReferenceAddingRequest getReferenceAddingRequest(final URI targetURI, final URI reference) {
+    return new ODataReferenceAddingRequestImpl(client, HttpMethod.POST, targetURI, reference);
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/72dc69dc/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java
new file mode 100644
index 0000000..b596be6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/ODataReferenceAddingRequestImpl.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.communication.request.cud.v4;
+
+import java.io.IOException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
+import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
+import java.io.InputStream;
+import java.net.URI;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.communication.request.cud.v4.ODataReferenceAddingRequest;
+import org.apache.olingo.client.api.communication.response.v4.ODataReferenceAddingResponse;
+import org.apache.olingo.commons.api.Constants;
+
+/**
+ * This class implements an OData delete request.
+ */
+public class ODataReferenceAddingRequestImpl extends AbstractODataBasicRequest<ODataReferenceAddingResponse>
+        implements ODataReferenceAddingRequest {
+
+  final URI reference;
+
+  ODataReferenceAddingRequestImpl(
+          final CommonODataClient<?> odataClient, final HttpMethod method, final URI uri, final URI reference) {
+    super(odataClient, method, uri);
+    this.reference = reference;
+
+
+  }
+
+  @Override
+  public ODataFormat getDefaultFormat() {
+    return odataClient.getConfiguration().getDefaultPubFormat();
+  }
+
+  /**
+   * No payload: null will be returned.
+   */
+  @Override
+  protected InputStream getPayload() {
+    if (reference == null) {
+      return null;
+    } else {
+      try {
+        return IOUtils.toInputStream(reference.toASCIIString(), Constants.UTF8);
+      } catch (IOException e) {
+        LOG.warn("Error serializing reference {}", reference);
+        throw new IllegalArgumentException(e);
+      }
+    }
+  }
+
+  @Override
+  public ODataReferenceAddingResponse execute() {
+    return new ODataReferenceAddingResponseImpl(odataClient, httpClient, doExecute());
+  }
+
+  /**
+   * Response class about an ODataDeleteRequest.
+   */
+  private class ODataReferenceAddingResponseImpl extends AbstractODataResponse implements ODataReferenceAddingResponse {
+
+    private ODataReferenceAddingResponseImpl(
+            final CommonODataClient<?> odataClient, final HttpClient httpClient, final HttpResponse res) {
+
+      super(odataClient, httpClient, res);
+      this.close();
+    }
+  }
+}