You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/04/30 17:02:49 UTC
[36/50] [abbrv] olingo-odata4 git commit: [OLINGO-564] Renamed
'OData*' to 'Client*' classes
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
index e55a9f1..629f856 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
@@ -27,9 +27,9 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataValuable;
+import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.commons.api.domain.ClientEntitySet;
+import org.apache.olingo.commons.api.domain.ClientValuable;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -47,97 +47,98 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase {
@AfterClass
public static void tearDownAfterClass() throws Exception {
- //no teardown needed
+ // no teardown needed
}
@Test
public void testSimpleOrderBy() {
- ODataRetrieveResponse<ODataEntitySet> response = null;
+ ODataRetrieveResponse<ClientEntitySet> response = null;
response = sendRequest(ES_ALL_PRIM, "PropertyDate");
assertEquals(3, response.getBody().getEntities().size());
- ODataEntity oDataEntity = response.getBody().getEntities().get(0);
- assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ ClientEntity clientEntity = response.getBody().getEntities().get(0);
+ assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(1);
- assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(1);
+ assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(2);
- assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(2);
+ assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
}
@Test
public void testSimpleOrderByDecending() {
- ODataRetrieveResponse<ODataEntitySet> response = null;
+ ODataRetrieveResponse<ClientEntitySet> response = null;
response = sendRequest(ES_ALL_PRIM, "PropertyDate desc");
assertEquals(3, response.getBody().getEntities().size());
- ODataEntity oDataEntity = response.getBody().getEntities().get(0);
- assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ ClientEntity clientEntity = response.getBody().getEntities().get(0);
+ assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(1);
- assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(1);
+ assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(2);
- assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(2);
+ assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
}
@Test
public void testMultipleOrderBy() {
- final ODataRetrieveResponse<ODataEntitySet> response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16");
+ final ODataRetrieveResponse<ClientEntitySet> response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16");
assertEquals(3, response.getBody().getEntities().size());
- ODataEntity oDataEntity = response.getBody().getEntities().get(0);
- assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ ClientEntity clientEntity = response.getBody().getEntities().get(0);
+ assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(1);
- assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(1);
+ assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(2);
- assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(2);
+ assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
}
@Test
public void testMultipleOrderByDecending() {
- final ODataRetrieveResponse<ODataEntitySet> response = sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16 desc");
+ final ODataRetrieveResponse<ClientEntitySet> response =
+ sendRequest(ES_ALL_PRIM, "PropertyByte, PropertyInt16 desc");
assertEquals(3, response.getBody().getEntities().size());
- ODataEntity oDataEntity = response.getBody().getEntities().get(0);
- assertEquals("0", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ ClientEntity clientEntity = response.getBody().getEntities().get(0);
+ assertEquals("0", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(1);
- assertEquals("-32768", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(1);
+ assertEquals("-32768", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(2);
- assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(2);
+ assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
}
@Test
public void testOrderByWithNull() {
- final ODataRetrieveResponse<ODataEntitySet> response = sendRequest(ES_TWO_PRIM, "PropertyString");
+ final ODataRetrieveResponse<ClientEntitySet> response = sendRequest(ES_TWO_PRIM, "PropertyString");
assertEquals(4, response.getBody().getEntities().size());
- ODataEntity oDataEntity = response.getBody().getEntities().get(0);
- assertEquals("-32766", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ ClientEntity clientEntity = response.getBody().getEntities().get(0);
+ assertEquals("-32766", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(1);
- assertEquals("32766", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(1);
+ assertEquals("32766", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(2);
- assertEquals("-365", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(2);
+ assertEquals("-365", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
- oDataEntity = response.getBody().getEntities().get(3);
- assertEquals("32767", ((ODataValuable) oDataEntity.getProperty("PropertyInt16")).getValue().toString());
+ clientEntity = response.getBody().getEntities().get(3);
+ assertEquals("32767", ((ClientValuable) clientEntity.getProperty("PropertyInt16")).getValue().toString());
}
@Test
public void testOrderByInvalidExpression() {
- fail(ES_TWO_PRIM, "PropertyString add 10", HttpStatusCode.BAD_REQUEST);
+ fail(ES_TWO_PRIM, "PropertyString add 10", HttpStatusCode.BAD_REQUEST);
}
- private ODataRetrieveResponse<ODataEntitySet> sendRequest(String entitySet, String orderByString) {
+ private ODataRetrieveResponse<ClientEntitySet> sendRequest(String entitySet, String orderByString) {
final ODataClient client = getClient();
final URI uri =
@@ -146,7 +147,7 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase {
.orderBy(orderByString)
.build();
- ODataEntitySetRequest<ODataEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
return request.execute();
}
@@ -159,7 +160,7 @@ public class OrderBySystemQueryITCase extends AbstractBaseTestITCase {
assertEquals(errorCode.getStatusCode(), e.getStatusLine().getStatusCode());
}
}
-
+
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/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 253b482..892cdd5 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
@@ -1,18 +1,18 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -36,8 +36,8 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataValueReq
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ClientProperty;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
@@ -52,20 +52,20 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
@Test
public void readSimpleProperty() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESTwoPrim")
.appendKeySegment(32766)
.appendPropertySegment("PropertyString")
.build());
-
+
assertNotNull(request);
- ODataRetrieveResponse<ODataProperty> response = request.execute();
+ ODataRetrieveResponse<ClientProperty> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
- final ODataProperty property = response.getBody();
+ final ClientProperty property = response.getBody();
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
assertEquals("Test String1", property.getPrimitiveValue().toValue());
@@ -73,18 +73,18 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
@Test
public void readSimplePropertyContextURL() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESTwoPrim")
.appendKeySegment(32766)
.appendPropertySegment("PropertyString")
.build());
- ODataRetrieveResponse<ODataProperty> response = request.execute();
- String expectedResult =
+ ODataRetrieveResponse<ClientProperty> response = request.execute();
+ String expectedResult =
"{\"@odata.context\":\"$metadata#ESTwoPrim(32766)/PropertyString\"," +
- "\"value\":\"Test String1\"}";
- assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8"));
- }
+ "\"value\":\"Test String1\"}";
+ assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8"));
+ }
@Test
public void deletePrimitive() throws Exception {
@@ -97,7 +97,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
// Check that the property is really gone.
// This check has to be in the same session in order to access the same data provider.
- ODataPropertyRequest<ODataProperty> propertyRequest = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> propertyRequest = getClient().getRetrieveRequestFactory()
.getPropertyRequest(uri);
propertyRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), propertyRequest.execute().getStatusCode());
@@ -122,12 +122,12 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
// Check that the property is not gone but empty now.
// This check has to be in the same session in order to access the same data provider.
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(uri);
request.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
- final ODataRetrieveResponse<ODataProperty> propertyResponse = request.execute();
+ final ODataRetrieveResponse<ClientProperty> propertyResponse = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), propertyResponse.getStatusCode());
- final ODataProperty property = propertyResponse.getBody();
+ final ClientProperty property = propertyResponse.getBody();
assertNotNull(property);
assertNotNull(property.getCollectionValue());
assertTrue(property.getCollectionValue().isEmpty());
@@ -135,36 +135,36 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
@Test
public void readComplexProperty() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESMixPrimCollComp")
.appendKeySegment(7)
.appendPropertySegment("PropertyComp")
- .build());
- ODataRetrieveResponse<ODataProperty> response = request.execute();
+ .build());
+ ODataRetrieveResponse<ClientProperty> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
- final ODataProperty property = response.getBody();
+ final ClientProperty property = response.getBody();
assertNotNull(property);
assertNotNull(property.getComplexValue());
- assertEquals("TEST B", property.getComplexValue().get("PropertyString").getPrimitiveValue().toValue());
- }
+ assertEquals("TEST B", property.getComplexValue().get("PropertyString").getPrimitiveValue().toValue());
+ }
@Test
public void readComplexPropertyContextURL() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESMixPrimCollComp")
.appendKeySegment(7)
.appendPropertySegment("PropertyComp")
- .build());
- ODataRetrieveResponse<ODataProperty> response = request.execute();
- String expectedResult =
+ .build());
+ ODataRetrieveResponse<ClientProperty> response = request.execute();
+ String expectedResult =
"{\"@odata.context\":\"$metadata#ESMixPrimCollComp(7)/PropertyComp\"," +
- "\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}";
- assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8"));
- }
+ "\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}";
+ assertEquals(expectedResult, IOUtils.toString(response.getRawResponse(), "UTF-8"));
+ }
@Test
public void deleteComplex() throws Exception {
@@ -177,7 +177,7 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
// Check that the property is really gone.
// This check has to be in the same session in order to access the same data provider.
- ODataPropertyRequest<ODataProperty> propertyRequest = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> propertyRequest = getClient().getRetrieveRequestFactory()
.getPropertyRequest(uri);
propertyRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), propertyRequest.execute().getStatusCode());
@@ -185,15 +185,15 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
@Test
public void readUnknownProperty() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESTwoPrim")
.appendKeySegment(32766)
.appendPropertySegment("Unknown")
.build());
try {
- request.execute();
- fail("Expected exception not thrown!");
+ request.execute();
+ fail("Expected exception not thrown!");
} catch (final ODataClientErrorException e) {
assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode());
}
@@ -201,15 +201,15 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
@Test
public void readNoContentProperty() throws Exception {
- ODataPropertyRequest<ODataProperty> request = getClient().getRetrieveRequestFactory()
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
.getPropertyRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESTwoPrim")
.appendKeySegment(-32766)
.appendPropertySegment("PropertyString")
- .build());
- ODataRetrieveResponse<ODataProperty> response = request.execute();
+ .build());
+ ODataRetrieveResponse<ClientProperty> response = request.execute();
assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
- }
+ }
@Test
public void readPropertyValue() throws Exception {
@@ -220,9 +220,9 @@ public class PrimitiveComplexITCase extends AbstractBaseTestITCase {
.appendPropertySegment("PropertyString")
.appendValueSegment()
.build());
- ODataRetrieveResponse<ODataPrimitiveValue> response = request.execute();
+ ODataRetrieveResponse<ClientPrimitiveValue> response = request.execute();
assertEquals("Test String1", response.getBody().toValue());
- }
+ }
@Override
protected ODataClient getClient() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
index d014086..995925b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.commons.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -50,7 +50,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.COUNT, "true")
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -66,7 +66,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.COUNT, "true")
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -82,14 +82,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.TOP, new Integer(5).toString())
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
assertEquals(5, response.getBody().getEntities().size());
for (int i = 0; i < 5; i++) {
- ODataEntity entity = response.getBody().getEntities().get(i);
+ ClientEntity entity = response.getBody().getEntities().get(i);
assertEquals(new Integer(i + 1).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString());
}
}
@@ -102,14 +102,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.SKIP, new Integer(5).toString())
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
assertEquals(10, response.getBody().getEntities().size());
for (int i = 0; i < 10; i++) {
- ODataEntity entity = response.getBody().getEntities().get(i);
+ ClientEntity entity = response.getBody().getEntities().get(i);
assertEquals(new Integer(i + 6).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString());
}
}
@@ -123,7 +123,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.SKIP, new Integer(503).toString())
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -138,7 +138,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.SKIP, new Integer(10000).toString())
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -157,7 +157,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.TOP, new Integer(43).toString()) // 102, 101, ...., 59
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -168,7 +168,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
// Check first 10 entities
for (int i = 0; i < 10; i++) {
- ODataEntity entity = response.getBody().getEntities().get(i);
+ ClientEntity entity = response.getBody().getEntities().get(i);
assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString());
id--;
}
@@ -179,7 +179,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
assertEquals(Integer.valueOf(105), response.getBody().getCount());
assertEquals(10, response.getBody().getEntities().size());
for (int i = 0; i < 10; i++) {
- ODataEntity entity = response.getBody().getEntities().get(i);
+ ClientEntity entity = response.getBody().getEntities().get(i);
assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString());
id--;
}
@@ -190,7 +190,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
assertEquals(Integer.valueOf(105), response.getBody().getCount());
assertEquals(3, response.getBody().getEntities().size());
for (int i = 0; i < 3; i++) {
- ODataEntity entity = response.getBody().getEntities().get(i);
+ ClientEntity entity = response.getBody().getEntities().get(i);
assertEquals(new Integer(id).toString(), entity.getProperty(PROPERTY_INT16).getValue().toString());
id--;
}
@@ -206,7 +206,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.appendEntitySetSegment(ES_SERVER_SIDE_PAGING)
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -233,7 +233,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.COUNT, Boolean.TRUE.toString())
.build();
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
@@ -241,7 +241,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
URI nextLink = response.getBody().getNext();
assertEquals("http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken=1",
nextLink.toASCIIString());
-
+
int token = 1;
while (nextLink != null) {
token++;
@@ -252,13 +252,14 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.execute();
nextLink = response.getBody().getNext();
- if(nextLink != null) {
- assertEquals(
- "http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken=" + token,
- nextLink.toASCIIString());
+ if (nextLink != null) {
+ assertEquals(
+ "http://localhost:9080/odata-server-tecsvc/odata.svc/ESServerSidePaging?%24count=true&%24skiptoken="
+ + token,
+ nextLink.toASCIIString());
}
}
-
+
assertEquals(50 + 1, token);
}
@@ -272,7 +273,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.build();
try {
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
fail();
@@ -290,7 +291,7 @@ public class SystemQueryOptionITCase extends AbstractBaseTestITCase {
.addQueryOption(QueryOption.TOP, new Integer(-5).toString())
.build();
try {
- ODataRetrieveResponse<ODataEntitySet> response = client.getRetrieveRequestFactory()
+ ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
.getEntitySetRequest(uri)
.execute();
fail();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
index 7b83811..8a4bcdc 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
@@ -1,18 +1,18 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -26,15 +26,15 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.ClientCollectionValue;
+import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.commons.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.domain.ODataEntityImpl;
+import org.apache.olingo.commons.core.domain.ClientEntityImpl;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.junit.BeforeClass;
@@ -98,12 +98,12 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
return client;
}
- protected ODataEntity read(final ODataFormat format, final URI editLink) {
- final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
+ protected ClientEntity read(final ODataFormat format, final URI editLink) {
+ final ODataEntityRequest<ClientEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
assertNotNull(entity);
@@ -115,57 +115,57 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
}
protected void createAndDeleteOrder(final String serviceRoot, final ODataFormat format, final int id) {
- final ODataEntity order = new ODataEntityImpl(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+ final ClientEntity order = new ClientEntityImpl(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
- final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
+ final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
order.getProperties().add(orderId);
Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
dateTime.set(2011, 2, 4, 16, 3, 57);
- final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder()
+ final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder()
.setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
order.getProperties().add(orderDate);
- final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
+ final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setValue(BigDecimal.TEN.scaleByPowerOfTen(7)).build());
order.getProperties().add(shelfLife);
- final ODataCollectionValue<ODataValue> orderShelfLifesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Duration)");
+ final ClientCollectionValue<ClientValue> orderShelfLifesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Duration)");
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
- final ODataProperty orderShelfLifes = getClient().getObjectFactory().
- newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
+ final ClientProperty orderShelfLifes = getClient().getObjectFactory().
+ newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
order.getProperties().add(orderShelfLifes);
- final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
- getClient().newURIBuilder(serviceRoot).
+ final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().newURIBuilder(serviceRoot).
appendEntitySetSegment("Orders").build(), order);
req.setFormat(format);
- final ODataEntity created = req.execute().getBody();
+ final ClientEntity created = req.execute().getBody();
assertNotNull(created);
assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
- if(format == ODataFormat.JSON_NO_METADATA) {
+ if (format == ODataFormat.JSON_NO_METADATA) {
assertEquals(0, created.getNavigationLinks().size());
assertNull(created.getEditLink());
- } else if(format == ODataFormat.JSON_FULL_METADATA) {
+ } else if (format == ODataFormat.JSON_FULL_METADATA) {
assertEquals(3, created.getNavigationLinks().size());
assertThat(created.getTypeName().getNamespace(), is("Microsoft.Test.OData.Services.ODataWCFService"));
assertThat(created.getEditLink().toASCIIString(), startsWith("http://localhost:9080/stub/StaticService"));
- } else if(format == ODataFormat.JSON || format == ODataFormat.APPLICATION_JSON) {
+ } else if (format == ODataFormat.JSON || format == ODataFormat.APPLICATION_JSON) {
assertEquals(0, created.getNavigationLinks().size());
assertNull(created.getEditLink());
}
final URI deleteURI = getClient().newURIBuilder(serviceRoot).
- appendEntitySetSegment("Orders").appendKeySegment(id).build();
+ appendEntitySetSegment("Orders").appendKeySegment(id).build();
final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
final ODataDeleteResponse deleteRes = deleteReq.execute();
assertEquals(204, deleteRes.getStatusCode());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
index 1008de9..3e9a85f 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
@@ -1,18 +1,18 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -24,11 +24,11 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.commons.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.domain.ClientEntitySet;
+import org.apache.olingo.commons.api.domain.ClientInlineEntity;
+import org.apache.olingo.commons.api.domain.ClientLink;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.junit.Test;
@@ -48,7 +48,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
public void clientAsync() throws InterruptedException, ExecutionException {
final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customers");
- final Future<ODataRetrieveResponse<ODataEntitySet>> futureRes =
+ final Future<ODataRetrieveResponse<ClientEntitySet>> futureRes =
client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute();
assertNotNull(futureRes);
@@ -56,7 +56,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
Thread.sleep(1000L);
}
- final ODataRetrieveResponse<ODataEntitySet> res = futureRes.get();
+ final ODataRetrieveResponse<ClientEntitySet> res = futureRes.get();
assertNotNull(res);
assertEquals(200, res.getStatusCode());
assertFalse(res.getBody().getEntities().isEmpty());
@@ -66,18 +66,19 @@ public class AsyncTestITCase extends AbstractTestITCase {
final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
- final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
- final AsyncRequestWrapper<ODataRetrieveResponse<ODataEntity>> async =
- client.getAsyncRequestFactory().<ODataRetrieveResponse<ODataEntity>> getAsyncRequestWrapper(req);
+ final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntity>> async =
+ client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntity>> getAsyncRequestWrapper(req);
- final AsyncResponseWrapper<ODataRetrieveResponse<ODataEntity>> responseWrapper = async.execute();
+ final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntity>> responseWrapper = async.execute();
assertFalse(responseWrapper.isPreferenceApplied());
- final ODataRetrieveResponse<ODataEntity> res = responseWrapper.getODataResponse();
- final ODataEntity entity = res.getBody();
+ final ODataRetrieveResponse<ClientEntity> res = responseWrapper.getODataResponse();
+ final ClientEntity entity = res.getBody();
assertNotNull(entity);
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
@@ -92,12 +93,12 @@ public class AsyncTestITCase extends AbstractTestITCase {
boolean found = false;
- for (ODataLink link : entity.getNavigationLinks()) {
- if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ for (ClientLink link : entity.getNavigationLinks()) {
+ if (link instanceof ClientInlineEntity) {
+ final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
assertNotNull(inline);
- final List<? extends ODataProperty> properties = inline.getProperties();
+ final List<? extends ClientProperty> properties = inline.getProperties();
assertEquals(5, properties.size());
assertTrue(properties.get(0).getName().equals("CompanyID")
@@ -133,21 +134,21 @@ public class AsyncTestITCase extends AbstractTestITCase {
final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("async").appendEntitySetSegment("Orders");
- final ODataEntitySetRequest<ODataEntitySet> req =
+ final ODataEntitySetRequest<ClientEntitySet> req =
client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
- final AsyncRequestWrapper<ODataRetrieveResponse<ODataEntitySet>> async =
- client.getAsyncRequestFactory().<ODataRetrieveResponse<ODataEntitySet>> getAsyncRequestWrapper(req);
+ final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntitySet>> async =
+ client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntitySet>> getAsyncRequestWrapper(req);
async.callback(URI.create("http://client.service.it/callback/endpoint"));
- final AsyncResponseWrapper<ODataRetrieveResponse<ODataEntitySet>> responseWrapper = async.execute();
+ final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntitySet>> responseWrapper = async.execute();
assertTrue(responseWrapper.isPreferenceApplied());
assertTrue(responseWrapper.isDone());
- final ODataRetrieveResponse<ODataEntitySet> res = responseWrapper.getODataResponse();
- final ODataEntitySet entitySet = res.getBody();
+ final ODataRetrieveResponse<ClientEntitySet> res = responseWrapper.getODataResponse();
+ final ClientEntitySet entitySet = res.getBody();
assertFalse(entitySet.getEntities().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java
index 53a4106..a76e97a 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java
@@ -1,18 +1,18 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -31,7 +31,7 @@ import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ClientEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
@@ -83,7 +83,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase {
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
// create new request
- ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataFormat.JSON);
streamManager.addRequest(queryReq);
@@ -98,7 +98,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase {
targetURI = client.newURIBuilder(baseURL).appendEntitySetSegment("Customers").appendKeySegment(1);
final URI editLink = targetURI.build();
- final ODataEntity patch = client.getObjectFactory().newEntity(
+ final ClientEntity patch = client.getObjectFactory().newEntity(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
patch.setEditLink(editLink);
@@ -106,7 +106,7 @@ public class AuthBatchTestITCase extends AbstractTestITCase {
"LastName",
client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
- final ODataEntityUpdateRequest<ODataEntity> changeReq =
+ final ODataEntityUpdateRequest<ClientEntity> changeReq =
client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
changeReq.setFormat(ODataFormat.JSON_FULL_METADATA);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
index be26830..880dd95 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
@@ -1,18 +1,18 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -46,8 +46,8 @@ import org.apache.olingo.client.core.communication.request.batch.ODataSingleResp
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ClientEntity;
+import org.apache.olingo.commons.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -122,7 +122,7 @@ public class BatchTestITCase extends AbstractTestITCase {
final ODataChangeset changeset = payload.addChangeset();
URIBuilder targetURI;
- ODataEntityCreateRequest<ODataEntity> createReq;
+ ODataEntityCreateRequest<ClientEntity> createReq;
targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
for (int i = 1; i <= 2; i++) {
@@ -158,7 +158,7 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(404, res.getStatusCode());
assertEquals("Not Found", res.getStatusMessage());
assertEquals(Integer.valueOf(3), Integer.valueOf(
- res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next()));
+ res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next()));
assertFalse(retitem.hasNext());
assertFalse(iter.hasNext());
@@ -192,7 +192,7 @@ public class BatchTestITCase extends AbstractTestITCase {
targetURI.appendEntitySetSegment("UnexistingEntitySet").appendKeySegment(1);
// create new request
- ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataFormat.JSON);
streamManager.addRequest(queryReq);
@@ -247,13 +247,13 @@ public class BatchTestITCase extends AbstractTestITCase {
final BatchManager streamManager = request.payloadManager();
final ODataChangeset changeset = streamManager.addChangeset();
- ODataEntity order = newOrder(20);
+ ClientEntity order = newOrder(20);
final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
// add create request
- final ODataEntityCreateRequest<ODataEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order);
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order);
changeset.addRequest(createReq);
@@ -261,10 +261,10 @@ public class BatchTestITCase extends AbstractTestITCase {
int createRequestRef = changeset.getLastContentId();
// add update request: link CustomerInfo(17) to the new customer
- final ODataEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
+ final ClientEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink(
- "OrderDetails",
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
+ "OrderDetails",
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
appendKeySegment(new HashMap<String, Object>() {
private static final long serialVersionUID = 3109256773218160485L;
@@ -274,8 +274,8 @@ public class BatchTestITCase extends AbstractTestITCase {
}
}).build()));
- final ODataEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
- URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
+ final ODataEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
+ URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
changeset.addRequest(updateReq);
@@ -295,12 +295,12 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(201, res.getStatusCode());
assertTrue(res instanceof ODataEntityCreateResponse);
- order = ((ODataEntityCreateResponse<ODataEntity>) res).getBody();
- final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails"));
+ order = ((ODataEntityCreateResponse<ClientEntity>) res).getBody();
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails"));
assertEquals(Integer.valueOf(7),
- req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue().
+ req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue().
toCastValue(Integer.class));
res = chgitem.next();
@@ -309,13 +309,13 @@ public class BatchTestITCase extends AbstractTestITCase {
// clean ...
assertEquals(204, client.getCUDRequestFactory().getDeleteRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute().
- getStatusCode());
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute().
+ getStatusCode());
try {
client.getRetrieveRequestFactory().getEntityRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).
- execute().getBody();
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).
+ execute().getBody();
fail();
} catch (Exception e) {
// ignore
@@ -336,10 +336,10 @@ public class BatchTestITCase extends AbstractTestITCase {
// prepare URI
URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
- expand("Orders").select("PersonID,Orders/OrderID");
+ expand("Orders").select("PersonID,Orders/OrderID");
// create new request
- ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataFormat.JSON);
streamManager.addRequest(queryReq);
@@ -350,9 +350,9 @@ public class BatchTestITCase extends AbstractTestITCase {
// -------------------------------------------
// prepare URI
targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- final ODataEntity original = newOrder(2000);
- final ODataEntityCreateRequest<ODataEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
+ final ClientEntity original = newOrder(2000);
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
createReq.setFormat(ODataFormat.JSON);
streamManager.addRequest(createReq);
// -------------------------------------------
@@ -382,15 +382,15 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(201, res.getStatusCode());
assertEquals("Created", res.getStatusMessage());
- final ODataEntityCreateResponse<ODataEntity> entres = (ODataEntityCreateResponse<ODataEntity>) res;
- final ODataEntity entity = entres.getBody();
+ final ODataEntityCreateResponse<ClientEntity> entres = (ODataEntityCreateResponse<ClientEntity>) res;
+ final ClientEntity entity = entres.getBody();
assertEquals(2000, entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class).intValue());
assertFalse(iter.hasNext());
}
@Test
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public void batchRequest() throws EdmPrimitiveTypeException {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
@@ -406,7 +406,7 @@ public class BatchTestITCase extends AbstractTestITCase {
targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
// create new request
- ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataFormat.JSON);
streamManager.addRequest(queryReq);
@@ -421,25 +421,25 @@ public class BatchTestITCase extends AbstractTestITCase {
targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
final URI editLink = targetURI.build();
- final ODataEntity patch = client.getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ final ClientEntity patch = client.getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
patch.setEditLink(editLink);
patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
- "LastName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
+ "LastName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
- final ODataEntityUpdateRequest<ODataEntity> changeReq =
- client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
+ final ODataEntityUpdateRequest<ClientEntity> changeReq =
+ client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
changeReq.setFormat(ODataFormat.JSON_FULL_METADATA);
changeset.addRequest(changeReq);
// Create Order into the changeset
targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- final ODataEntity original = newOrder(1000);
- final ODataEntityCreateRequest<ODataEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
+ final ClientEntity original = newOrder(1000);
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
createReq.setFormat(ODataFormat.JSON);
changeset.addRequest(createReq);
// -------------------------------------------
@@ -471,10 +471,10 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(200, res.getStatusCode());
assertEquals("OK", res.getStatusMessage());
- ODataEntityRequestImpl<ODataEntity>.ODataEntityResponseImpl entres =
- (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
+ ODataEntityRequestImpl<ClientEntity>.ODataEntityResponseImpl entres =
+ (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
- ODataEntity entity = entres.getBody();
+ ClientEntity entity = entres.getBody();
assertEquals(1, entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
// retrieve the second item (ODataChangeset)
@@ -492,7 +492,7 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(201, res.getStatusCode());
assertEquals("Created", res.getStatusMessage());
- final ODataEntityCreateResponse<ODataEntity> createres = (ODataEntityCreateResponse<ODataEntity>) res;
+ final ODataEntityCreateResponse<ClientEntity> createres = (ODataEntityCreateResponse<ClientEntity>) res;
entity = createres.getBody();
assertEquals(new Integer(1000), entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class));
@@ -517,7 +517,7 @@ public class BatchTestITCase extends AbstractTestITCase {
public void async() {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(
- URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString());
+ URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString());
request.setAccept(ACCEPT);
final AsyncBatchRequestWrapper async = client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request);
@@ -530,7 +530,7 @@ public class BatchTestITCase extends AbstractTestITCase {
targetURI.appendEntitySetSegment("People").appendKeySegment(5);
// create new request
- ODataEntityRequest<ODataEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
queryReq.setFormat(ODataFormat.JSON);
async.addRetrieve(queryReq);
@@ -636,22 +636,22 @@ public class BatchTestITCase extends AbstractTestITCase {
}
}
- private ODataEntity newOrder(final int id) {
- final ODataEntity order = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+ private ClientEntity newOrder(final int id) {
+ final ClientEntity order = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
- getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
- getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
- setValue(new BigDecimal("0.0000002")).build())));
+ getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
+ setValue(new BigDecimal("0.0000002")).build())));
return order;
}