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 2015/09/07 08:18:56 UTC

[4/8] olingo-odata4 git commit: [OLINGO-659] optimized integration tests

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
index 9d1a9ed..6aa0a37 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
@@ -26,8 +26,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.cud.UpdateType;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
@@ -37,21 +35,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientInlineEntity;
 import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
-import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
-import org.apache.olingo.fit.tecsvc.TecSvcConst;
 import org.junit.Test;
 
-public class BindingITCase extends AbstractBaseTestITCase {
-  protected static final String SERVICE_URI = TecSvcConst.BASE_URI;
+public class BindingITCase extends AbstractTecSvcITCase {
 
-  private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
   private static final String ES_KEY_NAV = "ESKeyNav";
   private static final String ES_TWO_KEY_NAV = "ESTwoKeyNav";
   private static final String ET_KEY_NAV_NAME = "ETKeyNav";
@@ -72,35 +63,35 @@ public class BindingITCase extends AbstractBaseTestITCase {
   private static final String NAV_PROPERTY_ET_TWO_KEY_NAV_MANY = "NavPropertyETTwoKeyNavMany";
 
   @Test
-  public void testCreateBindingSimple() throws EdmPrimitiveTypeException {
-    final ODataClient client = getClient();
+  public void createBindingSimple() throws EdmPrimitiveTypeException {
     final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
-    final ClientObjectFactory of = client.getObjectFactory();
 
     // Create entity (EntitySet: ESKeyNav, Type: ETKeyNav)
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)));
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 42)))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
-        .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))
+        .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
 
     // Bind existing entities via binding synatx
-    entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
+    entity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
         client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_TWO_KEY_NAV)
         .appendKeySegment(new LinkedHashMap<String, Object>() {
@@ -113,23 +104,23 @@ public class BindingITCase extends AbstractBaseTestITCase {
         }).build()));
 
     final ClientLink navLinkOne =
-        of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
+        factory.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(
                 ES_KEY_NAV).appendKeySegment(1).build());
     final ClientLink navLinkMany1 =
-        of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
+        factory.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(
                 ES_KEY_NAV).appendKeySegment(2).build());
     final ClientLink navLinkMany2 =
-        of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
+        factory.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(
                 ES_KEY_NAV).appendKeySegment(3).build());
 
-    final HashMap<String, Object> combinedKey = new HashMap<String, Object>();
+    HashMap<String, Object> combinedKey = new HashMap<String, Object>();
     combinedKey.put(PROPERTY_INT16, 1);
     combinedKey.put(PROPERTY_STRING, "1");
     final ClientLink navLink2Many =
-        of.newEntitySetNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
+        factory.newEntitySetNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(combinedKey).build());
 
     entity.addLink(navLinkOne);
@@ -138,37 +129,37 @@ public class BindingITCase extends AbstractBaseTestITCase {
     entity.addLink(navLink2Many);
 
     final ODataEntityCreateResponse<ClientEntity> createResponse =
-        client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
+        edmEnabledClient.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
     final String cookie = createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next();
     final Short entityInt16Key =
         createResponse.getBody().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class);
 
     // Check the just created entity
     final URI entityGetURI =
