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:58 UTC

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

[OLINGO-659] optimized integration tests

Change-Id: Ib1dfffa1a54bbdca343d4363faeb48e26b906e87

Signed-off-by: Michael Bolz <mi...@sap.com>


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

Branch: refs/heads/master
Commit: 12770861eff2be1435e9a9232ba037f4ef3044f6
Parents: e92f660
Author: Klaus Straubinger <kl...@sap.com>
Authored: Fri Sep 4 16:49:44 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Sep 7 08:05:37 2015 +0200

----------------------------------------------------------------------
 .../fit/tecsvc/client/AbstractTecSvcITCase.java |  91 ++++
 .../fit/tecsvc/client/ActionImportITCase.java   | 220 +++-----
 .../fit/tecsvc/client/AsyncSupportITCase.java   | 119 ++--
 .../BasicHttpExceptionHandlingITCase.java       |  56 --
 .../olingo/fit/tecsvc/client/BasicITCase.java   | 542 ++++++++-----------
 .../fit/tecsvc/client/BatchClientITCase.java    |  80 +--
 .../olingo/fit/tecsvc/client/BindingITCase.java | 169 +++---
 .../fit/tecsvc/client/ConditionalITCase.java    |  64 ++-
 .../fit/tecsvc/client/DeepInsertITCase.java     | 499 +++++++++--------
 .../fit/tecsvc/client/DeepInsertXmlITCase.java  |  44 +-
 .../tecsvc/client/EntityReferencesITCase.java   | 257 ++++-----
 .../fit/tecsvc/client/ExpandSelectITCase.java   |  70 +--
 .../ExpandWithSystemQueryOptionsITCase.java     | 142 ++---
 .../tecsvc/client/FilterSystemQueryITCase.java  | 204 +++----
 .../fit/tecsvc/client/FunctionImportITCase.java | 160 +++---
 .../olingo/fit/tecsvc/client/MediaITCase.java   |  25 +-
 .../fit/tecsvc/client/NavigationITCase.java     |  85 ++-
 .../tecsvc/client/OrderBySystemQueryITCase.java |  45 +-
 .../tecsvc/client/PrimitiveComplexITCase.java   | 165 +++---
 .../tecsvc/client/SystemQueryOptionITCase.java  | 287 +++++-----
 .../http/BasicHttpExceptionHandlingITCase.java  |  56 ++
 21 files changed, 1518 insertions(+), 1862 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AbstractTecSvcITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AbstractTecSvcITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AbstractTecSvcITCase.java
