You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2016/08/12 10:03:16 UTC

[1/5] olingo-odata4 git commit: [OLINGO-1004] Delete ServiceDocumentTestITCase

Repository: olingo-odata4
Updated Branches:
  refs/heads/master ee60a793a -> 5f11f5b1d


[OLINGO-1004] Delete ServiceDocumentTestITCase

Duplicated in org.apache.olingo.fit.tecsvc.client.BasicITCase


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

Branch: refs/heads/master
Commit: 7d3cede1c1be496cbec52b916dd2865c6f8f379f
Parents: ee60a79
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 10:58:37 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 10:58:37 2016 +0200

----------------------------------------------------------------------
 .../fit/base/ServiceDocumentTestITCase.java     | 63 --------------------
 1 file changed, 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d3cede1/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java
deleted file mode 100644
index 10beb8b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java
+++ /dev/null
@@ -1,63 +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.base;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Test;
-
-public class ServiceDocumentTestITCase extends AbstractTestITCase {
-
-  private void retrieveServiceDocument(final ContentType contentType) {
-    final ODataServiceDocumentRequest req =
-        client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
-    req.setFormat(contentType);
-
-    final ODataRetrieveResponse<ClientServiceDocument> res = req.execute();
-    assertEquals(200, res.getStatusCode());
-
-    final ClientServiceDocument serviceDocument = res.getBody();
-    assertEquals(12, serviceDocument.getEntitySets().size());
-    assertEquals(6, serviceDocument.getSingletons().size());
-    assertEquals(6, serviceDocument.getFunctionImports().size());
-
-    assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
-        serviceDocument.getEntitySetURI("ProductDetails"));
-    assertEquals(URI.create(testStaticServiceRootURL + "/Boss"),
-        serviceDocument.getSingletonURI("Boss"));
-    assertEquals(URI.create(testStaticServiceRootURL + "/GetPerson"),
-        serviceDocument.getFunctionImportURI("GetPerson"));
-  }
-
-  @Test
-  public void retrieveServiceDocumentAsXML() {
-    retrieveServiceDocument(ContentType.APPLICATION_XML);
-  }
-
-  @Test
-  public void retrieveServiceDocumentAsJSON() {
-    retrieveServiceDocument(ContentType.JSON);
-  }
-}


[3/5] olingo-odata4 git commit: [OLINGO-1004] Deleted Complex Tests

Posted by ch...@apache.org.
[OLINGO-1004] Deleted Complex Tests

Duplicated in PrimitiveComplexITCase


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

Branch: refs/heads/master
Commit: bed8b4d02be15561f083abc22eb9f8e461c6de7a
Parents: af63c4f
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 11:53:17 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 11:53:17 2016 +0200

----------------------------------------------------------------------
 .../olingo/fit/base/PropertyTestITCase.java     | 121 -------------------
 1 file changed, 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bed8b4d0/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