-        client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(entityInt16Key).expand(
-            NAV_PROPERTY_ET_KEY_NAV_ONE, NAV_PROPERTY_ET_KEY_NAV_MANY, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build();
+        edmEnabledClient.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(entityInt16Key)
+        .expand(NAV_PROPERTY_ET_KEY_NAV_ONE, NAV_PROPERTY_ET_KEY_NAV_MANY, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build();
 
     final ODataEntityRequest<ClientEntity> entityGetRequest =
-        client.getRetrieveRequestFactory().getEntityRequest(entityGetURI);
+        edmEnabledClient.getRetrieveRequestFactory().getEntityRequest(entityGetURI);
     entityGetRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
     final ODataRetrieveResponse<ClientEntity> entityGetResponse = entityGetRequest.execute();
 
     // NAV_PROPERTY_ET_KEY_NAV_ONE
-    assertEquals(Short.valueOf((short) 1), entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+    assertShortOrInt(1, entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
         .asInlineEntity().getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
 
     // NAV_PROPERTY_ET_KEY_NAV_MANY(0)
     Iterator<ClientEntity> iterator = entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
         .asInlineEntitySet().getEntitySet().getEntities().iterator();
-    assertEquals(Short.valueOf((short) 2), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+    assertShortOrInt(2, iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
         .toCastValue(Short.class));
 
     // NAV_PROPERTY_ET_KEY_NAV_MANY(1)
-    assertEquals(Short.valueOf((short) 3), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+    assertShortOrInt(3, iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
         .toCastValue(Short.class));
 
     // NAV_PROPERTY_ET_TWO_KEY_NAV_MANY(0)
-    assertEquals(Short.valueOf((short)1), entityGetResponse.getBody()
+    assertShortOrInt(1, entityGetResponse.getBody()
         .getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet().getEntities()
         .iterator().next().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
     assertEquals("1", entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)
@@ -180,7 +171,7 @@ public class BindingITCase extends AbstractBaseTestITCase {
         client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(combinedKey).expand(
             NAV_PROPERTY_ET_KEY_NAV_ONE).build();
     final ODataEntityRequest<ClientEntity> etTwoKeyNavEntityRequest =
-        client.getRetrieveRequestFactory().getEntityRequest(etTwoKeyNavEntityURI);
+        edmEnabledClient.getRetrieveRequestFactory().getEntityRequest(etTwoKeyNavEntityURI);
     etTwoKeyNavEntityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
     final ODataRetrieveResponse<ClientEntity> etTwoKeyNavEntityResponse = etTwoKeyNavEntityRequest.execute();
 
@@ -189,32 +180,30 @@ public class BindingITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testUpdateBinding() throws Exception {
+  public void updateBinding() throws Exception {
     // The entity MUST NOT contain related entities as inline content. It MAY contain binding information
     // for navigation properties. For single-valued navigation properties this replaces the relationship.
     // For collection-valued navigation properties this adds to the relationship.
 
-    final ODataClient client = getClient();
     final URI entityURI =
         client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
-    final ClientObjectFactory of = client.getObjectFactory();
 
     // ESKeyNav(1).NavPropertyETKeyNavOne = ESKeyNav(2)
     // ESKeyNav(1).NavPropertyETKeyNavMany = { ESKeyNav(1), ESKeyNav(2) }
     // => Replace NavPropertyETKeyNavOne with ESKeyNav(3)
     // => Add to NavPropertyETKeyNavOne ESKeyNav(3)
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
     final ClientLink navLinkOne =
-        of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
+        factory.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build());
     final ClientLink navLinkMany =
-        of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
+        factory.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build());
     entity.addLink(navLinkOne);
     entity.addLink(navLinkMany);
 
     final ODataEntityUpdateResponse<ClientEntity> updateResponse =
-        client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
+        edmEnabledClient.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
     final String cookie = updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next();
 
     // Check if update was successful
@@ -222,11 +211,11 @@ public class BindingITCase extends AbstractBaseTestITCase {
         client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).expand(
             NAV_PROPERTY_ET_KEY_NAV_ONE, NAV_PROPERTY_ET_KEY_NAV_MANY).build();
     final ODataEntityRequest<ClientEntity> entityRequest =
-        client.getRetrieveRequestFactory().getEntityRequest(entityGetURI);
+        edmEnabledClient.getRetrieveRequestFactory().getEntityRequest(entityGetURI);
     entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
     final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
 
-    assertEquals(Short.valueOf((short) 3), entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+    assertShortOrInt(3, entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
           .asInlineEntity().getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
     assertEquals(3, entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet()
         .getEntitySet().getEntities().size());
@@ -242,64 +231,60 @@ public class BindingITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testMissingEntity() {
+  public void missingEntity() {
     // Update an existing entity, use a URI to a not existing entity
     // Perform the request to a single navigation property and a collection navigation property as well.
     // Expected: Not Found (404)
 
-    final ODataClient client = getClient();
     final URI entityURI =
         client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
-    final ClientObjectFactory of = client.getObjectFactory();
 
     // Request to single (non collection) navigation property
-    ClientEntity entity = of.newEntity(ET_KEY_NAV);
+    ClientEntity entity = factory.newEntity(ET_KEY_NAV);
     final ClientLink navLinkOne =
-        of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
+        factory.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(42).build());
     entity.addLink(navLinkOne);
 
     try {
-      client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
+      edmEnabledClient.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
       fail();
     } catch (ODataClientErrorException e) {
       assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode());
     }
 
     // Request to collection navigation propetry
-    entity = of.newEntity(ET_KEY_NAV);
+    entity = factory.newEntity(ET_KEY_NAV);
     final ClientLink navLinkMany =
-        of.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
+        factory.newEntitySetNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY, client.newURIBuilder(SERVICE_URI)
             .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build());
     entity.addLink(navLinkMany);
 
     try {
-      client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
+      edmEnabledClient.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
     } catch (ODataClientErrorException e) {
       assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode());
     }
   }
 
   @Test
-  public void testDeepInsertWithBindingSameNavigationProperty() {
-    final EdmEnabledODataClient client = getClient();
-    client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
-    final ClientObjectFactory of = client.getObjectFactory();
-
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
-    entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder()
+  public void deepInsertWithBindingSameNavigationProperty() {
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
+    entity.getProperties().add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder()
         .buildString("1")));
-    entity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1")))));
+    entity.getProperties().add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 1)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("1")))));
 
-    final ClientEntity innerEntity = of.newEntity(ET_KEY_NAV);
-    innerEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder()
+    final ClientEntity innerEntity = factory.newEntity(ET_KEY_NAV);
+    innerEntity.getProperties().add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder()
         .buildString("2")));
-    innerEntity.getProperties().add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("2")))));
-    innerEntity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
+    innerEntity.getProperties().add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM,
+        factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 1)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("2")))));
+    innerEntity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
         client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_TWO_KEY_NAV)
         .appendKeySegment(new LinkedHashMap<String, Object>() {
@@ -311,10 +296,10 @@ public class BindingITCase extends AbstractBaseTestITCase {
           }
         }).build()));
 
