You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/05/22 13:43:39 UTC

[31/51] [abbrv] [partial] Removing /ODataJClient: merge complete

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateMoreTestITCase.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateMoreTestITCase.java b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateMoreTestITCase.java
deleted file mode 100644
index 861da44..0000000
--- a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateMoreTestITCase.java
+++ /dev/null
@@ -1,760 +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 com.msopentech.odatajclient.engine.it;
-
-import static org.junit.Assert.*;
-
-import com.msopentech.odatajclient.engine.client.http.HttpClientException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.junit.Test;
-
-import com.msopentech.odatajclient.engine.communication.ODataClientErrorException;
-import com.msopentech.odatajclient.engine.communication.request.cud.ODataDeleteRequest;
-import com.msopentech.odatajclient.engine.communication.request.cud.ODataEntityCreateRequest;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntityRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataDeleteResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataEntityCreateResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataRetrieveResponse;
-import com.msopentech.odatajclient.engine.data.ODataCollectionValue;
-import com.msopentech.odatajclient.engine.data.ODataComplexValue;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataInlineEntity;
-import com.msopentech.odatajclient.engine.data.ODataInlineEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataLink;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.uri.URIBuilder;
-import com.msopentech.odatajclient.engine.utils.URIUtils;
-import org.junit.Ignore;
-
-public class EntityCreateMoreTestITCase extends AbstractTestITCase {
-
-    // test with json full metadata
-    @Test
-    public void withJSONFullMetadata() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 1063;
-        final ODataEntity original = getNewCustomer(id, "New Customer", false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // test with atom
-
-    @Test
-    public void withATOM() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final String contenttype = "application/atom+xml";
-        final String prefer = "return-no-content";
-        final int id = 1064;
-        final ODataEntity original = getNewCustomer(id, "New Customer", false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // gives null pointer exception when the content type and the accept type is json mo metadata 
-
-    @Test(expected = HttpClientException.class)
-    @Ignore // static server doesn't add any entity attribute type; type is expected.
-    public void withJSONNoMetadata() {
-        final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
-        final String contenttype = "application/json;odata=nometadata";
-        final String prefer = "return-content";
-        final int id = 15;
-        final ODataEntity original = getNewCustomer(id, "New Customer", false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // deep insert
-
-    @Test
-    public void createInlineWithATOM() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final String contentType = "application/atom+xml";
-        final String prefer = "return-content";
-        final int id = 5777;
-        final ODataEntity original = getNewCustomer(id, "New customer", true);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contentType, prefer);
-        final ODataEntity actual =
-                validateEntities(testStaticServiceRootURL, format, original, id, Collections.<String>singleton("Info"),
-                "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // deep insert
-
-    @Test
-    public void createInlineWithJSON() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 67;
-        final ODataEntity original = getNewCustomer(id, "New customer", true);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contentType, prefer);
-        final ODataEntity actual =
-                validateEntities(testStaticServiceRootURL, format, original, id, Collections.<String>singleton("Info"),
-                "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // with a string having special characters, html tags, numbers and characters
-
-    @Test
-    public void withSpecialString() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 11;
-        final ODataEntity original = getNewCustomer(id, "New 12,345//\\%^&*()<html>customer", false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // with atom content type and json accept type. its giving 400 error.
-
-    @Test
-    @Ignore
-    public void createWithATOMReturnJSON() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/atom+xml";
-        final String prefer = "return-content";
-        final int id = 146;
-        try {
-            final ODataEntity original = getNewCustomer(id, "New Customer", false);
-            createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-            final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                    "Customer");
-            delete(format, actual, false, testStaticServiceRootURL);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
-    // with json content type and atom accept type. its giving 400 error.
-
-    @Test
-    @Ignore
-    public void createWithJSONReturnATOM() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 155;
-        try {
-            final ODataEntity original = getNewCustomer(id, "New Customer", false);
-            createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-            final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                    "Customer");
-            delete(format, actual, false, testStaticServiceRootURL);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
-    // a long String in the Name field
-
-    @Test
-    public void withLongString() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 1112;
-        final ODataEntity original = getNewCustomer(id,
-                "Sampledskjfhsdkjfhsdkfhksdjhfksdhfvjhdfgkjhfdkjghdfkjghkfdhgkdfhgdfhgkjdfghkdfjghkdfjghfkdjghkdfghkdfhgkdfjghdfkjghkfdjghfksdhfkjsdhfdshfhsdfjhsdkfhkdsfhksdfhksdhfksdhfksdhfksdhfsdhfksdhfkjsdhfksdhfksdhfkds",
-                false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-
-    //Test with no Id
-    @Test
-    public void withNoId() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 0;
-        final ODataEntity original = getNewCustomer(id, "New Customer", false);
-        createEntity(testStaticServiceRootURL, format, original, "Customer", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null, "Customer");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // test different primitive properties like date, String, decimal
-
-    @Test
-    public void differentProperties() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-no-content";
-        final int id = 34;
-        final ODataEntity original = getComputerDetailsEntity(id, "Computer details", false,
-                "2013-12-31T23:59:59.9999999", "-32.4985749");
-        createEntity(testStaticServiceRootURL, format, original, "ComputerDetail", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                "ComputerDetail");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // test with invalid 
-
-    @Test(expected = IllegalArgumentException.class)
-    public void invalidDateTest() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-no-content";
-        final int id = 34;
-        final ODataEntity original = getComputerDetailsEntity(id, "Computer details", false, "abc", "-32.4985749");
-        createEntity(testStaticServiceRootURL, format, original, "ComputerDetail", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                "ComputerDetail");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // test with different decimal values. Returns 400 error
-
-    @Test(expected = ODataClientErrorException.class)
-    @Ignore // static server doesn't provide any input validation
-    public void testWithDecimal() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-no-content";
-        final int id = 35;
-        final ODataEntity original = getComputerDetailsEntity(id, "Computer details Test", false,
-                "2013-12-31T23:59:59.9999999",
-                "-344587543985799834759845798475943759438573495734985739457349857394857894.4985749");
-        createEntity(testStaticServiceRootURL, format, original, "ComputerDetail", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                "ComputerDetail");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // test with date. Unable to parse a date because the property type is datetime and not date
-
-    @Test(expected = IllegalArgumentException.class)
-    public void withDate() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contenttype = "application/json;odata=fullmetadata";
-        final String prefer = "return-no-content";
-        final int id = 35;
-        final ODataEntity original = getComputerDetailsEntity(id, "Computer details Test", false, "2013-12-31",
-                "-37894.4985749");
-        createEntity(testStaticServiceRootURL, format, original, "ComputerDetail", contenttype, prefer);
-        final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, original, id, null,
-                "ComputerDetail");
-        delete(format, actual, false, testStaticServiceRootURL);
-    }
-    // with multiple key test
-
-    @Test
-    public void createWithMultipleKey() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        try {
-            final ODataEntity message = client.getObjectFactory().newEntity(
-                    "Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
-
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("MessageId",
-                    client.getPrimitiveValueBuilder().setValue(111).setType(EdmSimpleType.Int32).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("FromUsername",
-                    client.getPrimitiveValueBuilder().setValue("user").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("ToUsername",
-                    client.getPrimitiveValueBuilder().setValue("usernameabc").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("Subject",
-                    client.getPrimitiveValueBuilder().setValue("Subject of message").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("Body",
-                    client.getPrimitiveValueBuilder().setValue("Body Content").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("IsRead",
-                    client.getPrimitiveValueBuilder().setValue(false).setType(EdmSimpleType.Boolean).build()));
-
-            final URIBuilder builder =
-                    client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Message");
-            final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
-                    message);
-            req.setFormat(format);
-            req.setContentType(contentType);
-            req.setPrefer(prefer);
-            final ODataEntityCreateResponse res = req.execute();
-            assertNotNull(res);
-            assertEquals(201, res.getStatusCode());
-
-            final Map<String, Object> multiKey = new HashMap<String, Object>();
-            multiKey.put("FromUsername", "user");
-            multiKey.put("MessageId", 111);
-
-            final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().
-                    getDeleteRequest(builder.appendKeySegment(multiKey).build()).execute();
-            assertEquals(204, deleteRes.getStatusCode());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
-    // create an entity which has multiple keys by only one of the key is send in the request payload.
-    // it creates the entity successfully
-
-    @Test
-    public void createNoMultipleKey() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        try {
-            final ODataEntity message = client.getObjectFactory().newEntity(
-                    "Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
-
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("MessageId",
-                    client.getPrimitiveValueBuilder().setText(String.valueOf(25)).
-                    setType(EdmSimpleType.Int32).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("FromUsername",
-                    client.getPrimitiveValueBuilder().setText("user").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("ToUsername",
-                    client.getPrimitiveValueBuilder().setValue("usernameabc").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("Subject",
-                    client.getPrimitiveValueBuilder().setValue("Subject of message").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("Body",
-                    client.getPrimitiveValueBuilder().setValue("Body Content").
-                    setType(EdmSimpleType.String).build()));
-            message.addProperty(client.getObjectFactory().newPrimitiveProperty("IsRead",
-                    client.getPrimitiveValueBuilder().setValue(false).setType(EdmSimpleType.Boolean).build()));
-
-            final URIBuilder builder =
-                    client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Message");
-            final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
-                    message);
-            req.setFormat(format);
-            req.setContentType(contentType);
-            req.setPrefer(prefer);
-            final ODataEntityCreateResponse res = req.execute();
-            assertNotNull(res);
-            assertEquals(201, res.getStatusCode());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-    }
-    // test open type create Entity, JSON full metadata
-
-    @Test
-    public void openTypeCreateJSON() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 11;
-        final String gid = "random";
-        getOpenTypeEntity(format, contentType, id, prefer, gid);
-    }
-    // test open type create Entity, ATOM full metadata
-
-    @Test
-    public void openTypeCreateATOM() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final String contentType = "application/atom+xml";
-        final String prefer = "return-content";
-        final int id = 12;
-        final String gid = "random";
-        getOpenTypeEntity(format, contentType, id, prefer, gid);
-    }
-    // test open type create Entity, JSON no metadata.
-
-    @Test
-    public void openTypeCreateNoMetadata() {
-        final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
-        final String contentType = "application/json;odata=nometadata";
-        final String prefer = "return-content";
-        final int id = 1333;
-        final String gid = "random";
-        getOpenTypeEntity(format, contentType, id, prefer, gid);
-    }
-    // test with invalid guid
-
-    @Test
-    public void withInvalidGuid() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullmetadata";
-        final String prefer = "return-content";
-        final int id = 777;
-        final String gid = "00000000-0000-0000-0000-000000000000";
-        getOpenTypeEntity(format, contentType, id, prefer, gid);
-    }
-    // test with guid as string.
-
-    @Test
-    public void withStringGuid() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final String contentType = "application/json;odata=fullemtadata";
-        final String prefer = "return-content";
-        final int id = 777;
-        final String gid = "stringguid";
-        getOpenTypeEntityWithString(format, contentType, id, prefer, gid);
-    }
-
-    // compares links of the newly created entity with the previous 
-    public void validateLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
-        assertTrue(original.size() <= actual.size());
-
-        for (ODataLink originalLink : original) {
-            ODataLink foundOriginal = null;
-            ODataLink foundActual = null;
-
-            for (ODataLink actualLink : actual) {
-
-                if (actualLink.getType() == originalLink.getType()
-                        && (originalLink.getLink() == null
-                        || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
-                        && actualLink.getName().equals(originalLink.getName())) {
-
-                    foundOriginal = originalLink;
-                    foundActual = actualLink;
-                }
-            }
-
-            assertNotNull(foundOriginal);
-            assertNotNull(foundActual);
-
-            if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
-                final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
-                assertNotNull(originalInline);
-
-                final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
-                assertNotNull(actualInline);
-
-                checkProperties(originalInline.getProperties(), actualInline.getProperties());
-            }
-        }
-    }
-
-    // add Information property
-    public ODataEntity getInfo(final int id, final String info) {
-        final ODataEntity entity =
-                client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
-        entity.setMediaEntity(true);
-
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Information",
-                client.getPrimitiveValueBuilder().setText(info).setType(EdmSimpleType.String).build()));
-        return entity;
-    }
-    // get a Customer entity to be created
-
-    public ODataEntity getNewCustomer(
-            final int id, final String name, final boolean withInlineInfo) {
-
-        final ODataEntity entity =
-                client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-
-        // add name attribute
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Name",
-                client.getPrimitiveValueBuilder().setText(name).setType(EdmSimpleType.String).build()));
-
-        // add key attribute
-        if (id != 0) {
-            entity.addProperty(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-                    client.getPrimitiveValueBuilder().setValue(id).setType(EdmSimpleType.Int32).build()));
-        } else {
-            entity.addProperty(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-                    client.getPrimitiveValueBuilder().setValue(0).setType(EdmSimpleType.Int32).build()));
-        }
-        final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
-                "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
-
-
-        final ODataComplexValue contactDetails = new ODataComplexValue(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
-
-
-        final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
-        altNamesValue.add(client.getPrimitiveValueBuilder().
-                setText("My Alternative name").setType(EdmSimpleType.String).build());
-        contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
-
-        final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
-        emailBagValue.add(client.getPrimitiveValueBuilder().
-                setText("altname@mydomain.com").setType(EdmSimpleType.String).build());
-        contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
-
-        final ODataComplexValue contactAliasValue = new ODataComplexValue(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
-        contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
-
-        final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
-        aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
-                setText("myAlternativeName").setType(EdmSimpleType.String).build());
-        contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
-
-        final ODataComplexValue homePhone = new ODataComplexValue(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
-        homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
-                client.getPrimitiveValueBuilder().setText("8437568356834568").setType(EdmSimpleType.String).build()));
-        homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
-                client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").setType(EdmSimpleType.String).
-                build()));
-        contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
-
-        backupContactInfoValue.add(contactDetails);
-        entity.addProperty(client.getObjectFactory().newCollectionProperty("BackupContactInfo",
-                backupContactInfoValue));
-        if (withInlineInfo) {
-            final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity("Info", URI.create(
-                    "Customer(" + id
-                    + ")/Info"), getInfo(id, name + "_Info"));
-            inlineInfo.getEntity().setMediaEntity(true);
-            entity.addLink(inlineInfo);
-        }
-
-        return entity;
-    }
-    // get a ComputerDetail entity to be created
-
-    public ODataEntity getComputerDetailsEntity(
-            final int id, final String sampleName, final boolean withInlineInfo,
-            final String purchaseDate, String dimensionValue) {
-
-        final ODataEntity entity =
-                client.getObjectFactory().
-                newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail");
-
-
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Manufacturer",
-                client.getPrimitiveValueBuilder().setText("manufacturer name").
-                setType(EdmSimpleType.String).build()));
-
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("ComputerDetailId",
-                client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
-                setType(EdmSimpleType.Int32).build()));
-
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Model",
-                client.getPrimitiveValueBuilder().setText("Model Name").setType(EdmSimpleType.String).build()));
-
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("PurchaseDate",
-                client.getPrimitiveValueBuilder().setText(purchaseDate).setType(EdmSimpleType.DateTime).build()));
-
-
-        // add Dimensions attribute (collection)
-        final ODataComplexValue dimensions = new ODataComplexValue(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions");
-        dimensions.add(client.getObjectFactory().newPrimitiveProperty("Width",
-                client.getPrimitiveValueBuilder().setText(dimensionValue).setType(EdmSimpleType.Decimal).build()));
-        dimensions.add(client.getObjectFactory().newPrimitiveProperty("Height",
-                client.getPrimitiveValueBuilder().setText(dimensionValue).setType(EdmSimpleType.Decimal).build()));
-        dimensions.add(client.getObjectFactory().newPrimitiveProperty("Depth",
-                client.getPrimitiveValueBuilder().setText(dimensionValue).setType(EdmSimpleType.Decimal).build()));
-
-        entity.addProperty(client.getObjectFactory().newComplexProperty("Dimensions",
-                dimensions));
-        return entity;
-    }
-    // create an entity
-
-    public void createEntity(
-            final String serviceRootURL,
-            final ODataPubFormat format,
-            final ODataEntity original,
-            final String entitySetName,
-            final String contentType,
-            final String prefer) {
-
-        final URIBuilder uriBuilder = client.getURIBuilder(serviceRootURL);
-        uriBuilder.appendEntitySetSegment(entitySetName);
-        final ODataEntityCreateRequest createReq =
-                client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
-        createReq.setFormat(format);
-        createReq.setContentType(contentType);
-        createReq.setPrefer(prefer);
-
-        final ODataEntityCreateResponse createRes = createReq.execute();
-
-        if (prefer.equals("return-no-content")) {
-            assertEquals(204, createRes.getStatusCode());
-        } else {
-            assertEquals(201, createRes.getStatusCode());
-            assertEquals("Created", createRes.getStatusMessage());
-            assertTrue(createRes.getHeader("DataServiceVersion").contains("3.0;"));
-            final ODataEntity created = createRes.getBody();
-            assertNotNull(created);
-        }
-
-    }
-    // validate newly created entities
-
-    public ODataEntity validateEntities(final String serviceRootURL,
-            final ODataPubFormat format,
-            final ODataEntity original,
-            final int actualObjectId,
-            final Collection<String> expands, final String entitySetName) {
-
-        final URIBuilder uriBuilder = client.getURIBuilder(serviceRootURL).
-                appendEntityTypeSegment(entitySetName).appendKeySegment(actualObjectId);
-
-        // search expanded
-        if (expands != null) {
-            for (String expand : expands) {
-                uriBuilder.expand(expand);
-            }
-        }
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-
-        final ODataEntity actual = res.getBody();
-        assertNotNull(actual);
-
-        validateLinks(original.getAssociationLinks(), actual.getAssociationLinks());
-        validateLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
-        validateLinks(original.getNavigationLinks(), actual.getNavigationLinks());
-
-        // validate equalities of properties
-        checkProperties(original.getProperties(), actual.getProperties());
-        return actual;
-    }
-    // creates dynamic property for open type entity.
-
-    public void getOpenTypeEntity(final ODataPubFormat format, final String contentType,
-            final int id, final String prefer, String uuid) {
-        final UUID guid;
-        if (uuid.equals("random")) {
-            guid = UUID.randomUUID();
-        } else {
-            guid = UUID.fromString(uuid);
-        }
-        ODataEntity entity = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Id",
-                client.getPrimitiveValueBuilder().setType(EdmSimpleType.Guid).setValue(guid).build()));
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("LongValue",
-                client.getPrimitiveValueBuilder().setType(EdmSimpleType.Int64).setValue(44L).build()));
-        entity.addProperty(client.getObjectFactory().newPrimitiveProperty("DoubleValue",
-                client.getPrimitiveValueBuilder().setType(EdmSimpleType.Double).setValue(4.34567D).build()));
-
-        final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
-                getEntityCreateRequest(client.getURIBuilder(testOpenTypeServiceRootURL).
-                appendEntityTypeSegment("Row").build(), entity);
-        createReq.setFormat(format);
-        createReq.setPrefer(prefer);
-        createReq.setContentType(contentType);
-        final ODataEntityCreateResponse createRes = createReq.execute();
-        assertEquals(201, createRes.getStatusCode());
-        entity = createRes.getBody();
-        assertNotNull(entity);
-        if (format.equals(ODataPubFormat.JSON_NO_METADATA)) {
-            assertEquals(EdmSimpleType.String.toString(), entity.getProperty("Id").getPrimitiveValue().getTypeName());
-            assertEquals(EdmSimpleType.String.toString(), entity.getProperty("LongValue").getPrimitiveValue().
-                    getTypeName());
-            assertEquals(EdmSimpleType.Double.toString(), entity.getProperty("DoubleValue").getPrimitiveValue().
-                    getTypeName());
-        } else if (format.equals(ODataPubFormat.JSON)) {
-            assertEquals(EdmSimpleType.String.toString(), entity.getProperty("Id").getPrimitiveValue().getTypeName());
-            assertEquals(EdmSimpleType.Int64.toString(), entity.getProperty("LongValue").getPrimitiveValue().
-                    getTypeName());
-            assertEquals(EdmSimpleType.Double.toString(), entity.getProperty("DoubleValue").getPrimitiveValue().
-                    getTypeName());
-        } else {
-            assertEquals(EdmSimpleType.Guid.toString(), entity.getProperty("Id").getPrimitiveValue().getTypeName());
-            assertEquals(EdmSimpleType.Int64.toString(), entity.getProperty("LongValue").getPrimitiveValue().
-                    getTypeName());
-            assertEquals(EdmSimpleType.Double.toString(), entity.getProperty("DoubleValue").getPrimitiveValue().
-                    getTypeName());
-        }
-        ODataDeleteResponse deleteRes;
-        try {
-            deleteRes = client.getCUDRequestFactory().getDeleteRequest(
-                    new URI(testOpenTypeServiceRootURL + "/Row(guid'" + guid + "')")).execute();
-            assertEquals(204, deleteRes.getStatusCode());
-        } catch (URISyntaxException e) {
-            // TODO Auto-generated catch block
-            LOG.error("", e);
-        }
-    }
-    // creates dynamic property for open type entity (Invalid Guid test)
-
-    public void getOpenTypeEntityWithString(final ODataPubFormat format, final String contentType,
-            final int id, final String prefer, String uuid) {
-        try {
-            ODataEntity entity = client.getObjectFactory().newEntity(
-                    "Microsoft.Test.OData.Services.OpenTypesService.Row");
-            entity.addProperty(client.getObjectFactory().newPrimitiveProperty("Id",
-                    client.getPrimitiveValueBuilder().setType(EdmSimpleType.Guid).setValue(uuid).build()));
-            entity.addProperty(client.getObjectFactory().newPrimitiveProperty("LongValue",
-                    client.getPrimitiveValueBuilder().setType(EdmSimpleType.Int64).setValue(44L).build()));
-            entity.addProperty(client.getObjectFactory().newPrimitiveProperty("DoubleValue",
-                    client.getPrimitiveValueBuilder().setType(EdmSimpleType.Double).setValue(4.34567D).build()));
-
-            final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
-                    getEntityCreateRequest(client.getURIBuilder(testOpenTypeServiceRootURL).
-                    appendEntityTypeSegment("Row").build(), entity);
-            createReq.setFormat(format);
-            createReq.setPrefer(prefer);
-            createReq.setContentType(contentType);
-            final ODataEntityCreateResponse createRes = createReq.execute();
-        } catch (Exception e) {
-            if (e.getMessage().equals("Provided value is not compatible with Edm.Guid")) {
-                assertTrue(true);
-            } else {
-                fail(e.getMessage());
-            }
-        }
-    }
-    // delete an entity and associated links after creation
-
-    public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
-            final String baseUri) {
-
-        final Set<URI> toBeDeleted = new HashSet<URI>();
-        toBeDeleted.add(created.getEditLink());
-
-        if (includeInline) {
-            for (ODataLink link : created.getNavigationLinks()) {
-                if (link instanceof ODataInlineEntity) {
-                    final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
-                    if (inline.getEditLink() != null) {
-                        toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
-                    }
-                }
-                if (link instanceof ODataInlineEntitySet) {
-                    final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
-                    for (ODataEntity entity : inline.getEntities()) {
-                        if (entity.getEditLink() != null) {
-                            toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
-                        }
-                    }
-                }
-            }
-        }
-        assertFalse(toBeDeleted.isEmpty());
-
-        for (URI link : toBeDeleted) {
-            final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(link);
-            deleteReq.setFormat(format);
-            final ODataDeleteResponse deleteRes = deleteReq.execute();
-            assertEquals(204, deleteRes.getStatusCode());
-            assertEquals("No Content", deleteRes.getStatusMessage());
-
-            deleteRes.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateTestITCase.java b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateTestITCase.java
deleted file mode 100644
index a5ecd3a..0000000
--- a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityCreateTestITCase.java
+++ /dev/null
@@ -1,477 +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 com.msopentech.odatajclient.engine.it;
-
-import static com.msopentech.odatajclient.engine.it.AbstractTestITCase.testStaticServiceRootURL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import com.msopentech.odatajclient.engine.client.http.NoContentException;
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaderValues;
-import com.msopentech.odatajclient.engine.communication.header.ODataHeaders;
-import com.msopentech.odatajclient.engine.communication.request.UpdateType;
-import com.msopentech.odatajclient.engine.communication.request.cud.ODataDeleteRequest;
-import com.msopentech.odatajclient.engine.communication.request.cud.ODataEntityCreateRequest;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntityRequest;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntitySetRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataDeleteResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataEntityCreateResponse;
-import com.msopentech.odatajclient.engine.communication.response.ODataRetrieveResponse;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataProperty;
-import com.msopentech.odatajclient.engine.uri.URIBuilder;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.data.ODataInlineEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataLink;
-import com.msopentech.odatajclient.engine.metadata.edm.EdmSimpleType;
-import com.msopentech.odatajclient.engine.utils.URIUtils;
-import java.net.URI;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import org.apache.http.entity.ContentType;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check create entity operations.
- */
-public class EntityCreateTestITCase extends AbstractTestITCase {
-
-    protected String getServiceRoot() {
-        return testStaticServiceRootURL;
-    }
-
-    @Test
-    public void createAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final int id = 1;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
-
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createAsJSON() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final int id = 2;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
-
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createWithInlineAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final int id = 3;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual =
-                compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
-
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void createWithInlineAsJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final int id = 4;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual =
-                compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
-
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void createInlineWithoutLinkAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final int id = 5;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
-
-        original.addLink(client.getObjectFactory().newInlineEntity(
-                "Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual =
-                compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
-
-        boolean found = false;
-
-        for (ODataLink link : actual.getNavigationLinks()) {
-            assertNotNull(link.getLink());
-            if (link.getLink().toASCIIString().endsWith("Customer(" + id + ")/Info")) {
-                found = true;
-            }
-        }
-
-        assertTrue(found);
-
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void createInlineWithoutLinkAsJSON() {
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final int id = 6;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
-
-        original.addLink(client.getObjectFactory().newInlineEntity(
-                "Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
-
-        createEntity(getServiceRoot(), format, original, "Customer");
-        final ODataEntity actual =
-                compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
-
-        boolean found = false;
-
-        for (ODataLink link : actual.getNavigationLinks()) {
-            assertNotNull(link.getLink());
-            if (link.getLink().toASCIIString().endsWith("Customer(" + id + ")/Info")) {
-                found = true;
-            }
-        }
-
-        assertTrue(found);
-
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void createWithNavigationAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final ODataEntity actual = createWithNavigationLink(format, 5);
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createWithNavigationAsJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final ODataEntity actual = createWithNavigationLink(format, 6);
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createWithFeedNavigationAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final ODataEntity actual = createWithFeedNavigationLink(format, 7);
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createWithFeedNavigationAsJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final ODataEntity actual = createWithFeedNavigationLink(format, 8);
-        cleanAfterCreate(format, actual, false, getServiceRoot());
-    }
-
-    @Test
-    public void createWithBackNavigationAsAtom() {
-        final ODataPubFormat format = ODataPubFormat.ATOM;
-        final ODataEntity actual = createWithBackNavigationLink(format, 9);
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void createWithBackNavigationAsJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
-        final ODataEntity actual = createWithBackNavigationLink(format, 10);
-        cleanAfterCreate(format, actual, true, getServiceRoot());
-    }
-
-    @Test
-    public void multiKeyAsAtom() {
-        multiKey(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void multiKeyAsJSON() {
-        multiKey(ODataPubFormat.JSON);
-    }
-
-    @Test
-    public void createReturnNoContent() {
-        final int id = 1;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
-
-        final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
-                client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original);
-        createReq.setPrefer(ODataHeaderValues.preferReturnNoContent);
-
-        final ODataEntityCreateResponse createRes = createReq.execute();
-        assertEquals(204, createRes.getStatusCode());
-        assertEquals(ODataHeaderValues.preferReturnNoContent,
-                createRes.getHeader(ODataHeaders.HeaderName.preferenceApplied).iterator().next());
-
-        try {
-            createRes.getBody();
-            fail();
-        } catch (NoContentException e) {
-            assertNotNull(e);
-        }
-
-        final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(
-                client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id).build()).
-                execute();
-        assertEquals(204, deleteRes.getStatusCode());
-    }
-
-    @Test
-    @Ignore
-    public void issue135() {
-        final int id = 2;
-        final ODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
-
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
-        final ODataEntityCreateRequest createReq =
-                client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
-        createReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
-        createReq.setContentType(ContentType.APPLICATION_ATOM_XML.getMimeType());
-        createReq.setPrefer(ODataHeaderValues.preferReturnContent);
-
-        try {
-            final ODataEntityCreateResponse createRes = createReq.execute();
-            assertEquals(201, createRes.getStatusCode());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        } finally {
-            final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest(
-                    client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id).
-                    build()).
-                    execute();
-            assertEquals(204, deleteRes.getStatusCode());
-        }
-    }
-
-    private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id) {
-        final String sampleName = "Sample customer";
-        final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
-
-        final Set<Integer> keys = new HashSet<Integer>();
-        keys.add(-100);
-        keys.add(-101);
-
-        for (Integer key : keys) {
-            final ODataEntity order =
-                    client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
-
-            order.addProperty(client.getObjectFactory().newPrimitiveProperty("OrderId",
-                    client.getPrimitiveValueBuilder().setValue(key).setType(EdmSimpleType.Int32).build()));
-            order.addProperty(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-                    client.getPrimitiveValueBuilder().setValue(id).setType(EdmSimpleType.Int32).build()));
-
-            final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
-                    client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
-            createReq.setFormat(format);
-
-            original.addLink(client.getObjectFactory().newFeedNavigationLink(
-                    "Orders",
-                    createReq.execute().getBody().getEditLink()));
-        }
-
-        final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
-        // now, compare the created one with the actual one and go deeply into the associated customer info.....
-        final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
-
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
-        uriBuilder.appendEntityTypeSegment("Customer").appendKeySegment(id).appendEntityTypeSegment("Orders");
-
-        final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-
-        final ODataEntitySet entitySet = res.getBody();
-        assertNotNull(entitySet);
-        assertEquals(2, entitySet.getCount());
-
-        for (ODataEntity entity : entitySet.getEntities()) {
-            final Integer key = entity.getProperty("OrderId").getPrimitiveValue().<Integer>toCastValue();
-            final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue();
-            assertTrue(keys.contains(key));
-            assertEquals(Integer.valueOf(id), customerId);
-            keys.remove(key);
-
-            final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(
-                    URIUtils.getURI(getServiceRoot(), entity.getEditLink().toASCIIString()));
-
-            deleteReq.setFormat(format);
-            assertEquals(204, deleteReq.execute().getStatusCode());
-        }
-
-        return actual;
-    }
-
-    private ODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
-        final String sampleName = "Sample customer";
-
-        final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
-        original.addLink(client.getObjectFactory().newEntityNavigationLink(
-                "Info", URI.create(getServiceRoot() + "/CustomerInfo(12)")));
-
-        final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
-        // now, compare the created one with the actual one and go deeply into the associated customer info.....
-        final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
-
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot());
-        uriBuilder.appendEntityTypeSegment("Customer").appendKeySegment(id).appendEntityTypeSegment("Info");
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-
-        final ODataEntity info = res.getBody();
-        assertNotNull(info);
-
-        boolean found = false;
-
-        for (ODataProperty prop : info.getProperties()) {
-            if ("CustomerInfoId".equals(prop.getName())) {
-                assertEquals("12", prop.getValue().toString());
-                found = true;
-            }
-        }
-
-        assertTrue(found);
-
-        return actual;
-    }
-
-    private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id) {
-        final String sampleName = "Sample customer";
-
-        ODataEntity customer = getSampleCustomerProfile(id, sampleName, false);
-        customer = createEntity(getServiceRoot(), format, customer, "Customer");
-
-        ODataEntity order = client.getObjectFactory().newEntity(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
-        order.addProperty(client.getObjectFactory().newPrimitiveProperty("CustomerId",
-                client.getPrimitiveValueBuilder().setValue(id).setType(EdmSimpleType.Int32).build()));
-        order.addProperty(client.getObjectFactory().newPrimitiveProperty("OrderId",
-                client.getPrimitiveValueBuilder().setValue(id).setType(EdmSimpleType.Int32).build()));
-
-        order.addLink(client.getObjectFactory().newEntityNavigationLink(
-                "Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
-
-        order = createEntity(getServiceRoot(), format, order, "Order");
-
-        ODataEntity changes = client.getObjectFactory().newEntity(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-        changes.setEditLink(customer.getEditLink());
-        changes.addLink(client.getObjectFactory().newFeedNavigationLink(
-                "Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString())));
-        update(UpdateType.PATCH, changes, format, null);
-
-        final ODataEntityRequest customerreq = client.getRetrieveRequestFactory().getEntityRequest(
-                URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer"));
-        customerreq.setFormat(format);
-
-        customer = customerreq.execute().getBody();
-
-        assertEquals(
-                Integer.valueOf(id), customer.getProperty("CustomerId").getPrimitiveValue().<Integer>toCastValue());
-
-        final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
-                URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders"));
-        orderreq.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntitySet> orderres = orderreq.execute();
-        assertEquals(200, orderres.getStatusCode());
-
-        assertEquals(Integer.valueOf(id),
-                orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue().
-                <Integer>toCastValue());
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
-                URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders"));
-        req.setFormat(format);
-
-        customer = req.execute().getBody();
-
-        boolean found = false;
-        for (ODataLink link : customer.getNavigationLinks()) {
-            if (link instanceof ODataInlineEntitySet && "Orders".equals(link.getName())) {
-                found = true;
-            }
-        }
-        assertTrue(found);
-
-        return customer;
-    }
-
-    private void multiKey(final ODataPubFormat format) {
-        final ODataEntity message = client.getObjectFactory().newEntity(
-                "Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
-
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("MessageId",
-                client.getPrimitiveValueBuilder().setValue(1000).setType(EdmSimpleType.Int32).build()));
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("FromUsername",
-                client.getPrimitiveValueBuilder().setValue("1").
-                setType(EdmSimpleType.String).build()));
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("ToUsername",
-                client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
-                setType(EdmSimpleType.String).build()));
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("Subject",
-                client.getPrimitiveValueBuilder().setValue("Test subject").
-                setType(EdmSimpleType.String).build()));
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("Body",
-                client.getPrimitiveValueBuilder().setValue("Test body").
-                setType(EdmSimpleType.String).build()));
-        message.addProperty(client.getObjectFactory().newPrimitiveProperty("IsRead",
-                client.getPrimitiveValueBuilder().setValue(false).setType(EdmSimpleType.Boolean).build()));
-
-        final URIBuilder builder =
-                client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
-        final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
-                message);
-        req.setFormat(format);
-
-        final ODataEntityCreateResponse res = req.execute();
-        assertNotNull(res);
-        assertEquals(201, res.getStatusCode());
-
-        final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
-        multiKey.put("FromUsername", "1");
-        multiKey.put("MessageId", 1000);
-
-        final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().
-                getDeleteRequest(builder.appendKeySegment(multiKey).build()).execute();
-        assertEquals(204, deleteRes.getStatusCode());
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityRetrieveTestITCase.java b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityRetrieveTestITCase.java
deleted file mode 100644
index e64f61f..0000000
--- a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntityRetrieveTestITCase.java
+++ /dev/null
@@ -1,240 +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 com.msopentech.odatajclient.engine.it;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntityRequest;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataGenericRetrieveRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataRetrieveResponse;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataInlineEntity;
-import com.msopentech.odatajclient.engine.data.ODataLink;
-import com.msopentech.odatajclient.engine.data.ODataProperty;
-import com.msopentech.odatajclient.engine.uri.URIBuilder;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-import com.msopentech.odatajclient.engine.data.ODataEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataInlineEntitySet;
-import com.msopentech.odatajclient.engine.data.ODataObjectWrapper;
-import com.msopentech.odatajclient.engine.data.ResourceFactory;
-import java.util.LinkedHashMap;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check entity retrieve operations.
- */
-public class EntityRetrieveTestITCase extends AbstractTestITCase {
-
-    protected String getServiceRoot() {
-        return testStaticServiceRootURL;
-    }
-
-    private void withInlineEntry(final ODataPubFormat format) {
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
-                appendEntityTypeSegment("Customer").appendKeySegment(-10).expand("Info");
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        final ODataEntity entity = res.getBody();
-
-        assertNotNull(entity);
-        assertEquals("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", entity.getName());
-        assertEquals(getServiceRoot() + "/Customer(-10)", entity.getEditLink().toASCIIString());
-
-        assertEquals(5, entity.getNavigationLinks().size());
-        assertTrue(entity.getAssociationLinks().isEmpty());
-
-        boolean found = false;
-
-        for (ODataLink link : entity.getNavigationLinks()) {
-            if (link instanceof ODataInlineEntity) {
-                final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
-                assertNotNull(inline);
-
-                debugEntry(client.getBinder().getEntry(
-                        inline, ResourceFactory.entryClassForFormat(format)), "Just read");
-
-                final List<ODataProperty> properties = inline.getProperties();
-                assertEquals(2, properties.size());
-
-                assertTrue(properties.get(0).getName().equals("CustomerInfoId")
-                        || properties.get(1).getName().equals("CustomerInfoId"));
-                assertTrue(properties.get(0).getValue().toString().equals("11")
-                        || properties.get(1).getValue().toString().equals("11"));
-
-                found = true;
-            }
-        }
-
-        assertTrue(found);
-    }
-
-    @Test
-    public void withInlineEntryFromAtom() {
-        withInlineEntry(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void withInlineEntryFromJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        withInlineEntry(ODataPubFormat.JSON_FULL_METADATA);
-    }
-
-    private void withInlineFeed(final ODataPubFormat format) {
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
-                appendEntityTypeSegment("Customer").appendKeySegment(-10).expand("Orders");
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        final ODataEntity entity = res.getBody();
-        assertNotNull(entity);
-
-        boolean found = false;
-
-        for (ODataLink link : entity.getNavigationLinks()) {
-            if (link instanceof ODataInlineEntitySet) {
-                final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
-                assertNotNull(inline);
-
-                debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(format)),
-                        "Just read");
-
-                found = true;
-            }
-        }
-
-        assertTrue(found);
-    }
-
-    @Test
-    public void withInlineFeedFromAtom() {
-        withInlineFeed(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void withInlineFeedFromJSON() {
-        // this needs to be full, otherwise there is no mean to recognize links
-        withInlineFeed(ODataPubFormat.JSON_FULL_METADATA);
-    }
-
-    private void genericRequest(final ODataPubFormat format) {
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
-                appendEntityTypeSegment("Car").appendKeySegment(16);
-
-        final ODataGenericRetrieveRequest req =
-                client.getRetrieveRequestFactory().getGenericRetrieveRequest(uriBuilder.build());
-        req.setFormat(format.toString());
-
-        final ODataRetrieveResponse<ODataObjectWrapper> res = req.execute();
-
-        final ODataObjectWrapper wrapper = res.getBody();
-
-        final ODataEntitySet entitySet = wrapper.getODataEntitySet();
-        assertNull(entitySet);
-
-        final ODataEntity entity = wrapper.getODataEntity();
-        assertNotNull(entity);
-    }
-
-    @Test
-    public void genericRequestAsAtom() {
-        genericRequest(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void genericRequestAsJSON() {
-        // this needs to be full, otherwise actions will not be provided
-        genericRequest(ODataPubFormat.JSON_FULL_METADATA);
-    }
-
-    private void multiKey(final ODataPubFormat format) {
-        final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
-        multiKey.put("FromUsername", "1");
-        multiKey.put("MessageId", -10);
-
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).
-                appendEntityTypeSegment("Message").appendKeySegment(multiKey);
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        final ODataEntity entity = res.getBody();
-        assertNotNull(entity);
-        assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().<String>toCastValue());
-    }
-
-    @Test
-    public void multiKeyAsAtom() {
-        multiKey(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void multiKeyAsJSON() {
-        multiKey(ODataPubFormat.JSON_FULL_METADATA);
-    }
-
-    @Test
-    public void checkForETagAsATOM() {
-        checkForETag(ODataPubFormat.ATOM);
-    }
-
-    @Test
-    public void checkForETagAsJSON() {
-        checkForETag(ODataPubFormat.JSON_FULL_METADATA);
-    }
-
-    private void checkForETag(final ODataPubFormat format) {
-        final URIBuilder uriBuilder =
-                client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10);
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(format);
-
-        final ODataRetrieveResponse<ODataEntity> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-
-        final String etag = res.getEtag();
-        assertTrue(StringUtils.isNotBlank(etag));
-
-        final ODataEntity product = res.getBody();
-        assertEquals(etag, product.getETag());
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void issue99() {
-        final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
-
-        final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(ODataPubFormat.JSON);
-
-        // this statement should cause an IllegalArgumentException bearing JsonParseException
-        // since we are attempting to parse an EntitySet as if it was an Entity
-        req.execute().getBody();
-    }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/19f3792f/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntitySetRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntitySetRetrieveTestITCase.java b/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntitySetRetrieveTestITCase.java
deleted file mode 100644
index 3d5ac02..0000000
--- a/ODataJClient/engine/src/test/java/com/msopentech/odatajclient/engine/it/EntitySetRetrieveTestITCase.java
+++ /dev/null
@@ -1,295 +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 com.msopentech.odatajclient.engine.it;
-
-import static org.junit.Assert.*;
-
-import com.msopentech.odatajclient.engine.communication.ODataClientErrorException;
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntityRequest;
-import java.util.List;
-import org.junit.Test;
-
-import com.msopentech.odatajclient.engine.communication.request.retrieve.ODataEntitySetRequest;
-import com.msopentech.odatajclient.engine.communication.response.ODataRetrieveResponse;
-import com.msopentech.odatajclient.engine.data.ODataEntity;
-import com.msopentech.odatajclient.engine.data.ODataEntitySet;
-import com.msopentech.odatajclient.engine.uri.URIBuilder;
-import com.msopentech.odatajclient.engine.format.ODataPubFormat;
-
-public class EntitySetRetrieveTestITCase extends AbstractTestITCase {
-
-    private void retreiveEntityTest(ODataPubFormat reqFormat, String acceptFormat) {
-        URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntityTypeSegment("Product");
-        ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        try {
-            ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-            assertEquals(200, res.getStatusCode());
-            ODataEntitySet entitySet = res.getBody();
-            List<ODataEntity> entity = entitySet.getEntities();
-            for (int i = 0; i < entity.size(); i++) {
-                assertNotNull(entity.get(i));
-            }
-            assertEquals(10, entity.size());
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
-    }
-
-    private void retreiveFullMetadataEntityTest(String acceptFormat) {
-        URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Product");
-        ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setAccept(acceptFormat);
-        ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-        ODataEntitySet entitySet = res.getBody();
-        assertNotNull(entitySet);
-        List<ODataEntity> entity = entitySet.getEntities();
-        assertEquals(10, entity.size());
-        for (int i = 0; i < entity.size(); i++) {
-            assertNotNull(entity.get(i));
-        }
-    }
-
-    private void retreiveNoMetadataEntityTest(final ODataPubFormat reqFormat, final String acceptFormat) {
-        final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Product");
-        final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-        final ODataEntitySet entitySet = res.getBody();
-        assertNotNull(entitySet);
-        List<ODataEntity> entity = entitySet.getEntities();
-        assertEquals(10, entity.size());
-        for (int i = 0; i < entity.size(); i++) {
-            assertNotNull(entity.get(i));
-        }
-    }
-
-    private void retreiveMinimalMetadataEntityTest(final ODataPubFormat reqFormat, final String acceptFormat) {
-        final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Product");
-        final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-        final ODataEntitySet entitySet = res.getBody();
-        assertNotNull(entitySet);
-        final List<ODataEntity> entity = entitySet.getEntities();
-        assertEquals(10, entity.size());
-        for (int i = 0; i < entity.size(); i++) {
-            assertNotNull(entity.get(i));
-        }
-    }
-
-    private void retreiveEntityTestWithExpand(final ODataPubFormat reqFormat, final String acceptFormat,
-            final String expandFormat) {
-        URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Customer").expand(expandFormat);
-        ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        try {
-            ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-            assertEquals(200, res.getStatusCode());
-            ODataEntitySet entitySet = res.getBody();
-            assertNotNull(entitySet);
-            final List<ODataEntity> entity = entitySet.getEntities();
-            assertNotNull(entity);
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
-    }
-
-    private void retreiveEntityTestWithSelect(ODataPubFormat reqFormat, String acceptFormat, String selectFormat) {
-        URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Customer").select(selectFormat);
-        ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        try {
-            ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-            assertEquals(200, res.getStatusCode());
-            ODataEntitySet entitySet = res.getBody();
-            assertNotNull(entitySet);
-            final List<ODataEntity> entity = entitySet.getEntities();
-            assertNotNull(entity);
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
-    }
-
-    private void retreiveEntityTestWithSelectAndExpand(
-            final ODataPubFormat reqFormat,
-            final String acceptFormat,
-            final String selectFormat,
-            final String expandFormat) {
-        URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntitySetSegment("Customer").appendKeySegment(-10).select(selectFormat).expand(expandFormat);
-        ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-        req.setFormat(reqFormat);
-        req.setAccept(acceptFormat);
-        try {
-            ODataRetrieveResponse<ODataEntity> res = req.execute();
-            assertEquals(200, res.getStatusCode());
-            ODataEntity entity = res.getBody();
-            assertNotNull(entity);
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
-    }
-
-    private void generalQuery(final ODataPubFormat format, final String acceptHeader, String query) {
-        final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntityTypeSegment(query);
-        final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(format);
-        req.setAccept(acceptHeader);
-        final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-        assertEquals(200, res.getStatusCode());
-        final ODataEntitySet entitySet = res.getBody();
-        assertNotNull(entitySet);
-    }
-
-    private void inlineCountTest(final ODataPubFormat format, final String acceptHeader, final String filterValue) {
-        final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
-                appendEntityTypeSegment("Customer").inlineCount().filter(filterValue);
-        final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-        req.setFormat(format);
-        req.setAccept(acceptHeader);
-        try {
-            final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
-            assertEquals(200, res.getStatusCode());
-            final ODataEntitySet entitySet = res.getBody();
-            assertNotNull(entitySet);
-            List<ODataEntity> entity = entitySet.getEntities();
-            for (int i = 0; i < entity.size(); i++) {
-                assertNotNull(entity.get(i));
-            }
-        } catch (ODataClientErrorException e) {
-            assertEquals(415, e.getStatusLine().getStatusCode());
-        }
-    }
-
-    @Test
-    public void inlineAndFilterTest() {
-        inlineCountTest(ODataPubFormat.ATOM, "application/atom+xml", "CustomerId eq -10");
-        inlineCountTest(ODataPubFormat.JSON, "application/json", "CustomerId eq -10");
-        inlineCountTest(ODataPubFormat.JSON_FULL_METADATA, "application/json;odata=fullmetadata", "CustomerId eq -10");
-        inlineCountTest(ODataPubFormat.JSON_NO_METADATA, "application/json;odata=nometadata", "CustomerId eq -10");
-
-        //xml headers is not a supported media type 
-        inlineCountTest(ODataPubFormat.ATOM, "application/xml", "CustomerId eq -10");
-
-        //with different filters
-        inlineCountTest(ODataPubFormat.ATOM, "application/atom+xml", "CustomerId lt -10");
-        inlineCountTest(ODataPubFormat.ATOM, "application/atom+xml", "CustomerId gt -10");
-    }
-
-    @Test
-    public void jsonHeader() {
-        retreiveEntityTest(ODataPubFormat.JSON, "application/json");
-        generalQuery(ODataPubFormat.JSON, "application/json", "Product");
-        retreiveEntityTestWithExpand(ODataPubFormat.JSON, "application/json", "Orders");
-        retreiveEntityTestWithSelect(ODataPubFormat.JSON, "application/json", "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(
-                ODataPubFormat.JSON, "application/json", "CustomerId,Name,Orders", "Orders");
-    }
-
-    @Test
-    public void jsonFullMetaDataHeader() {
-        retreiveFullMetadataEntityTest("application/json;odata=fullmetadata");
-        generalQuery(ODataPubFormat.JSON, "application/json;odata=fullmetadata", "Product");
-    }
-
-    @Test
-    public void jsonNoMetaDataHeader() {
-        retreiveNoMetadataEntityTest(ODataPubFormat.JSON_NO_METADATA, "application/json;odata=nometadata");
-    }
-
-    @Test
-    public void jsonMinimalMetadataDataHeader() {
-        retreiveMinimalMetadataEntityTest(ODataPubFormat.JSON, "application/json;odata=minimalmetadata");
-        retreiveEntityTestWithExpand(ODataPubFormat.JSON, "application/json;odata=minimalmetadata", "Orders");
-        retreiveEntityTestWithExpand(ODataPubFormat.JSON, "application/json;odata=minimalmetadata", "Orders,Info");
-    }
-
-    @Test
-    public void atomHeader() {
-        retreiveEntityTest(ODataPubFormat.ATOM, "application/atom+xml");
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, "application/atom+xml", "Orders");
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, "application/atom+xml", "Orders,Info");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/atom+xml", "CustomerId");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/atom+xml", "Name");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/atom+xml", "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(
-                ODataPubFormat.ATOM, "application/atom+xml", "CustomerId,Name,Orders", "Orders");
-    }
-
-    @Test
-    public void xmlHeader() {
-        retreiveEntityTest(ODataPubFormat.ATOM, "application/xml");
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, "application/xml", "Orders");
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, "application/xml", "Orders,Info");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/xml", "CustomerId");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/xml", "Name");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, "application/xml", "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(
-                ODataPubFormat.ATOM, "application/xml", "CustomerId,Name,Orders", "Orders");
-    }
-
-    @Test
-    public void nullFormat() {
-        retreiveEntityTest(null, "application/xml");
-        retreiveEntityTestWithExpand(null, "application/xml", "Orders");
-        retreiveEntityTestWithExpand(null, "application/xml", "Orders,Info");
-        retreiveEntityTestWithSelect(null, "application/xml", "CustomerId");
-        retreiveEntityTestWithSelect(null, "application/xml", "Name");
-        retreiveEntityTestWithSelect(null, "application/xml", "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(null, "application/xml", "CustomerId,Name,Orders", "Orders");
-    }
-
-    @Test
-    public void nullHeaderWithJSONFormat() {
-        retreiveEntityTest(ODataPubFormat.JSON, null);
-        retreiveEntityTestWithExpand(ODataPubFormat.JSON, null, "Orders");
-        retreiveEntityTestWithExpand(ODataPubFormat.JSON, null, "Orders,Info");
-        retreiveEntityTestWithSelect(ODataPubFormat.JSON, null, "CustomerId");
-        retreiveEntityTestWithSelect(ODataPubFormat.JSON, null, "Name");
-        retreiveEntityTestWithSelect(ODataPubFormat.JSON, null, "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(ODataPubFormat.JSON, null, "CustomerId,Name,Orders", "Orders");
-    }
-
-    @Test
-    public void nullHeaderWithAtomFormat() {
-        retreiveEntityTest(ODataPubFormat.ATOM, null);
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, null, "Orders");
-        retreiveEntityTestWithExpand(ODataPubFormat.ATOM, null, "Orders,Info");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, null, "CustomerId");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, null, "Name");
-        retreiveEntityTestWithSelect(ODataPubFormat.ATOM, null, "CustomerId,Name,PrimaryContactInfo");
-        retreiveEntityTestWithSelectAndExpand(ODataPubFormat.ATOM, null, "CustomerId,Name,Orders", "Orders");
-    }
-}