index e16d9ea..525e5d5 100644
--- a/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
@@ -21,24 +21,12 @@ package org.apache.olingo.fit.base;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.io.IOException;
-
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
-import org.apache.olingo.client.api.communication.request.cud.UpdateType;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
-import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValuable;
 import org.apache.olingo.client.api.uri.URIBuilder;
 import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.http.HttpMethod;
 import org.junit.Test;
 
 public class PropertyTestITCase extends AbstractTestITCase {
@@ -99,113 +87,4 @@ public class PropertyTestITCase extends AbstractTestITCase {
   public void geospatialFromFullJSON() {
     geospatial(client, ContentType.JSON_FULL_METADATA);
   }
-
-  private void complex(final ODataClient client, final ContentType contentType) {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Customers").appendKeySegment(2).appendPropertySegment("HomeAddress");
-    final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
-        getPropertyRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    final ClientProperty prop = req.execute().getBody();
-    assertNotNull(prop);
-    // cast to workaround JDK 6 bug, fixed in JDK 7
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
-        ((ClientValuable) prop).getValue().getTypeName());
-  }
-
-  @Test
-  public void complexFromXML() {
-    complex(client, ContentType.APPLICATION_XML);
-  }
-
-  @Test
-  public void complexFromJSON() {
-    complex(edmClient, ContentType.JSON);
-  }
-
-  @Test
-  public void complexFromFullJSON() {
-    complex(client, ContentType.JSON_FULL_METADATA);
-  }
-
-  private void updateComplexProperty(final ContentType contentType, final UpdateType type)
-          throws IOException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Customers").appendKeySegment(1).appendPropertySegment("HomeAddress");
-
-    ODataPropertyRequest<ClientProperty> retrieveReq =
-        client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
-    retrieveReq.setFormat(contentType);
-
-    ODataRetrieveResponse<ClientProperty> retrieveRes = retrieveReq.execute();
-    assertEquals(200, retrieveRes.getStatusCode());
-    ClientProperty oldAddress = retrieveRes.getBody();
-
-    ClientProperty homeAddress = client.getObjectFactory().newComplexProperty("HomeAddress",
-        client.getObjectFactory().newComplexValue(retrieveRes.getBody().getComplexValue().getTypeName()));
-
-    final String cityName = "Pescara";
-    homeAddress.getComplexValue().add(client.getObjectFactory().
-        newPrimitiveProperty("City", client.getObjectFactory().newPrimitiveValueBuilder().buildString(cityName)));
-
-    final ODataPropertyUpdateRequest updateReq = client.getCUDRequestFactory().
-        getPropertyComplexValueUpdateRequest(uriBuilder.build(), type, homeAddress);
-    if (client.getConfiguration().isUseXHTTPMethod()) {
-      assertEquals(HttpMethod.POST, updateReq.getMethod());
-    } else {
-      assertEquals(type.getMethod(), updateReq.getMethod());
-    }
-    updateReq.setFormat(contentType);
-
-    final ODataPropertyUpdateResponse updateRes = updateReq.execute();
-    assertEquals(204, updateRes.getStatusCode());
-
-    retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
-    retrieveReq.setFormat(contentType);
-
-    retrieveRes = retrieveReq.execute();
-    assertEquals(200, retrieveRes.getStatusCode());
-
-    homeAddress = retrieveRes.getBody();
-    assertEquals(cityName, homeAddress.getComplexValue().get("City").getPrimitiveValue().toString());
-
-    //
-    final ODataPropertyUpdateRequest resetRequest = client.getCUDRequestFactory().
-            getPropertyComplexValueUpdateRequest(uriBuilder.build(), type, oldAddress);
-    assertEquals(204, resetRequest.execute().getStatusCode());
-  }
-
-  @Test
-  public void patchComplexPropertyAsJSON() throws IOException {
-    updateComplexProperty(ContentType.JSON_FULL_METADATA, UpdateType.PATCH);
-  }
-
-  @Test
-  public void createAndDelete() {
-    // 1. create
-    final ClientEntity category = client.getObjectFactory().newEntity(null);
-    category.setId(client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Categories").appendKeySegment(1).build());
-
-    final URIBuilder createBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
-        appendRefSegment();
-    final ODataEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().
-        getEntityCreateRequest(createBuilder.build(), category);
-
-    final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
-    assertEquals(204, createRes.getStatusCode());
-
-    // 2. delete
-    final URIBuilder deleteBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
-        appendKeySegment(1).appendRefSegment();
-    final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().
-        getDeleteRequest(deleteBuilder.build());
-
-    final ODataDeleteResponse deleteRes = deleteReq.execute();
-    assertEquals(204, deleteRes.getStatusCode());
-  }
-
 }


[2/5] olingo-odata4 git commit: [OLINGO-1004] Delete PropertyValueTestITCase

Posted by ch...@apache.org.
[OLINGO-1004] Delete PropertyValueTestITCase

Duplicated in PrimitiveComplexITCase


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

Branch: refs/heads/master
Commit: af63c4f08bf47087acb7393b7e3742c5342ddaa4
Parents: 7d3cede
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 11:47:06 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 11:47:06 2016 +0200

----------------------------------------------------------------------
 .../fit/base/PropertyValueTestITCase.java       | 138 -------------------
 .../tecsvc/client/PrimitiveComplexITCase.java   |  40 ++++++
 2 files changed, 40 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/af63c4f0/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java