-    final ClientInlineEntity inlineLink = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
+    final ClientInlineEntity inlineLink = factory.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
     entity.addLink(inlineLink);
 
-    entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
+    entity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
         client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_TWO_KEY_NAV)
         .appendKeySegment(new LinkedHashMap<String, Object>() {
@@ -330,27 +315,23 @@ public class BindingITCase extends AbstractBaseTestITCase {
         .appendKeySegment(3)
         .build();
 
-    entity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, bindingURI));
+    entity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, bindingURI));
 
     final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
     final ODataEntityCreateResponse<ClientEntity> response =
-        client.getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute();
+        edmEnabledClient.getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute();
 
     assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
 
-    assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
-        .asInlineEntity()
-        .getEntity()
-        .getProperty(PROPERTY_COMP_TWO_PRIM)
-        .getComplexValue()
-        .get(PROPERTY_INT16)
-        .getPrimitiveValue()
-        .toValue());
-  }
-
-  protected EdmEnabledODataClient getClient() {
-    EdmEnabledODataClient odata = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
-    odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
-    return odata;
+    if (isJson()) {
+      assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+          .asInlineEntity()
+          .getEntity()
+          .getProperty(PROPERTY_COMP_TWO_PRIM)
+          .getComplexValue()
+          .get(PROPERTY_INT16)
+          .getPrimitiveValue()
+          .toValue());
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
index e4443fa..76407e7 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
@@ -29,7 +29,6 @@ import static org.junit.Assert.fail;
 import java.net.URI;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
 import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
@@ -46,22 +45,18 @@ import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEnt
 import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientServiceDocument;
 import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
 import org.apache.olingo.fit.tecsvc.TecSvcConst;
 import org.junit.Test;
 
-public class ConditionalITCase extends AbstractBaseTestITCase {
-
-  private final ODataClient client = getClient();
+public class ConditionalITCase extends AbstractTecSvcITCase {
 
   private final URI uriEntity = client.newURIBuilder(TecSvcConst.BASE_URI)
       .appendEntitySetSegment("ESCompAllPrim").appendKeySegment(0).build();
@@ -75,30 +70,42 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
   public void readServiceDocument() throws Exception {
     ODataServiceDocumentRequest request = client.getRetrieveRequestFactory()
         .getServiceDocumentRequest(TecSvcConst.BASE_URI);
+    setCookieHeader(request);
     ODataRetrieveResponse<ClientServiceDocument> response = request.execute();
+    saveCookieHeader(response);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
 
     request = client.getRetrieveRequestFactory().getServiceDocumentRequest(TecSvcConst.BASE_URI);
     request.setIfNoneMatch(response.getETag());
-    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), request.execute().getStatusCode());
+    setCookieHeader(request);
+    response = request.execute();
+    saveCookieHeader(response);
+    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
 
     request = client.getRetrieveRequestFactory().getServiceDocumentRequest(TecSvcConst.BASE_URI);
     request.setIfMatch("W/\"0\"");
+    setCookieHeader(request);
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
 
   @Test
   public void readMetadataDocument() throws Exception {
     EdmMetadataRequest request = client.getRetrieveRequestFactory().getMetadataRequest(TecSvcConst.BASE_URI);
+    setCookieHeader(request);
     ODataRetrieveResponse<Edm> response = request.execute();
+    saveCookieHeader(response);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
 
     request = client.getRetrieveRequestFactory().getMetadataRequest(TecSvcConst.BASE_URI);
     request.setIfNoneMatch(response.getETag());
-    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), request.execute().getStatusCode());
+    setCookieHeader(request);
+    response = request.execute();
+    saveCookieHeader(response);
+    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
 
     request = client.getRetrieveRequestFactory().getMetadataRequest(TecSvcConst.BASE_URI);
     request.setIfMatch("W/\"0\"");
+    setCookieHeader(request);
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
 
@@ -107,6 +114,7 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
     ODataEntityRequest<ClientEntity> request = client.getRetrieveRequestFactory().getEntityRequest(uriEntity);
     request.setIfMatch("W/\"1\"");
     assertNotNull(request);
+    setCookieHeader(request);
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
 
@@ -115,8 +123,9 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
     ODataEntityRequest<ClientEntity> request = client.getRetrieveRequestFactory().getEntityRequest(uriEntity);
     request.setIfNoneMatch("W/\"0\"");
     assertNotNull(request);
-
+    setCookieHeader(request);
     final ODataRetrieveResponse<ClientEntity> response = request.execute();
+    saveCookieHeader(response);
     assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
   }
 