new file mode 100644
index 0000000..2fe82f9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AbstractTecSvcITCase.java
@@ -0,0 +1,91 @@
+/*
+ * 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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.ODataRequest;
+import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.apache.olingo.fit.tecsvc.TecSvcConst;
+
+public abstract class AbstractTecSvcITCase extends AbstractBaseTestITCase {
+
+  protected static final String SERVICE_URI = TecSvcConst.BASE_URI + '/';
+  protected static final String SERVICE_NAMESPACE = "olingo.odata.test1";
+
+  protected final ODataClient client = getClient();
+  protected final EdmEnabledODataClient edmEnabledClient = getClient(SERVICE_URI);
+  protected final ClientObjectFactory factory = client.getObjectFactory();
+
+  // Read-only tests can re-use the server session via the session cookie.
+  // JUnit constructs a fresh instance for each test method, so we have to
+  // use static storage; a thread-local variable seems safer as a simple static one. 
+  private static ThreadLocal<String> cookieHeader = new ThreadLocal<String>();
+
+  protected void saveCookieHeader(final ODataResponse response) {
+    if (cookieHeader.get() == null) {
+      final Collection<String> header = response.getHeader(HttpHeader.SET_COOKIE);
+      if (header != null && !header.isEmpty()) {
+        cookieHeader.set(header.iterator().next());
+      }
+    }
+  }
+
+  protected void setCookieHeader(ODataRequest request) {
+    if (cookieHeader.get() != null) {
+      request.addCustomHeader(HttpHeader.COOKIE, cookieHeader.get());
+    }
+  }
+
+  protected void assertShortOrInt(final int value, final Object n) {
+    assertTrue(n instanceof Number);
+    assertEquals(value, ((Number) n).intValue());
+  }
+
+  protected void assertContentType(final String content) {
+    assertThat(content, containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+  }
+
+  protected boolean isJson() {
+    return getClient().getConfiguration().getDefaultPubFormat().equals(ContentType.JSON);
+  }
+
+  @Override
+  protected ODataClient getClient() {
+    ODataClient odata = ODataClientFactory.getClient();
+    odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+    return odata;
+  }
+
+  protected EdmEnabledODataClient getClient(final String serviceRoot) {
+    return ODataClientFactory.getEdmEnabledClient(serviceRoot, ContentType.JSON);
+  } 
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
index 1aada74..4906960 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
@@ -31,7 +31,6 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.TimeZone;
 
-import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
 import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
@@ -39,60 +38,39 @@ import org.apache.olingo.client.api.domain.ClientCollectionValue;
 import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
+import org.apache.olingo.client.api.domain.ClientInvokeResult;
 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.EdmPrimitiveTypeKind;
-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 ActionImportITCase extends AbstractBaseTestITCase {
+public class ActionImportITCase extends AbstractTecSvcITCase {
 
   @Test
   public void noReturnTypeAction() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRT").build();
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
+    final ODataInvokeResponse<ClientProperty> response = callAction("AIRT", ClientProperty.class, null, false);
     assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
   }
 
   @Test
   public void primitiveAction() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTString").build();
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
+    final ODataInvokeResponse<ClientProperty> response = callAction("AIRTString", ClientProperty.class, null, false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     assertEquals("UARTString string value", response.getBody().getPrimitiveValue().toValue());
   }
 
   @Test
   public void primitiveActionMinimalResponse() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTString").build();
-    ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
-        .getActionInvokeRequest(actionURI, ClientProperty.class);
-    request.setPrefer(getClient().newPreferences().returnMinimal());
-    final ODataInvokeResponse<ClientProperty> response = request.execute();
-    assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
-    assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+    callAction("AIRTString", ClientProperty.class, null, true);
   }
 
   @Test
   public void primitiveActionInvalidParameters() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTString").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("Invalid",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1));
     try {
-      getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-          .execute();
+      callAction("AIRTString", ClientProperty.class, buildParameterInt16(42), false);
       fail("Expected an ODataClientErrorException");
     } catch (ODataClientErrorException e) {
       assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
@@ -101,15 +79,12 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void primitiveCollectionAction() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollStringTwoParam").build();
     Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
-    parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
-    parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder()
+    parameters.put("ParameterInt16", factory.newPrimitiveValueBuilder().buildInt16((short) 3));
+    parameters.put("ParameterDuration", factory.newPrimitiveValueBuilder()
         .setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollStringTwoParam", ClientProperty.class, parameters, false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue();
     assertEquals(3, valueArray.size());
@@ -121,13 +96,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void complexAction() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCTTwoPrimParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCTTwoPrimParam", ClientProperty.class, buildParameterInt16(3), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientComplexValue complexValue = response.getBody().getComplexValue();
     ClientProperty propInt16 = complexValue.get("PropertyInt16");
@@ -140,13 +110,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void complexCollectionActionNoContent() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollCTTwoPrimParam", ClientProperty.class, buildParameterInt16(0), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
     assertEquals(0, complexValueCollection.size());
@@ -154,13 +119,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void complexCollectionActionSubContent() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1));
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollCTTwoPrimParam", ClientProperty.class, buildParameterInt16(1), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
     assertEquals(1, complexValueCollection.size());
@@ -173,13 +133,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void complexCollectionActionAllContent() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
-    ODataInvokeResponse<ClientProperty> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollCTTwoPrimParam", ClientProperty.class, buildParameterInt16(3), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
     assertEquals(3, complexValueCollection.size());
@@ -200,13 +155,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityActionETTwoKeyTwoPrim() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365));
-    ODataInvokeResponse<ClientEntity> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntity> response =
+        callAction("AIRTETTwoKeyTwoPrimParam", ClientEntity.class, buildParameterInt16(-365), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntity entity = response.getBody();
     ClientProperty propInt16 = entity.getProperty("PropertyInt16");
@@ -219,13 +169,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityCollectionActionETKeyNav() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollETKeyNavParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
-    ODataInvokeResponse<ClientEntitySet> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntitySet> response =
+        callAction("AIRTCollETKeyNavParam", ClientEntitySet.class, buildParameterInt16(3), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntitySet entitySet = response.getBody();
     assertEquals(3, entitySet.getEntities().size());
@@ -238,13 +183,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityCollectionActionETKeyNavEmptyCollection() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollETKeyNavParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
-    ODataInvokeResponse<ClientEntitySet> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntitySet> response =
+        callAction("AIRTCollETKeyNavParam", ClientEntitySet.class, buildParameterInt16(0), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntitySet entitySet = response.getBody();
     assertEquals(0, entitySet.getEntities().size());
@@ -252,13 +192,8 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityCollectionActionETKeyNavNegativeParam() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollETKeyNavParam").build();
-    Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10));
-    ODataInvokeResponse<ClientEntitySet> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntitySet> response =
+        callAction("AIRTCollETKeyNavParam", ClientEntitySet.class, buildParameterInt16(-10), false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntitySet entitySet = response.getBody();
     assertEquals(0, entitySet.getEntities().size());
@@ -266,8 +201,6 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityCollectionActionETAllPrim() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTCollESAllPrimParam").build();
     Calendar time = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
     time.clear();
     time.set(Calendar.HOUR_OF_DAY, 3);
@@ -275,11 +208,10 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
     time.set(Calendar.SECOND, 0);
     Map<String, ClientValue> parameters = Collections.singletonMap(
         "ParameterTimeOfDay",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
+        (ClientValue) factory.newPrimitiveValueBuilder()
             .setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
-    ODataInvokeResponse<ClientEntitySet> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntitySet> response =
+        callAction("AIRTCollESAllPrimParam", ClientEntitySet.class, parameters, false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntitySet entitySet = response.getBody();
     assertEquals(3, entitySet.getEntities().size());
@@ -292,72 +224,56 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void entityActionETAllPrim() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTESAllPrimParam").build();
     Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
     dateTime.clear();
     dateTime.set(1012, 2, 0, 0, 0, 0);
-    Map<String, ClientValue> parameters = Collections.singletonMap(
+    final Map<String, ClientValue> parameters = Collections.singletonMap(
         "ParameterDate",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
+        (ClientValue) factory.newPrimitiveValueBuilder()
             .setType(EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
-    ODataInvokeResponse<ClientEntity> response =
-        getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
-            .execute();
+    final ODataInvokeResponse<ClientEntity> response =
+        callAction("AIRTESAllPrimParam", ClientEntity.class, parameters, false);
     assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
     assertEquals(TecSvcConst.BASE_URI + "/ESAllPrim(1)", response.getHeader(HttpHeader.LOCATION).iterator().next());
   }
 
   @Test
   public void entityActionETAllPrimNoContent() throws Exception {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-        .appendActionCallSegment("AIRTESAllPrimParam").build();
-    final Map<String, ClientValue> parameters = Collections.singletonMap(
-        "ParameterDate",
-        (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("2000-02-29"));
-    ODataInvokeRequest<ClientEntity> request = getClient().getInvokeRequestFactory()
-        .getActionInvokeRequest(actionURI, ClientEntity.class, parameters);
-    request.setPrefer(getClient().newPreferences().returnMinimal());
-    final ODataInvokeResponse<ClientEntity> response = request.execute();
-    assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
-    assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+    final ODataInvokeResponse<ClientEntity> response =
+        callAction("AIRTESAllPrimParam", ClientEntity.class,
+            Collections.singletonMap("ParameterDate",
+                (ClientValue) factory.newPrimitiveValueBuilder().buildString("2000-02-29")),
+            true);
     final String location = TecSvcConst.BASE_URI + "/ESAllPrim(1)";
     assertEquals(location, response.getHeader(HttpHeader.LOCATION).iterator().next());
     assertEquals(location, response.getHeader(HttpHeader.ODATA_ENTITY_ID).iterator().next());
   }
-  
+
   @Test
-  public void airtCollStringTwoParanNotNull() {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-                                     .appendActionCallSegment("AIRTCollStringTwoParam").build();
-    final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
-    final ClientObjectFactory of = getClient().getObjectFactory();
-    parameters.put("ParameterInt16", of.newPrimitiveValueBuilder().buildInt16((short) 2));
-    parameters.put("ParameterDuration", of.newPrimitiveValueBuilder().buildDuration(BigDecimal.valueOf(1)));
-    final ODataInvokeResponse<ClientProperty> response = getClient()
-        .getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters).execute();
-    
+  public void airtCollStringTwoParamNotNull() {
+    Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
+    parameters.put("ParameterInt16", factory.newPrimitiveValueBuilder().buildInt16((short) 2));
+    parameters.put("ParameterDuration", factory.newPrimitiveValueBuilder().buildDuration(BigDecimal.valueOf(1)));
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollStringTwoParam", ClientProperty.class, parameters, false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+
     ClientCollectionValue<ClientValue> collectionValue = response.getBody().getCollectionValue().asCollection();
     assertEquals(2, collectionValue.size());
     final Iterator<ClientValue> iter = collectionValue.iterator();
-    
     assertEquals("UARTCollStringTwoParam duration value: PT1S", iter.next().asPrimitive().toValue());
     assertEquals("UARTCollStringTwoParam duration value: PT2S", iter.next().asPrimitive().toValue());
   }
-  
+
   @Test
-  public void airtCollStringTwoParanNull() {
-    final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
-                                     .appendActionCallSegment("AIRTCollStringTwoParam").build();
-    final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
-    final ClientObjectFactory of = getClient().getObjectFactory();
-    parameters.put("ParameterInt16", of.newPrimitiveValueBuilder().buildInt16((short) 2));
-    parameters.put("ParameterDuration", of.newPrimitiveValueBuilder().buildDuration(null));
-    final ODataInvokeResponse<ClientProperty> response = getClient()
-        .getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters).execute();
-    
+  public void airtCollStringTwoParamNull() {
+    Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
+    parameters.put("ParameterInt16", factory.newPrimitiveValueBuilder().buildInt16((short) 2));
+    parameters.put("ParameterDuration", factory.newPrimitiveValueBuilder().buildDuration(null));
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTCollStringTwoParam", ClientProperty.class, parameters, false);
     assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+
     ClientCollectionValue<ClientValue> collectionValue = response.getBody().getCollectionValue().asCollection();
     assertEquals(2, collectionValue.size());
     final Iterator<ClientValue> iter = collectionValue.iterator();
@@ -365,12 +281,28 @@ public class ActionImportITCase extends AbstractBaseTestITCase {
     assertEquals("UARTCollStringTwoParam int16 value: 2", iter.next().asPrimitive().toValue());
     assertEquals("UARTCollStringTwoParam duration value: null", iter.next().asPrimitive().toValue());
   }
-  
-  @Override
-  protected ODataClient getClient() {
-    ODataClient odata = ODataClientFactory.getClient();
-    odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
-    return odata;
+
+  private Map<String, ClientValue> buildParameterInt16(final int value) {
+    return Collections.singletonMap("ParameterInt16",
+        (ClientValue) factory.newPrimitiveValueBuilder().buildInt16((short) value));
   }
 
+  private <T extends ClientInvokeResult> ODataInvokeResponse<T> callAction(final String name,
+      final Class<T> resultRef, final Map<String, ClientValue> parameters, final boolean returnMinimal) {
+    final URI actionURI = client.newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment(name).build();
+    ODataInvokeRequest<T> request = client.getInvokeRequestFactory()
+        .getActionInvokeRequest(actionURI, resultRef, parameters);
+    if (returnMinimal) {
+      request.setPrefer(client.newPreferences().returnMinimal());
+    }
+    // We can re-use the session since our actions don't (yet?!) modify existing data.
+    setCookieHeader(request);
+    final ODataInvokeResponse<T> response = request.execute();
+    saveCookieHeader(response);
+    if (returnMinimal) {
+      assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+      assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+    }
+    return response;
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/12770861/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
index 4736df6..61c1c62 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
@@ -18,6 +18,17 @@
  */
 package org.apache.olingo.fit.tecsvc.client;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.ODataClientErrorException;
 import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