deleted file mode 100644
index 12bc827..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java
+++ /dev/null
@@ -1,138 +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.base;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Test;
-
-public class PropertyValueTestITCase extends AbstractTestITCase {
-
-  @Test
-  public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    assertEquals("5", req.execute().getBody().toString());
-  }
-
-  @Test
-  public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    assertEquals("true", req.execute().getBody().toString());
-  }
-
-  @Test
-  public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    assertEquals("Peter", req.execute().getBody().toString());
-  }
-
-  @Test
-  public void retrieveDatePropertyValueTest() {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    final ClientPrimitiveValue property = req.execute().getBody();
-    assertEquals("2011-03-04T16:03:57Z", property.toString());
-  }
-
-  @Test
-  public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    final ClientPrimitiveValue property = req.execute().getBody();
-    assertEquals("179", property.toString());
-  }
-
-  @Test
-  public void retrieveBinaryPropertyValueTest() throws IOException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    final ClientPrimitiveValue property = req.execute().getBody();
-    assertEquals("fi653p3+MklA/LdoBlhWgnMTUUEo8tEgtbMXnF0a3CUNL9BZxXpSRiD9ebTnmNR0zWPjJ"
-        + "VIDx4tdmCnq55XrJh+RW9aI/b34wAogK3kcORw=", property.toString());
-  }
-
-  @Test(expected = ODataClientErrorException.class)
-  public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setAccept(ContentType.APPLICATION_ATOM_XML.toContentTypeString());
-    req.execute().getBody();
-  }
-
-  @Test(expected = ODataClientErrorException.class)
-  public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setAccept(ContentType.APPLICATION_XML.toContentTypeString());
-    req.execute().getBody();
-  }
-
-  @Test
-  public void retrieveCollectionPropertyValueTest() {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
-    final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
-        getPropertyRequest(uriBuilder.build());
-    req.setFormat(ContentType.APPLICATION_XML);
-    final ClientProperty property = req.execute().getBody();
-    // cast to workaround JDK 6 bug, fixed in JDK 7
-    assertTrue(((ClientValuable) property).getValue().isCollection());
-    assertEquals("555-555-5555", property.getCollectionValue().iterator().next().asPrimitive().toString());
-  }
-
-  @Test
-  public void retrieveNullPropertyValueTest() {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("HomeAddress");
-    final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
-    req.setFormat(ContentType.TEXT_PLAIN);
-    final ClientPrimitiveValue property = req.execute().getBody();
-    assertTrue(StringUtils.isBlank(property.toString()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/af63c4f0/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
index 4e71be9..3c19028 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
@@ -45,6 +45,8 @@ import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -440,4 +442,42 @@ public class PrimitiveComplexITCase extends AbstractParamTecSvcITCase {
     assertNotNull(value);
     assertEquals("3", value.toValue());
   }
+  
+  @Test
+  public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_URI).
+        appendEntitySetSegment("ESAllPrim").appendKeySegment(32767).appendPropertySegment("PropertyInt16");
+    final ODataValueRequest req = getClient().getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+    req.setFormat(ContentType.TEXT_PLAIN);
+    assertEquals("32767", req.execute().getBody().toString());
+  }
+
+  @Test
+  public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_URI).
+        appendEntitySetSegment("ESAllPrim").appendKeySegment(32767).appendPropertySegment("PropertyBoolean");
+    final ODataValueRequest req = getClient().getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+    req.setFormat(ContentType.TEXT_PLAIN);
+    assertEquals("true", req.execute().getBody().toString());
+  }
+
+  @Test
+  public void retrieveDatePropertyValueTest() {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_URI).
+        appendEntitySetSegment("ESAllPrim").appendKeySegment(32767).appendPropertySegment("PropertyDate");
+    final ODataValueRequest req = getClient().getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+    req.setFormat(ContentType.TEXT_PLAIN);
+    final ClientPrimitiveValue property = req.execute().getBody();
+    assertEquals("2012-12-03", property.toString());
+  }
+
+  @Test
+  public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_URI).
+        appendEntitySetSegment("ESAllPrim").appendKeySegment(32767).appendPropertySegment("PropertyDecimal");
+    final ODataValueRequest req = getClient().getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+    req.setFormat(ContentType.TEXT_PLAIN);
+    final ClientPrimitiveValue property = req.execute().getBody();
+    assertEquals("34", property.toString());
+  }
 }


[4/5] olingo-odata4 git commit: [OLINGO-1004] Deleted Entity Create Test