@@ -124,14 +133,14 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
   public void updateWithoutIfMatch() throws Exception {
     executeAndExpectError(
         client.getCUDRequestFactory().getEntityUpdateRequest(
-            uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order"))),
+            uriEntity, UpdateType.PATCH, factory.newEntity(new FullQualifiedName("olingo.Order"))),
         HttpStatusCode.PRECONDITION_REQUIRED);
   }
 
   @Test
   public void updateWithWrongIfMatch() throws Exception {
     ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
-        uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order")));
+        uriEntity, UpdateType.PATCH, factory.newEntity(new FullQualifiedName("olingo.Order")));
     request.setIfMatch("W/\"1\"");
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
@@ -174,7 +183,7 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
     final ODataDeleteResponse response = deleteRequest.execute();
 
     ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
-        uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order")));
+        uriEntity, UpdateType.PATCH, factory.newEntity(new FullQualifiedName("olingo.Order")));
     request.setIfMatch(eTag);
     // This request has to be in the same session as the first in order to access the same data provider.
     request.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
@@ -185,22 +194,28 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
   public void readPropertyNotModified() throws Exception {
     ODataPropertyRequest<ClientProperty> request = client.getRetrieveRequestFactory().getPropertyRequest(uriProperty);
     request.setIfNoneMatch("W/\"0\"");
-    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), request.execute().getStatusCode());
+    setCookieHeader(request);
+    final ODataRetrieveResponse<ClientProperty> response = request.execute();
+    saveCookieHeader(response);
+    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
   }
 
   @Test
   public void readPropertyValueNotModified() throws Exception {
     ODataValueRequest request = client.getRetrieveRequestFactory().getPropertyValueRequest(uriPropertyValue);
     request.setIfNoneMatch("W/\"0\"");
-    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), request.execute().getStatusCode());
+    setCookieHeader(request);
+    final ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
+    saveCookieHeader(response);
+    assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
   }
 
   @Test
   public void updatePropertyWithoutIfMatch() throws Exception {
     final ODataPropertyUpdateRequest request = client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(
         uriProperty,
-        client.getObjectFactory().newPrimitiveProperty("PropertyDuration",
-            client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S")));
+        factory.newPrimitiveProperty("PropertyDuration",
+            factory.newPrimitiveValueBuilder().buildString("PT42S")));
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
   }
 
@@ -208,8 +223,8 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
   public void updatePropertyWithWrongIfMatch() throws Exception {
     ODataPropertyUpdateRequest request = client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(
         uriProperty,
-        client.getObjectFactory().newPrimitiveProperty("PropertyDuration",
-            client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S")));
+        factory.newPrimitiveProperty("PropertyDuration",
+            factory.newPrimitiveValueBuilder().buildString("PT42S")));
     request.setIfMatch("W/\"1\"");
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
@@ -219,7 +234,7 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
     final ODataValueUpdateRequest request = client.getCUDRequestFactory().getValueUpdateRequest(
         uriPropertyValue,
         UpdateType.REPLACE,
-        client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S"));
+        factory.newPrimitiveValueBuilder().buildString("PT42S"));
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
   }
 
@@ -228,7 +243,7 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
     ODataValueUpdateRequest request = client.getCUDRequestFactory().getValueUpdateRequest(
         uriPropertyValue,
         UpdateType.REPLACE,
-        client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S"));
+        factory.newPrimitiveValueBuilder().buildString("PT42S"));
     request.setIfMatch("W/\"1\"");
     executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
   }
@@ -278,11 +293,4 @@ public class ConditionalITCase extends AbstractBaseTestITCase {
       assertThat(e.getODataError().getMessage(), anyOf(containsString("condition"), containsString("match")));
     }
   }