@@ -33,67 +44,50 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.ODataClientFactory;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntityCollection;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.PreferenceName;
 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.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
+public final class AsyncSupportITCase extends AbstractTecSvcITCase {
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public final class AsyncSupportITCase extends AbstractBaseTestITCase {
   private static final String ES_ALL_PRIM = "ESAllPrim";
   private static final String NAV_PROPERTY_ET_TWO_PRIM_ONE = "NavPropertyETTwoPrimOne";
-  private static final String SERVICE_URI = TecSvcConst.BASE_URI;
-  public static final int SLEEP_TIMEOUT_IN_MS = 100;
+  private static final String TEC_ASYNC_SLEEP = "tec.sleep";  // see TechnicalAsyncService
+  private static final int SLEEP_TIMEOUT_IN_MS = 100;
 
   @Test
   public void readEntity() throws Exception {
-    ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
         .appendKeySegment(32767).build();
 
-    //
-    final ODataRetrieveResponse<ClientEntity> response = getClient().getRetrieveRequestFactory()
+    final ODataRetrieveResponse<ClientEntity> response = client.getRetrieveRequestFactory()
         .getEntityRequest(uri).execute();
     assertEquals(32767, response.getBody().getProperty("PropertyInt16").getPrimitiveValue().toValue());
-    assertEquals(200, response.getStatusCode());
+    assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
 
     // first async request
 
-    ODataRequest re1 = getClient().getRetrieveRequestFactory()
+    ODataRequest re1 = client.getRetrieveRequestFactory()
             .getEntityRequest(uri)
-            .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+            .setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     AsyncResponseWrapper<ODataResponse> first = client.getAsyncRequestFactory().getAsyncRequestWrapper(re1).execute();
 
     assertTrue(first.isPreferenceApplied());
 
     // second async request
-    ODataRequest re2 = getClient().getRetrieveRequestFactory()
+    ODataRequest re2 = client.getRetrieveRequestFactory()
             .getEntityRequest(uri)
-            .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+            .setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     AsyncResponseWrapper<ODataResponse> second = client.getAsyncRequestFactory().getAsyncRequestWrapper(re2).execute();
     assertTrue(second.isPreferenceApplied());
 
@@ -105,8 +99,8 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
     assertNotNull(first.getODataResponse());
     ODataResponse firstResponse = first.getODataResponse();
-    assertEquals(200, firstResponse.getStatusCode());
-    ResWrap<Entity> entity = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+    assertEquals(HttpStatusCode.OK.getStatusCode(), firstResponse.getStatusCode());
+    ResWrap<Entity> entity = client.getDeserializer(ContentType.APPLICATION_JSON)
         .toEntity(firstResponse.getRawResponse());
     assertEquals(32767, entity.getPayload().getProperty("PropertyInt16").asPrimitive());
     assertEquals("First Resource - positive values", entity.getPayload().getProperty("PropertyString").asPrimitive());
@@ -114,31 +108,29 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void readEntitySet() throws Exception {
-    ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
         .build();
 
-    //
-    final ODataRetrieveResponse<ClientEntitySet> response = getClient().getRetrieveRequestFactory()
+    final ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
         .getEntitySetRequest(uri).execute();
-    assertEquals(200, response.getStatusCode());
+    assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
     ClientEntitySet responseBody = response.getBody();
     assertEquals(3, responseBody.getEntities().size());
     checkEntityAvailableWith(responseBody, "PropertyInt16", 32767);
 
     // first async request
-    ODataRequest re1 = getClient().getRetrieveRequestFactory()
+    ODataRequest re1 = client.getRetrieveRequestFactory()
         .getEntitySetRequest(uri)
-        .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+        .setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     AsyncResponseWrapper<ODataResponse> first = client.getAsyncRequestFactory().getAsyncRequestWrapper(re1).execute();
 
     assertTrue(first.isPreferenceApplied());
 
     // second async request
-    ODataRequest re2 = getClient().getRetrieveRequestFactory()
+    ODataRequest re2 = client.getRetrieveRequestFactory()
         .getEntitySetRequest(uri)
-        .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+        .setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     AsyncResponseWrapper<ODataResponse> second = client.getAsyncRequestFactory().getAsyncRequestWrapper(re2).execute();
     assertTrue(second.isPreferenceApplied());
 
@@ -150,10 +142,10 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
     assertNotNull(first.getODataResponse());
     ODataResponse firstResponse = first.getODataResponse();
-    assertEquals(200, firstResponse.getStatusCode());
+    assertEquals(HttpStatusCode.OK.getStatusCode(), firstResponse.getStatusCode());
     assertEquals(2, firstResponse.getHeaderNames().size());
-    assertEquals("4.0", firstResponse.getHeader("OData-Version").iterator().next());
-    ResWrap<EntityCollection> firWrap = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+    assertEquals("4.0", firstResponse.getHeader(HttpHeader.ODATA_VERSION).iterator().next());
+    ResWrap<EntityCollection> firWrap = client.getDeserializer(ContentType.APPLICATION_JSON)
         .toEntitySet(firstResponse.getRawResponse());
     EntityCollection firstResponseEntitySet = firWrap.getPayload();
     assertEquals(3, firstResponseEntitySet.getEntities().size());
@@ -164,12 +156,9 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
   @Test
   public void createEntity() throws Exception {
-    ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM).build();
 
-    //
-    final ClientObjectFactory factory = client.getObjectFactory();
     ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
     newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
         factory.newPrimitiveValueBuilder().buildInt32(42)));
@@ -181,7 +170,7 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
     final ODataEntityCreateRequest<ClientEntity> createRequest =
         client.getCUDRequestFactory().getEntityCreateRequest(uri, newEntity);
-    createRequest.addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+    createRequest.setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     assertNotNull(createRequest);
     AsyncResponseWrapper<ODataResponse> asyncResponse =
         client.getAsyncRequestFactory().getAsyncRequestWrapper(createRequest).execute();
@@ -196,7 +185,7 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
         (ODataEntityCreateResponse<ClientEntity>) asyncResponse.getODataResponse();
 
     assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
-    assertEquals(SERVICE_URI + "/ESAllPrim(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
+    assertEquals(SERVICE_URI + "ESAllPrim(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
     final ClientEntity createdEntity = createResponse.getBody();
     assertNotNull(createdEntity);
     final ClientProperty property1 = createdEntity.getProperty("PropertyInt64");
@@ -208,9 +197,8 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
   }
 
   @Test
-  @Ignore("mibo: Does currently not work as expected -> issue in ODataClient?")
+  @Ignore("Does currently not work as expected -> issue in ODataClient?")
   public void getBatchRequest() throws Exception {
-    ODataClient client = getClient();
     final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
 
 //    final BatchManager payload = request.payloadManager();
@@ -219,9 +207,7 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 //    ODataEntityRequest<ClientEntity> getRequest = appendGetRequest(client, payload, "ESAllPrim", 32767, false);
 //    payload.addRequest(getRequest);
 
-    //
-    request.addCustomHeader(HttpHeader.PREFER,
-        "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+    request.setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
     ODataBatchableRequest getRequest = appendGetRequest(client, "ESAllPrim", 32767, false);
     AsyncBatchRequestWrapper asyncRequest =
         client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request);
@@ -232,7 +218,6 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 //    ODataBatchResponse res = payload.getResponse();
 //
 //    while(!test.isDone()) {
-//      System.out.println("Wait...");
 //      TimeUnit.SECONDS.sleep(1);
 //    }
 
@@ -244,13 +229,13 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 //    assertEquals("Accepted", response.getStatusMessage());
 
     ODataResponse firstResponse = asyncResponse.getODataResponse();
-    assertEquals(200, firstResponse.getStatusCode());
+    assertEquals(HttpStatusCode.OK.getStatusCode(), firstResponse.getStatusCode());
     assertEquals(2, firstResponse.getHeaderNames().size());
-    assertEquals("4.0", firstResponse.getHeader("OData-Version").iterator().next());
+    assertEquals("4.0", firstResponse.getHeader(HttpHeader.ODATA_VERSION).iterator().next());
 
-    ResWrap<Entity> firWrap = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+    ResWrap<Entity> firstWrap = client.getDeserializer(ContentType.APPLICATION_JSON)
         .toEntity(firstResponse.getRawResponse());
-    Entity entity = firWrap.getPayload();
+    Entity entity = firstWrap.getPayload();
     assertEquals(32767, entity.getProperty("PropertyInt16").asPrimitive());
     assertEquals("First Resource - positive values", entity.getProperty("PropertyString").asPrimitive());
   }
@@ -261,14 +246,13 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
    */
   @Test
   public void deleteEntity() throws Exception {
-    ODataClient client = getClient();
     URI uri = client.newURIBuilder(SERVICE_URI)
         .appendEntitySetSegment(ES_ALL_PRIM)
         .appendKeySegment(32767).build();
 
     // asyncDeleteRequest async request
-    ODataRequest deleteRequest = getClient().getCUDRequestFactory().getDeleteRequest(uri)
-        .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=5");
+    ODataRequest deleteRequest = client.getCUDRequestFactory().getDeleteRequest(uri)
+        .setPrefer("respond-async; " + TEC_ASYNC_SLEEP + "=5");
     AsyncResponseWrapper<ODataResponse> asyncDeleteRequest =
         client.getAsyncRequestFactory().getAsyncRequestWrapper(deleteRequest).execute();
 
@@ -289,9 +273,8 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
     }
   }
 
-  private ODataEntityRequest<ClientEntity> appendGetRequest(final ODataClient client, final String segment,
-                                                            final Object key, final boolean isRelative)
-      throws URISyntaxException {
+  private ODataEntityRequest<ClientEntity> appendGetRequest(final ODataClient client,
+      final String segment, final Object key, final boolean isRelative) throws URISyntaxException {
 
     final URIBuilder targetURI = client.newURIBuilder(SERVICE_URI);
     targetURI.appendEntitySetSegment(segment).appendKeySegment(key);
@@ -303,10 +286,9 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
   }
 
   private void checkEntityAvailableWith(ClientEntitySet entitySet, String property, Object value) {
-    List<ClientEntity> entities = entitySet.getEntities();
-    for (ClientEntity entity : entities) {
+    for (ClientEntity entity : entitySet.getEntities()) {
       ClientProperty ep = entity.getProperty("PropertyInt16");
-      if(ep != null) {
+      if (ep != null) {
         assertEquals(value, ep.getPrimitiveValue().toValue());
         return;
       }
@@ -317,16 +299,9 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
 
   private void waitTillDone(AsyncResponseWrapper<?> async, int maxWaitInSeconds) throws InterruptedException {
     int waitCounter = maxWaitInSeconds * 1000;
-    while(!async.isDone() && waitCounter > 0) {
+    while (!async.isDone() && waitCounter > 0) {
       TimeUnit.MILLISECONDS.sleep(SLEEP_TIMEOUT_IN_MS);
       waitCounter -= SLEEP_TIMEOUT_IN_MS;
     }
   }
-
-  @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/BasicHttpExceptionHandlingITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java
deleted file mode 100644
index c0b1c69..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.tecsvc.client;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.apache.olingo.client.api.ODataClient;
-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 BasicHttpExceptionHandlingITCase extends AbstractBaseTestITCase {
-
-  private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/";
-
-  @Test
-  public void ambigiousXHTTPMethod() throws Exception {
-    URL url = new URL(SERVICE_URI + "?$format=json");
-
-    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-    connection.setRequestMethod("POST");
-    connection.setRequestProperty(HttpHeader.ACCEPT, "application/json");
-    connection.setRequestProperty(HttpHeader.X_HTTP_METHOD, "value");
-    connection.setRequestProperty(HttpHeader.X_HTTP_METHOD_OVERRIDE, "differentValue");
-    connection.connect();
-
-    assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), connection.getResponseCode());
-  }
-
-  @Override
-  protected ODataClient getClient() {
-    return null;
-  }
-
-}