Posted by ch...@apache.org.
[OLINGO-1004] Deleted Entity Create Test

Duplicated in BasicITCase


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

Branch: refs/heads/master
Commit: 507e4deb5a588ede0cc3bce05d8a2537a59c1966
Parents: bed8b4d
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 11:55:42 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 11:55:42 2016 +0200

----------------------------------------------------------------------
 .../olingo/fit/base/EntityCreateTestITCase.java | 104 +------------------
 1 file changed, 5 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/507e4deb/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java
index 868c154..2993029 100644
--- a/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java
@@ -30,9 +30,6 @@ import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
 import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ContentType;
@@ -41,17 +38,15 @@ import org.junit.Test;
 public class EntityCreateTestITCase extends AbstractTestITCase {
 
   @Test
-  public void atomCreateAndDelete() {
-    createAndDeleteOrder(testStaticServiceRootURL, ContentType.APPLICATION_ATOM_XML, 1000);
+  public void atomOnContained() {
+    onContained(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
-  public void jsonCreateAndDelete() {
-    createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON, 1001);
-    createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON_NO_METADATA, 1001);
-    createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON_FULL_METADATA, 1001);
+  public void jsonOnContained() {
+    onContained(ContentType.JSON);
   }
-
+  
   private void onContained(final ContentType contentType) {
     final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Accounts").
         appendKeySegment(101).appendNavigationSegment("MyPaymentInstruments").build();
@@ -99,93 +94,4 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     final int sizeEnd = instruments.getCount();
     assertEquals(sizeBefore, sizeEnd);
   }
-
-  @Test
-  public void atomOnContained() {
-    onContained(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonOnContained() {
-    onContained(ContentType.JSON);
-  }
-
-  private void deepInsert(final ContentType contentType, final int productId, final int productDetailId)
-      throws EdmPrimitiveTypeException {
-
-    final ClientEntity product = getClient().getObjectFactory().
-        newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Latte")));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityPerUnit",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("100g Bag")));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("UnitPrice",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildSingle(3.24f)));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityInStock",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100)));
-    product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Discontinued",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildBoolean(false)));
-    product.getProperties().add(getClient().getObjectFactory().newEnumProperty("UserAccess",
-        getClient().getObjectFactory().
-        newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute")));
-    product.getProperties().add(getClient().getObjectFactory().newEnumProperty("SkinColor",
-        getClient().getObjectFactory().
-        newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
-    product.getProperties().add(getClient().getObjectFactory().newCollectionProperty("CoverColors",
-        getClient().getObjectFactory().
-        newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.Color")));
-    product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
-        newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Green"));
-    product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
-        newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Red"));
-
-    final ClientEntity detail = getClient().getObjectFactory().
-        newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"));
-    detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
-    detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductDetailID",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productDetailId)));
-    detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductName",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("LatteHQ")));
-    detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Description",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("High-Quality Milk")));
-
-    final ClientEntitySet details = getClient().getObjectFactory().newEntitySet();
-    details.getEntities().add(detail);
-
-    final ClientInlineEntitySet inlineDetails = getClient().getObjectFactory().
-        newDeepInsertEntitySet("Details", details);
-    product.addLink(inlineDetails);
-
-    final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
-        getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Products").build(), product);
-    req.setFormat(contentType);
-    final ODataEntityCreateResponse<ClientEntity> res = req.execute();
-    assertEquals(201, res.getStatusCode());
-
-    final ClientEntity createdProduct = res.getBody();
-    assertEquals(productId,
-        createdProduct.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
-    final ClientLink createdLink = createdProduct.getNavigationLink("Details");
-    assertNotNull(createdLink);
-
-    final ClientEntitySet createdProductDetails =
-        getClient().getRetrieveRequestFactory().getEntitySetRequest(createdLink.getLink()).execute().getBody();
-    assertNotNull(createdProductDetails);
-    assertEquals(productDetailId, createdProductDetails.getEntities().iterator().next().
-        getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class), 0);
-  }
-
-  @Test
-  public void atomDeepInsert() throws EdmPrimitiveTypeException {
-    deepInsert(ContentType.APPLICATION_ATOM_XML, 10, 10);
-  }
-
-  @Test
-  public void jsonDeepInsert() throws EdmPrimitiveTypeException {
-    deepInsert(ContentType.JSON_FULL_METADATA, 11, 11);
-  }
 }


[5/5] olingo-odata4 git commit: [OLINGO-1004] Delete some EntityRetrieve Tests

Posted by ch...@apache.org.
[OLINGO-1004] Delete some EntityRetrieve Tests

They are duplicated in BasicITCase and ExpandWithSystemQueryOptionsITCase


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

Branch: refs/heads/master
Commit: 5f11f5b1d2e738be12a07f057ffb14ebc1735828
Parents: 507e4de
Author: Christian Amend <ch...@sap.com>
Authored: Fri Aug 12 12:00:00 2016 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Fri Aug 12 12:00:00 2016 +0200

----------------------------------------------------------------------
 .../fit/base/EntityRetrieveTestITCase.java      | 279 -------------------
 1 file changed, 279 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5f11f5b1/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
index c353cdb..2a4c1d4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
@@ -20,33 +20,17 @@ package org.apache.olingo.fit.base;
 
 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 java.net.URI;
 import java.sql.Timestamp;
-import java.util.LinkedHashMap;
-import java.util.List;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.EdmEnabledODataClient;
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
-import org.apache.olingo.client.api.communication.response.ODataRawResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.data.ResWrap;
 import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntity;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
 import org.apache.olingo.client.api.domain.ClientLinkType;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.uri.URIBuilder;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -54,269 +38,6 @@ import org.junit.Test;
  */
 public class EntityRetrieveTestITCase extends AbstractTestITCase {
 
-  private void withInlineEntity(final ODataClient client, final ContentType contentType) {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
-    final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
-        getEntityRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    final ODataRetrieveResponse<ClientEntity> res = req.execute();
-    final ClientEntity entity = res.getBody();
-
-    assertNotNull(entity);
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-    assertTrue(entity.getProperty("Home").hasPrimitiveValue());
-    assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
-
-    // In JSON with minimal metadata, links are not provided
-    if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
-        || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML) 
-        || (contentType.isCompatible(ContentType.JSON) 
-              && ContentType.VALUE_ODATA_METADATA_FULL
-              .equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA)))) {
-      assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
-      assertEquals(3, entity.getNavigationLinks().size());
-
-      if (ContentType.APPLICATION_ATOM_XML == contentType) {
-        assertTrue(entity.getAssociationLinks().isEmpty());
-        // In JSON, association links for each $ref link will exist.
-      }
-
-      boolean found = false;
-
-      for (ClientLink link : entity.getNavigationLinks()) {
-        if (link instanceof ClientInlineEntity) {
-          final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
-          assertNotNull(inline);
-
-          final List<? extends ClientProperty> properties = inline.getProperties();
-          assertEquals(5, properties.size());
-
-          assertTrue(properties.get(0).getName().equals("CompanyID")
-              || properties.get(1).getName().equals("CompanyID")
-              || properties.get(2).getName().equals("CompanyID")
-              || properties.get(3).getName().equals("CompanyID")
-              || properties.get(4).getName().equals("CompanyID"));
-          assertTrue(properties.get(0).getValue().toString().equals("0")
-              || properties.get(1).getValue().toString().equals("0")
-              || properties.get(2).getValue().toString().equals("0")
-              || properties.get(3).getValue().toString().equals("0")
-              || properties.get(4).getValue().toString().equals("0"));
-
-          found = true;
-        }
-      }
-
-      assertTrue(found);
-    }
-  }
-
-  @Ignore
-  @Test
-  public void withInlineEntityFromAtom() {
-    withInlineEntity(client, ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void withInlineEntityFromFullJSON() {
-    withInlineEntity(client, ContentType.JSON_FULL_METADATA);
-  }
-
-  @Test
-  public void withInlineEntityFromJSON() {
-    withInlineEntity(edmClient, ContentType.JSON);
-  }
-
-  private void withInlineEntitySet(final ODataClient client, final ContentType contentType) {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
-
-    final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
-        getEntityRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    final ODataRetrieveResponse<ClientEntity> res = req.execute();
-    final ClientEntity entity = res.getBody();
-    assertNotNull(entity);
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-
-    // In JSON with minimal metadata, links are not provided
-    if (contentType.equals(ContentType.APPLICATION_ATOM_XML) || contentType.equals(ContentType.JSON_FULL_METADATA)) {
-      boolean found = false;
-      for (ClientLink link : entity.getNavigationLinks()) {
-        if (link instanceof ClientInlineEntitySet) {
-          final ClientEntitySet inline = ((ClientInlineEntitySet) link).getEntitySet();
-          assertNotNull(inline);
-
-          found = true;
-        }
-      }
-      assertTrue(found);
-    }
-  }
-
-  @Ignore
-  @Test
-  public void withInlineEntitySetFromAtom() {
-    withInlineEntitySet(client, ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void withInlineEntitySetFromFullJSON() {
-    withInlineEntitySet(client, ContentType.JSON_FULL_METADATA);
-  }
-
-  @Test
-  public void withInlineEntitySetFromJSON() {
-    withInlineEntitySet(edmClient, ContentType.JSON);
-  }
-
-  private void rawRequest(final ContentType contentType) {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("People").appendKeySegment(5);
-
-    final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
-    req.setFormat(contentType.toContentTypeString());
-
-    final ODataRawResponse res = req.execute();
-    assertNotNull(res);
-
-    final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
-    assertNull(entitySet);
-
-    final ResWrap<ClientEntity> entity = res.getBodyAs(ClientEntity.class);
-    assertTrue(entity.getPayload().getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/People(5)"));
-  }
-
-  @Test
-  public void rawRequestAsAtom() {
-    rawRequest(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void rawRequestAsJSON() {
-    // this needs to be full, otherwise reference will not be provided
-    rawRequest(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void multiKey(final ContentType contentType) throws EdmPrimitiveTypeException {
-    final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
-    multiKey.put("ProductID", "6");
-    multiKey.put("ProductDetailID", 1);
-
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
-
-    final ODataEntityRequest<ClientEntity> req =
-        client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    final ODataRetrieveResponse<ClientEntity> res = req.execute();
-    final ClientEntity entity = res.getBody();
-    assertNotNull(entity);
-    assertEquals(Integer.valueOf(1),
-        entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class));
-  }
-
-  @Test
-  public void multiKeyAsAtom() throws EdmPrimitiveTypeException {
-    multiKey(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
-    multiKey(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void checkForETag(final ODataClient client, final ContentType contentType) {
-    final URIBuilder uriBuilder =
-        client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
-
-    final ODataEntityRequest<ClientEntity> req =
-        client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    final ODataRetrieveResponse<ClientEntity> res = req.execute();
-    assertEquals(200, res.getStatusCode());
-
-    final String etag = res.getETag();
-    assertTrue(StringUtils.isNotBlank(etag));
-
-    final ClientEntity order = res.getBody();
-    assertEquals(etag, order.getETag());
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
-    assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
-    assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
-    assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
-    assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
-  }
-
-  @Test
-  public void checkForETagAsAtom() {
-    checkForETag(client, ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void checkForETagAsFullJSON() {
-    checkForETag(client, ContentType.JSON_FULL_METADATA);
-  }
-
-  @Test
-  public void checkForETagAsJSON() {
-    checkForETag(edmClient, ContentType.JSON);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void issue99() {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
-
-    final ODataEntityRequest<ClientEntity> req =
-        client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-    req.setFormat(ContentType.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();
-  }
-
-  private void reference(final ContentType contentType) {
-    final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
-        appendRefSegment();
-
-    ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-    req.setFormat(contentType);
-
-    ODataRetrieveResponse<ClientEntity> res = req.execute();
-    assertNotNull(res);
-
-    final ClientEntity entity = res.getBody();
-    assertNotNull(entity);
-    assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
-
-    final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL).
-        appendEntityIdSegment(entity.getId().toASCIIString()).build();
-
-    req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
-    req.setFormat(contentType);
-
-    res = req.execute();
-    assertNotNull(res);
-    assertNotNull(res.getBody());
-  }
-
-  @Test
-  public void atomReference() {
-    reference(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonReference() {
-    reference(ContentType.JSON_FULL_METADATA);
-  }
-
   private void contained(final ODataClient client, final ContentType contentType) throws EdmPrimitiveTypeException {
     final URI uri = client.newURIBuilder(testStaticServiceRootURL).
         appendEntitySetSegment("Accounts").appendKeySegment(101).