-
-  @Override
-  protected ODataClient getClient() {
-    ODataClient odata = ODataClientFactory.getClient();
-    odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
-    return odata;
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
index 56cd373..6098784 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
@@ -29,8 +29,6 @@ import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
 import org.apache.olingo.client.api.communication.request.cud.UpdateType;
@@ -45,17 +43,12 @@ import org.apache.olingo.client.api.domain.ClientEntitySet;
 import org.apache.olingo.client.api.domain.ClientInlineEntity;
 import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
 import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
-import org.apache.olingo.fit.tecsvc.TecSvcConst;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -72,10 +65,8 @@ import org.junit.Test;
  * For above reason, the DeepInsertXMLITCase case re-written slightly differently.  
  *
  */
-public class DeepInsertITCase extends AbstractBaseTestITCase {
+public class DeepInsertITCase extends AbstractTecSvcITCase {
 
-  private static final String SERVICE_URI = TecSvcConst.BASE_URI;
-  private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
   private static final String ES_KEY_NAV = "ESKeyNav";
   private static final String ES_TWO_KEY_NAV = "ESTwoKeyNav";
   private static final String ET_KEY_NAV_NAME = "ETKeyNav";
@@ -102,51 +93,52 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   private static final String EDM_STRING = "Edm.String";
 
   @Test
-  public void testDeepInsertExpandedResponse() {
-    final ODataClient client = getClient(SERVICE_URI);
-    client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+  public void deepInsertExpandedResponse() {
     final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
-    final ClientObjectFactory of = client.getObjectFactory();
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
 
     // Root entity
     entity.getProperties().add(
-        of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("String Property level 0")));
+        factory.newPrimitiveProperty(PROPERTY_STRING,
+            factory.newPrimitiveValueBuilder().buildString("String Property level 0")));
     entity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 41)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 0, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 41)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 0, complex level 1")))));
 
     // First level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav
-    final ClientEntity firstLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity firstLevelTwoKeyNav = factory.newEntity(ET_TWO_KEY_NAV);
     firstLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 1, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 42)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 1, complex level 1")))));
     firstLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     firstLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
     final ClientInlineEntity firstLevelTwoKeyOneInline =
-        of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, firstLevelTwoKeyNav);
+        factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, firstLevelTwoKeyNav);
     entity.addLink(firstLevelTwoKeyOneInline);
 
     // Second level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav
-    final ClientEntity secondLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity secondLevelTwoKeyNav = factory.newEntity(ET_TWO_KEY_NAV);
     secondLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 421)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 2, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 421)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 2, complex level 1")))));
     secondLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     secondLevelTwoKeyNav.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
 
     // Binding links
-    secondLevelTwoKeyNav.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, client.newURIBuilder(
+    secondLevelTwoKeyNav.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, client.newURIBuilder(
         SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(new LinkedHashMap<String, Object>() {
           private static final long serialVersionUID = 3109256773218160485L;
           {
@@ -156,57 +148,60 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
         }).build()));
 
     final ClientInlineEntity secondLevelTwoKeyOneInline =
-        of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, secondLevelTwoKeyNav);
+        factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, secondLevelTwoKeyNav);
     firstLevelTwoKeyNav.addLink(secondLevelTwoKeyOneInline);
 
     // Third level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav
-    final ClientEntity thirdLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity thirdLevelTwoKeyNavMany1 = factory.newEntity(ET_TWO_KEY_NAV);
     thirdLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 3, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 431)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 3, complex level 1")))));
     thirdLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     thirdLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
 
-    final ClientEntity thirdLevelTwoKeyNavMany2 = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity thirdLevelTwoKeyNavMany2 = factory.newEntity(ET_TWO_KEY_NAV);
     thirdLevelTwoKeyNavMany2.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 3, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 432)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 3, complex level 1")))));
     thirdLevelTwoKeyNavMany2.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     thirdLevelTwoKeyNavMany2.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
 
-    final ClientEntitySet entitySetThirdLevelTwoKeyNavMany = of.newEntitySet();
+    final ClientEntitySet entitySetThirdLevelTwoKeyNavMany = factory.newEntitySet();
     entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany1);
     entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany2);
-    secondLevelTwoKeyNav.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
+    secondLevelTwoKeyNav.addLink(factory.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
         entitySetThirdLevelTwoKeyNavMany));
 
     // First level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav
-    final ClientEntity firstLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity firstLevelTwoKeyNavMany1 = factory.newEntity(ET_TWO_KEY_NAV);
     firstLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 422)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
-                "String Property level 1, complex level 1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 422)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("String Property level 1, complex level 1")))));
     firstLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     firstLevelTwoKeyNavMany1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
 
-    final ClientEntitySet entitySetfirstLevelTwoKeyNavMany = of.newEntitySet();
+    final ClientEntitySet entitySetfirstLevelTwoKeyNavMany = factory.newEntitySet();
     entitySetfirstLevelTwoKeyNavMany.getEntities().add(firstLevelTwoKeyNavMany1);
-    entity.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
+    entity.addLink(factory.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
         entitySetfirstLevelTwoKeyNavMany));
 
     final ODataEntityCreateResponse<ClientEntity> createResponse =
-        client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
+        edmEnabledClient.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
 
     // Check response
     final ClientEntity resultEntityFirstLevel =
@@ -250,93 +245,99 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testSimpleDeepInsert() throws EdmPrimitiveTypeException {
-    final ODataClient client = getClient();
+  public void simpleDeepInsert() throws Exception {
     final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
-    final ClientObjectFactory of = client.getObjectFactory();
-    final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
 
     // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)));
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 42)))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
-        .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))
+        .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
 
     // Non collection navigation property
     // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne)
-    final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntitySingle = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntitySingle.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 43)));
     inlineEntitySingle.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("43")));
     inlineEntitySingle.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 430)))));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 430)))));
     inlineEntitySingle.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 431)))));
     inlineEntitySingle.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("432")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 432)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("432")))));
 
     // Collection navigation property
     // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne"
     // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany
-    final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntityCol1 = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntityCol1.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 44)));
     inlineEntityCol1.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("44")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("44")));
     inlineEntityCol1.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 441)))));
     inlineEntityCol1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-          .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 440)))));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)
+          .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+              factory.newPrimitiveValueBuilder().buildInt16((short) 440)))));
     inlineEntityCol1.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 442)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("442")))));
 
-    final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntityCol2 = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntityCol2.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 45)));
     inlineEntityCol2.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("45")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("45")));
     inlineEntityCol2.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 451)))));
     inlineEntityCol2.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-          .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 450)))));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)
+          .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+              factory.newPrimitiveValueBuilder().buildInt16((short) 450)))));
     inlineEntityCol2.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 452)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("452")))));
 
     final ClientInlineEntity newDeepInsertEntityLink =
-        of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
-    final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet();
+        factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
+    final ClientEntitySet newDeepInsertEntitySet = factory.newEntitySet();
     newDeepInsertEntitySet.getEntities().add(inlineEntityCol1);
     newDeepInsertEntitySet.getEntities().add(inlineEntityCol2);
     final ClientInlineEntitySet newDeepInsertEntitySetLink =
-        of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
+        factory.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
 
     entity.addLink(newDeepInsertEntityLink);
     entity.addLink(newDeepInsertEntitySetLink);
@@ -445,33 +446,34 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testDeepInsertSameEntitySet() throws EdmPrimitiveTypeException {
-    final ODataClient client = getClient();
+  public void deepInsertSameEntitySet() throws EdmPrimitiveTypeException {
     final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
-    final ClientObjectFactory of = client.getObjectFactory();
-    final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
 
     // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)));
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
-        .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
-    entity.addLink(of.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
+    .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))
+        .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+    entity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
         client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_TWO_KEY_NAV)
         .appendKeySegment(new LinkedHashMap<String, Object>() {
@@ -485,29 +487,30 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
         .build()));
 
     // Prepare inline entity(EntitySet: ESKeyNav, Type: ETKeyNav)
-    final ClientEntity innerEntity = of.newEntity(ET_KEY_NAV);
+    final ClientEntity innerEntity = factory.newEntity(ET_KEY_NAV);
     innerEntity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 43)));
     innerEntity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("43")));
     innerEntity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 431)))));
     innerEntity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("431")))));
     innerEntity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 431)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("431")))));
     innerEntity
     .getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))
-        .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder()
+    .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("431")))
+        .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder()
                 .buildInt16((short) 431)))))));
-    innerEntity.addLink(of.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
+    innerEntity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
         client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_TWO_KEY_NAV)
         .appendKeySegment(new LinkedHashMap<String, Object>() {
@@ -520,7 +523,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
         })
         .build()));
 
-    ClientInlineEntity inlineEntity = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
+    ClientInlineEntity inlineEntity = factory.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
     entity.addLink(inlineEntity);
 
     final ODataEntityCreateResponse<ClientEntity> responseCreate =
@@ -560,22 +563,20 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testConsistency() throws EdmPrimitiveTypeException {
-    final EdmEnabledODataClient client = getClient(SERVICE_URI);
-    final ClientObjectFactory of = client.getObjectFactory();
+  public void consistency() throws EdmPrimitiveTypeException {
     final String cookie = getCookie();
 
     // Do not set PropertyString(Nullable=false)
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
     entity.getProperties().add(
-        of.newCollectionProperty(COL_PROPERTY_STRING,
-            of.newCollectionValue(EDM_STRING).add(
-                of.newPrimitiveValueBuilder().buildString("Test"))));
+        factory.newCollectionProperty(COL_PROPERTY_STRING,
+            factory.newCollectionValue(EDM_STRING).add(
+                factory.newPrimitiveValueBuilder().buildString("Test"))));
 
     final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
 
     try {
-      ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+      ODataEntityCreateRequest<ClientEntity> request = edmEnabledClient.getCUDRequestFactory()
           .getEntityCreateRequest(targetURI, entity);
       request.addCustomHeader(HttpHeader.COOKIE, cookie);
       request.execute();
@@ -589,20 +590,20 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testInvalidType() throws EdmPrimitiveTypeException {
-    final EdmEnabledODataClient client = getClient(SERVICE_URI);
-    final ClientObjectFactory of = client.getObjectFactory();
+  public void invalidType() throws EdmPrimitiveTypeException {
     final String cookie = getCookie();
 
-    final ClientEntity entity = of.newEntity(ET_KEY_NAV);
-    entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildInt32(1)));
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
+    entity.getProperties().add(factory.newPrimitiveProperty(PROPERTY_STRING,
+        factory.newPrimitiveValueBuilder().buildInt32(1)));
     final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
 
     try {
-      ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+      ODataEntityCreateRequest<ClientEntity> request = edmEnabledClient.getCUDRequestFactory()
           .getEntityCreateRequest(targetURI, entity);
       request.addCustomHeader(HttpHeader.COOKIE, cookie);
       request.execute();
+      fail("Expecting bad request");
     } catch (ODataClientErrorException e) {
       assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
     }
@@ -610,15 +611,16 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
     validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3);
 
     entity.getProperties().add(
-        of.newCollectionProperty(PROPERTY_STRING,
-            of.newCollectionValue(EDM_STRING).add(
-                of.newPrimitiveValueBuilder().buildString("Test"))));
+        factory.newCollectionProperty(PROPERTY_STRING,
+            factory.newCollectionValue(EDM_STRING).add(
+                factory.newPrimitiveValueBuilder().buildString("Test"))));
 
     try {
-      ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+      ODataEntityCreateRequest<ClientEntity> request = edmEnabledClient.getCUDRequestFactory()
           .getEntityCreateRequest(targetURI, entity);
       request.addCustomHeader(HttpHeader.COOKIE, cookie);
       request.execute();
+      fail("Expecting bad request");
     } catch (ODataClientErrorException e) {
       assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
     }
@@ -628,40 +630,41 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
 
   @Test
   @Ignore
-  public void testDeepInsertOnNavigationPropertyInComplexProperty() {
-    final EdmEnabledODataClient client = getClient(SERVICE_URI);
-    final ClientObjectFactory of = client.getObjectFactory();
-
-    final ClientEntity inlineEntity = of.newEntity(ET_TWO_KEY_NAV);
+  public void deepInsertOnNavigationPropertyInComplexProperty() {
+    final ClientEntity inlineEntity = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     inlineEntity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
     inlineEntity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1")))));
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 1)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("1")))));
 
-    final ClientEntity entity = of.newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_TWO_KEY_NAV);
     entity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)));
     entity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+        factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
     entity.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 2)))
-            .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("2")))));
-
-    final ClientLink link = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntity);
-    final ClientComplexValue complexValueCreate = of.newComplexValue(CT_NAV_FIVE_PROP);
+        factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 2)))
+            .add(factory.newPrimitiveProperty(PROPERTY_STRING,
+                factory.newPrimitiveValueBuilder().buildString("2")))));
+
+    final ClientLink link = factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntity);
+    final ClientComplexValue complexValueCreate = factory.newComplexValue(CT_NAV_FIVE_PROP);
     complexValueCreate.getNavigationLinks().add(link);
 
     entity.getProperties().add(
-        of.newCollectionProperty(COL_PROPERTY_COMP_NAV, of.newCollectionValue(CT_NAV_FIVE_PROP)
+        factory.newCollectionProperty(COL_PROPERTY_COMP_NAV, factory.newCollectionValue(CT_NAV_FIVE_PROP)
             .add(complexValueCreate)));
 
     final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).build();
-    final ODataEntityCreateResponse<ClientEntity> response = client.getCUDRequestFactory()
+    final ODataEntityCreateResponse<ClientEntity> response = edmEnabledClient.getCUDRequestFactory()
         .getEntityCreateRequest(targetURI, entity)
         .execute();
 
@@ -683,95 +686,102 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  public void testDeepUpsert() {
-    final ODataClient client = getClient();
+  public void deepUpsert() {
     final URI updateURI = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_KEY_NAV)
         .appendKeySegment(815)
         .build();
-    final ClientObjectFactory of = client.getObjectFactory();
-    final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+    final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
 
     // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)));
     entity.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 42)))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM, factory.newComplexValue(CT_ALL_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 42)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))));
     entity.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
-        .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("42")))
+        .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_NAV_FIVE_PROP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
 
     // Non collection navigation property
     // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne)
-    final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntitySingle = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntitySingle.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 43)));
     inlineEntitySingle.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
-    inlineEntitySingle.getProperties().add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)))));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("43")));
+    inlineEntitySingle.getProperties().add(factory.newComplexProperty(PROPERTY_COMP,
+        factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 43)))));
     inlineEntitySingle.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 431)))));
     inlineEntitySingle.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("432")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 432)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("432")))));
 
     // Collection navigation property
     // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne"
     // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany
-    final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntityCol1 = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntityCol1.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 44)));
     inlineEntityCol1.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("44")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("44")));
     inlineEntityCol1.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 441)))));
     inlineEntityCol1.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 441)))));
     inlineEntityCol1.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 442)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("442")))));
 
-    final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+    final ClientEntity inlineEntityCol2 = factory.newEntity(ET_TWO_KEY_NAV);
     inlineEntityCol2.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45)));
+    .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 45)));
     inlineEntityCol2.getProperties()
-    .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("45")));
+    .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("45")));
     inlineEntityCol2.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_NAV, factory.newComplexValue(CT_PRIM_COMP)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+            factory.newPrimitiveValueBuilder().buildInt16((short) 451)))));
     inlineEntityCol2.getProperties().add(
-        of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
-            .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+        factory.newComplexProperty(PROPERTY_COMP, factory.newComplexValue(CT_PRIM_COMP)
+            .add(factory.newPrimitiveProperty(PROPERTY_INT16,
+                factory.newPrimitiveValueBuilder().buildInt16((short) 451)))));
     inlineEntityCol2.getProperties()
-    .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
-        .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
-        .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452")))));
+    .add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue(CT_TWO_PRIM)
+        .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16((short) 452)))
+        .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("452")))));
 
     final ClientInlineEntity newDeepInsertEntityLink =
-        of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
-    final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet();
+        factory.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
+    final ClientEntitySet newDeepInsertEntitySet = factory.newEntitySet();
     newDeepInsertEntitySet.getEntities().add(inlineEntityCol1);
     newDeepInsertEntitySet.getEntities().add(inlineEntityCol2);
     final ClientInlineEntitySet newDeepInsertEntitySetLink =
-        of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
+        factory.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
 
     entity.addLink(newDeepInsertEntityLink);
     entity.addLink(newDeepInsertEntitySetLink);
@@ -881,8 +891,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   private String getCookie() {
-    final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
-    final ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
+    final ODataRetrieveResponse<ClientEntitySet> response = edmEnabledClient.getRetrieveRequestFactory()
         .getEntitySetRequest(client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build())
         .execute();
 
@@ -890,8 +899,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
   }
 
   private void validateSet(final URI uri, final String cookie, final short... keys) throws EdmPrimitiveTypeException {
-    final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
-    final ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory()
+    final ODataEntitySetRequest<ClientEntitySet> request = edmEnabledClient.getRetrieveRequestFactory()
         .getEntitySetRequest(uri);
     request.addCustomHeader(HttpHeader.COOKIE, cookie);
     final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
@@ -914,15 +922,4 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
       }
     }
   }
-
-  @Override
-  protected ODataClient getClient() {
-    ODataClient odata = ODataClientFactory.getClient();
-    odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
-    return odata;
-  }
-  
-  protected EdmEnabledODataClient getClient(String serviceURI) {
-    return ODataClientFactory.getEdmEnabledClient(serviceURI,ContentType.JSON);
-  }   
 }