http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java index 913d5db..2b47267 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.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. */ @@ -32,8 +32,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddi import org.apache.olingo.client.api.communication.request.cud.UpdateType; import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataLink; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.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; @@ -44,7 +44,7 @@ import org.junit.Test; public class EntityUpdateTestITCase extends AbstractTestITCase { private void upsert(final UpdateType updateType, final ODataFormat format) { - final ODataEntity order = getClient().getObjectFactory(). + final ClientEntity order = getClient().getObjectFactory(). newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order")); order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID", @@ -59,13 +59,13 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { final URI upsertURI = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Orders").appendKeySegment(9).build(); - final ODataEntityUpdateRequest<ODataEntity> req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(upsertURI, updateType, order); req.setFormat(format); req.execute(); try { - final ODataEntity read = read(format, upsertURI); + final ClientEntity read = read(format, upsertURI); assertNotNull(read); assertEquals(order.getProperty("OrderID"), read.getProperty("OrderID")); assertEquals(order.getProperty("OrderDate").getPrimitiveValue().toString(), @@ -115,7 +115,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { private void onContained(final ODataFormat format) { final String newName = UUID.randomUUID().toString(); - final ODataEntity changes = getClient().getObjectFactory().newEntity( + final ClientEntity changes = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")); changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName", getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newName))); @@ -123,14 +123,14 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { final URI uri = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Accounts").appendKeySegment(101). appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101901).build(); - final ODataEntityUpdateRequest<ODataEntity> req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse<ODataEntity> res = req.execute(); + final ODataEntityUpdateResponse<ClientEntity> res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(actual); assertEquals(newName, actual.getProperty("FriendlyName").getPrimitiveValue().toString()); } @@ -146,28 +146,28 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { } private void bindOperation(final ODataFormat format) throws EdmPrimitiveTypeException { - final ODataEntity changes = getClient().getObjectFactory().newEntity( + final ClientEntity changes = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); - final ODataLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent", + final ClientLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent", getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(1).build()); changes.getNavigationLinks().add(parent); final URI uri = getClient().newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("People").appendKeySegment(5).build(); - final ODataEntityUpdateRequest<ODataEntity> req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory(). getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse<ODataEntity> res = req.execute(); + final ODataEntityUpdateResponse<ClientEntity> res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(updated); - final ODataLink updatedLink = updated.getNavigationLink("Parent"); + final ClientLink updatedLink = updated.getNavigationLink("Parent"); assertNotNull(updatedLink); - final ODataEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()). + final ClientEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()). execute().getBody(); assertNotNull(updatedEntity); assertEquals(1, updatedEntity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java index 4c52624..a69df67 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java @@ -1,26 +1,26 @@ -/* +/* * 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. */ package org.apache.olingo.fit.v4; import org.apache.olingo.client.api.communication.ODataClientErrorException; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -42,10 +42,10 @@ public class ErrorResponseTestITCase extends AbstractTestITCase { read(ODataFormat.JSON, readURI); fail("should have got exception"); } catch (Exception ex) { - final ODataError err = ((ODataClientErrorException) ex).getODataError(); + final ClientError err = ((ODataClientErrorException) ex).getODataError(); // verify details - final ODataErrorDetail detail = err.getDetails().get(0); + final ClientErrorDetail detail = err.getDetails().get(0); assertEquals("Code should be correct", "301", detail.getCode()); assertEquals("Target should be correct", "$search", detail.getTarget()); assertEquals("Message should be correct", "$search query option not supported", detail.getMessage()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java index b6f416f..74e510a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.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. */ @@ -23,8 +23,8 @@ import org.apache.olingo.client.api.uri.FilterArgFactory; import org.apache.olingo.client.api.uri.FilterFactory; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.api.uri.URIFilter; -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.junit.Test; @@ -48,14 +48,14 @@ public class FilterFactoryTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter); - final ODataEntitySetRequest<ODataEntitySet> req = + final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()); req.setFormat(ODataFormat.JSON_FULL_METADATA); - final ODataEntitySet feed = req.execute().getBody(); + final ClientEntitySet feed = req.execute().getBody(); assertEquals(3, feed.getEntities().size()); - for (ODataEntity entity : feed.getEntities()) { + for (ClientEntity entity : feed.getEntities()) { assertEquals(2, entity.getNavigationLinks().size()); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java index 1af92d6..b45cf5a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.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. */ @@ -29,12 +29,12 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataProperty; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; @@ -62,21 +62,21 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item1() throws EdmPrimitiveTypeException { final URI uri = edmClient.newURIBuilder(). - appendEntitySetSegment("Accounts").appendKeySegment(102). - appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); - final ODataEntityRequest<ODataEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102). + appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); + final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); // request format (via Accept header) is set to minimal by default assertEquals("application/json;odata.metadata=minimal", req.getAccept()); - final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final ODataRetrieveResponse<ClientEntity> res = req.execute(); // response is odata.metadata=minimal assertFalse(res.getContentType().contains("odata.metadata=none")); assertFalse(res.getContentType().contains("odata.metadata=full")); // response payload is understood - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString()); assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -89,23 +89,23 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item2() { final URI uri = edmClient.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(102).build(); - final ODataEntityRequest<ODataEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102).build(); + final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); req.setFormat(ODataFormat.JSON_FULL_METADATA); // request format (via Accept header) is set to full metadata assertEquals("application/json;odata.metadata=full", req.getAccept()); - final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final ODataRetrieveResponse<ClientEntity> res = req.execute(); // response is odata.metadata=full assertTrue(res.getContentType().contains("odata.metadata=full")); // response payload is understood (including links, only returned with full metadata) - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); - assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType()); + assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType()); } /** @@ -119,36 +119,36 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item3() throws Exception { final String fromSection71 = "{" - + "\"NullValue\": null," - + "\"TrueValue\": true," - + "\"FalseValue\": false," - + "\"[email protected]\": \"Binary\"," - + "\"BinaryValue\": \"T0RhdGE\"," - + "\"IntegerValue\": -128," - + "\"DoubleValue\": 3.1415926535897931," - + "\"[email protected]\": \"Single\"," - + "\"SingleValue\": \"INF\"," - + "\"[email protected]\": \"Decimal\"," - + "\"DecimalValue\": 34.95," - + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\"," - + "\"[email protected]\": \"Date\"," - + "\"DateValue\": \"2012-12-03\"," - + "\"[email protected]\": \"DateTimeOffset\"," - + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\"," - + "\"[email protected]\": \"Duration\"," - + "\"DurationValue\": \"P12DT23H59M59.999999999999S\"," - + "\"[email protected]\": \"TimeOfDay\"," - + "\"TimeOfDayValue\": \"07:59:59.999\"," - + "\"[email protected]\": \"Guid\"," - + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\"," - + "\"[email protected]\": \"Int64\"," - + "\"Int64Value\": 0," - + "\"[email protected]\": \"Test.Color\"," - + "\"ColorEnumValue\": \"Yellow\"," - + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}" - + "}"; - - final ODataEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ODataFormat.JSON); + + "\"NullValue\": null," + + "\"TrueValue\": true," + + "\"FalseValue\": false," + + "\"[email protected]\": \"Binary\"," + + "\"BinaryValue\": \"T0RhdGE\"," + + "\"IntegerValue\": -128," + + "\"DoubleValue\": 3.1415926535897931," + + "\"[email protected]\": \"Single\"," + + "\"SingleValue\": \"INF\"," + + "\"[email protected]\": \"Decimal\"," + + "\"DecimalValue\": 34.95," + + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\"," + + "\"[email protected]\": \"Date\"," + + "\"DateValue\": \"2012-12-03\"," + + "\"[email protected]\": \"DateTimeOffset\"," + + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\"," + + "\"[email protected]\": \"Duration\"," + + "\"DurationValue\": \"P12DT23H59M59.999999999999S\"," + + "\"[email protected]\": \"TimeOfDay\"," + + "\"TimeOfDayValue\": \"07:59:59.999\"," + + "\"[email protected]\": \"Guid\"," + + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\"," + + "\"[email protected]\": \"Int64\"," + + "\"Int64Value\": 0," + + "\"[email protected]\": \"Test.Color\"," + + "\"ColorEnumValue\": \"Yellow\"," + + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}" + + "}"; + + final ClientEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ODataFormat.JSON); assertTrue(entity.getProperty("NullValue").hasNullValue()); @@ -165,29 +165,29 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertEquals(EdmPrimitiveTypeKind.Double, entity.getProperty("DoubleValue").getPrimitiveValue().getTypeKind()); assertEquals(3.1415926535897931, - entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0); + entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0); assertEquals(EdmPrimitiveTypeKind.Single, entity.getProperty("SingleValue").getPrimitiveValue().getTypeKind()); assertEquals(Float.POSITIVE_INFINITY, - entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0); + entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0); assertEquals(EdmPrimitiveTypeKind.Decimal, entity.getProperty("DecimalValue").getPrimitiveValue().getTypeKind()); assertEquals(BigDecimal.valueOf(34.95), - entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class)); + entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class)); assertEquals(EdmPrimitiveTypeKind.String, entity.getProperty("StringValue").getPrimitiveValue().getTypeKind()); assertEquals("Say \"Hello\",\nthen go", - entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class)); + entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class)); assertEquals(EdmPrimitiveTypeKind.Date, entity.getProperty("DateValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, - entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind()); + entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Duration, entity.getProperty("DurationValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.TimeOfDay, - entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind()); + entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Guid, entity.getProperty("GuidValue").getPrimitiveValue().getTypeKind()); @@ -196,7 +196,7 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertTrue(entity.getProperty("ColorEnumValue").hasEnumValue()); assertEquals(EdmPrimitiveTypeKind.GeographyPoint, - entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind()); + entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind()); } /** @@ -205,21 +205,21 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item4() throws Exception { final String fromSection45_1 = "{" - + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\"," - + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\"," - + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\"," - + "\"@odata.type\": \"#Model.VipCustomer\"," - + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\"," - + "\"@odata.editLink\": \"People(976)\"," - + "\"@odata.mediaEditLink\": \"Employees(1)/$value\"," - + "\"@odata.mediaContentType\": \"image/jpeg\"," - + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\"," - + "\"[email protected]\": \"People(976)/Parent\"," - + "\"[email protected]\": \"People(976)/Parent\"" - + "}"; + + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\"," + + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\"," + + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\"," + + "\"@odata.type\": \"#Model.VipCustomer\"," + + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\"," + + "\"@odata.editLink\": \"People(976)\"," + + "\"@odata.mediaEditLink\": \"Employees(1)/$value\"," + + "\"@odata.mediaContentType\": \"image/jpeg\"," + + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\"," + + "\"[email protected]\": \"People(976)/Parent\"," + + "\"[email protected]\": \"People(976)/Parent\"" + + "}"; final ResWrap<Entity> entity = - client.getDeserializer(ODataFormat.JSON).toEntity(IOUtils.toInputStream(fromSection45_1)); + client.getDeserializer(ODataFormat.JSON).toEntity(IOUtils.toInputStream(fromSection45_1)); assertEquals("http://host/service/$metadata#Customers/$entity", entity.getContextURL().toASCIIString()); assertEquals("W/\"A1FF3E230954908F\"", entity.getMetadataETag()); @@ -234,14 +234,14 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertEquals("People(976)/Parent", entity.getPayload().getAssociationLink("Parent").getHref()); final String fromSection45_2 = "{" - + " \"@odata.count\": 5," - + " \"value\": []," - + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\"," - + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\"" - + "}"; + + " \"@odata.count\": 5," + + " \"value\": []," + + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\"," + + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\"" + + "}"; final ResWrap<EntityCollection> entitySet = - client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2)); + client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2)); assertEquals(5, entitySet.getPayload().getCount(), 0); assertEquals("Customers?$expand=Orders&$skipToken=5", entitySet.getPayload().getNext().toASCIIString()); @@ -255,54 +255,54 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item5() throws Exception { final String sample = "{" - + " \"@odata.context\": \"http://host/service/$metadata#Customers\"," - + " \"@odata.notdefined\": 11," - + " \"@com.contoso.customer.setkind\": \"VIPs\"," - + " \"value\": [" - + " {" - + " \"@com.contoso.display.highlight\": true," - + " \"ID\": \"ALFKI\"," - + " \"[email protected]\": { \"title\": true, \"order\": 1 }," - + " \"CompanyName\": \"Alfreds Futterkiste\"," - + " \"[email protected]\": { \"order\": 2 }," - + " \"[email protected]\": \"People(976)/Orders\"" - + " }" - + " ]" - + "}"; - - final ODataEntitySet entitySet = client.getReader(). - readEntitySet(IOUtils.toInputStream(sample), ODataFormat.JSON); + + " \"@odata.context\": \"http://host/service/$metadata#Customers\"," + + " \"@odata.notdefined\": 11," + + " \"@com.contoso.customer.setkind\": \"VIPs\"," + + " \"value\": [" + + " {" + + " \"@com.contoso.display.highlight\": true," + + " \"ID\": \"ALFKI\"," + + " \"[email protected]\": { \"title\": true, \"order\": 1 }," + + " \"CompanyName\": \"Alfreds Futterkiste\"," + + " \"[email protected]\": { \"order\": 2 }," + + " \"[email protected]\": \"People(976)/Orders\"" + + " }" + + " ]" + + "}"; + + final ClientEntitySet entitySet = client.getReader(). + readEntitySet(IOUtils.toInputStream(sample), ODataFormat.JSON); assertEquals(2, entitySet.getAnnotations().size()); - final ODataAnnotation notdefined = entitySet.getAnnotations().get(0); + final ClientAnnotation notdefined = entitySet.getAnnotations().get(0); assertEquals("odata.notdefined", notdefined.getTerm()); assertEquals(11, notdefined.getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataAnnotation setkind = entitySet.getAnnotations().get(1); + final ClientAnnotation setkind = entitySet.getAnnotations().get(1); assertEquals("com.contoso.customer.setkind", setkind.getTerm()); assertEquals("VIPs", setkind.getPrimitiveValue().toCastValue(String.class)); - final ODataEntity entity = entitySet.getEntities().get(0); + final ClientEntity entity = entitySet.getEntities().get(0); assertEquals(1, entity.getAnnotations().size()); - final ODataAnnotation highlight = entity.getAnnotations().get(0); + final ClientAnnotation highlight = entity.getAnnotations().get(0); assertEquals("com.contoso.display.highlight", highlight.getTerm()); assertEquals(Boolean.TRUE, highlight.getPrimitiveValue().toCastValue(Boolean.class)); - final ODataProperty property = entity.getProperty("CompanyName"); + final ClientProperty property = entity.getProperty("CompanyName"); assertEquals(1, property.getAnnotations().size()); - final ODataAnnotation style = property.getAnnotations().get(0); + final ClientAnnotation style = property.getAnnotations().get(0); assertEquals("com.contoso.display.style", style.getTerm()); assertTrue(style.hasComplexValue()); assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class)); assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0); - final ODataLink orders = entity.getNavigationLink("Orders"); + final ClientLink orders = entity.getNavigationLink("Orders"); assertEquals(1, orders.getAnnotations().size()); - final ODataAnnotation style2 = orders.getAnnotations().get(0); + final ClientAnnotation style2 = orders.getAnnotations().get(0); assertEquals("com.contoso.display.style", style2.getTerm()); assertTrue(style2.hasComplexValue()); assertEquals(2, style2.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -314,17 +314,17 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { @Test public void item6() throws EdmPrimitiveTypeException { final URI uri = edmClient.newURIBuilder(). - appendEntitySetSegment("Accounts").appendKeySegment(102). - appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); - final ODataEntityRequest<ODataEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); + appendEntitySetSegment("Accounts").appendKeySegment(102). + appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build(); + final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri); // request format (via Accept header) does not contain odata.streaming=true assertEquals("application/json;odata.metadata=minimal", req.getAccept()); - final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final ODataRetrieveResponse<ClientEntity> res = req.execute(); // response payload is understood - final ODataEntity entity = res.getBody(); + final ClientEntity entity = res.getBody(); assertNotNull(entity); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString()); assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java index b92e39f..835d7a3 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.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,8 +24,8 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse; 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.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.AfterClass; @@ -52,13 +52,14 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase { private void read(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(testKeyAsSegmentServiceRootURL). - appendEntitySetSegment("Accounts").appendKeySegment(101); + appendEntitySetSegment("Accounts").appendKeySegment(101); - final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest<ClientEntity> req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); 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); // In JSON with minimal metadata, links are not provided @@ -89,27 +90,27 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase { } private void update(final ODataFormat format) { - final ODataEntity changes = getClient().getObjectFactory().newEntity( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); - final ODataProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle")); + final ClientEntity changes = getClient().getObjectFactory().newEntity( + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer")); + final ClientProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle")); changes.getProperties().add(middleName); final URI uri = getClient().newURIBuilder(testKeyAsSegmentServiceRootURL). - appendEntitySetSegment("People").appendKeySegment(5).build(); - final ODataEntityUpdateRequest<ODataEntity> req = getClient().getCUDRequestFactory(). - getEntityUpdateRequest(uri, UpdateType.PATCH, changes); + appendEntitySetSegment("People").appendKeySegment(5).build(); + final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory(). + getEntityUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse<ODataEntity> res = req.execute(); + final ODataEntityUpdateResponse<ClientEntity> res = req.execute(); assertEquals(204, res.getStatusCode()); - final ODataEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); + final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody(); assertNotNull(updated); assertFalse(updated.getEditLink().toASCIIString().contains("(")); assertFalse(updated.getEditLink().toASCIIString().contains(")")); - final ODataProperty updatedMiddleName = updated.getProperty("MiddleName"); + final ClientProperty updatedMiddleName = updated.getProperty("MiddleName"); assertNotNull(updatedMiddleName); assertEquals("middle", updatedMiddleName.getPrimitiveValue().toString()); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java index 9dfc97f..2b19064 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.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.response.ODataMediaEntityUpdat import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataValuable; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientValuable; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -61,16 +61,16 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final URIBuilder builder = client.newURIBuilder(testDemoServiceRootURL). appendEntitySetSegment("Advertisements"). appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")); - final ODataEntityRequest<ODataEntity> entityReq = + final ODataEntityRequest<ClientEntity> entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build()); entityReq.setFormat(format); - final ODataEntity entity = entityReq.execute().getBody(); + final ClientEntity entity = entityReq.execute().getBody(); assertNotNull(entity); assertTrue(entity.isMediaEntity()); // cast to workaround JDK 6 bug, fixed in JDK 7 assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(), - ((ODataValuable) entity.getProperty("AirDate")).getValue().getTypeName()); + ((ClientValuable) entity.getProperty("AirDate")).getValue().getTypeName()); final ODataMediaRequest streamReq = client.getRetrieveRequestFactory(). getMediaRequest(entity.getMediaContentSource()); @@ -101,28 +101,28 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final InputStream input = IOUtils.toInputStream(random); final URI uri = client.newURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build(); - final ODataMediaEntityCreateRequest<ODataEntity> createReq = + final ODataMediaEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().getMediaEntityCreateRequest(uri, input); - final MediaEntityCreateStreamManager<ODataEntity> streamManager = createReq.payloadManager(); + final MediaEntityCreateStreamManager<ClientEntity> streamManager = createReq.payloadManager(); - final ODataMediaEntityCreateResponse<ODataEntity> createRes = streamManager.getResponse(); + final ODataMediaEntityCreateResponse<ClientEntity> createRes = streamManager.getResponse(); assertEquals(201, createRes.getStatusCode()); final Collection<String> location = createRes.getHeader(HeaderName.location); assertNotNull(location); final URI createdLocation = URI.create(location.iterator().next()); - final ODataEntity changes = client.getObjectFactory(). + final ClientEntity changes = client.getObjectFactory(). newEntity(new FullQualifiedName("ODataDemo.Advertisement")); changes.getProperties().add(client.getObjectFactory().newPrimitiveProperty("AirDate", getClient().getObjectFactory().newPrimitiveValueBuilder(). setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build())); - final ODataEntityUpdateRequest<ODataEntity> updateReq = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest<ClientEntity> updateReq = getClient().getCUDRequestFactory(). getEntityUpdateRequest(createdLocation, UpdateType.PATCH, changes); updateReq.setFormat(format); - final ODataEntityUpdateResponse<ODataEntity> updateRes = updateReq.execute(); + final ODataEntityUpdateResponse<ClientEntity> updateRes = updateReq.execute(); assertEquals(204, updateRes.getStatusCode()); final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory(). @@ -153,12 +153,12 @@ public class MediaEntityTestITCase extends AbstractTestITCase { final String random = RandomStringUtils.random(124); // 1. update providing media content - final ODataMediaEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory(). + final ODataMediaEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory(). getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random)); updateReq.setFormat(format); - final MediaEntityUpdateStreamManager<ODataEntity> streamManager = updateReq.payloadManager(); - final ODataMediaEntityUpdateResponse<ODataEntity> createRes = streamManager.getResponse(); + final MediaEntityUpdateStreamManager<ClientEntity> streamManager = updateReq.payloadManager(); + final ODataMediaEntityUpdateResponse<ClientEntity> createRes = streamManager.getResponse(); assertEquals(204, createRes.getStatusCode()); // 2. check that media content was effectively uploaded http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java index 2119c0c..4a5d6f5 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.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. */ @@ -47,7 +47,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(edm); final EdmEntityType order = edm.getEntityType( - new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order")); + new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order")); assertNotNull(order); final EdmProperty orderDate = order.getStructuralProperty("OrderDate"); @@ -68,12 +68,12 @@ public class MetadataTestITCase extends AbstractTestITCase { assertEquals(3, record.getPropertyValues().size()); assertTrue(record.getPropertyValues().get(0).getValue().isConstant()); assertTrue(record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive(). - toCastValue(Boolean.class)); + toCastValue(Boolean.class)); assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection()); assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size()); assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic()); assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection(). - getItems().get(0).asDynamic().asPropertyPath().getValue()); + getItems().get(0).asDynamic().asPropertyPath().getValue()); } @Test @@ -82,7 +82,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(edm); final EdmEntityContainer container = edm.getEntityContainer( - new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities")); + new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities")); assertNotNull(container); final EdmEntitySet categories = container.getEntitySet("Categories"); @@ -93,7 +93,7 @@ public class MetadataTestITCase extends AbstractTestITCase { @Test public void vocabularies() { final Edm edm = client.getRetrieveRequestFactory(). - getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody(); + getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody(); assertNotNull(edm); // 1. core @@ -105,12 +105,12 @@ public class MetadataTestITCase extends AbstractTestITCase { final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core.Description")); assertNotNull(descriptionTerm); assertEquals(descriptionTerm.getFullQualifiedName(), - edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName()); + edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName()); final EdmAnnotation description = core.getAnnotation(descriptionTerm); assertNotNull(description); assertEquals("Core terms needed to write vocabularies", - description.getExpression().asConstant().getValue().asPrimitive().toString()); + description.getExpression().asConstant().getValue().asPrimitive().toString()); final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core.IsLanguageDependent")); assertNotNull(isLanguageDependent); @@ -132,7 +132,7 @@ public class MetadataTestITCase extends AbstractTestITCase { assertNotNull(scale); final EdmAnnotation requiresTypeInScale = edm.getAnnotation( - scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType"))); + scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType"))); assertNotNull(requiresTypeInScale); assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValue().toString()); @@ -140,6 +140,6 @@ public class MetadataTestITCase extends AbstractTestITCase { final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities.DeleteRestrictions")); assertNotNull(deleteRestrictions); assertEquals(deleteRestrictions.getType().getFullQualifiedName(), - edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName()); + edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName()); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java index 1eba762..44b7eca 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.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. */ @@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -42,17 +42,17 @@ import org.apache.olingo.fit.CXFOAuth2HttpClientFactory; public class OAuth2TestITCase extends AbstractTestITCase { private static final URI OAUTH2_GRANT_SERVICE_URI = - URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize"); + URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize"); private static final URI OAUTH2_TOKEN_SERVICE_URI = - URI.create("http://localhost:9080/stub/StaticService/oauth2/token"); + URI.create("http://localhost:9080/stub/StaticService/oauth2/token"); private EdmEnabledODataClient _edmClient; @BeforeClass public static void enableOAuth2() { client.getConfiguration().setHttpClientFactory( - new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); + new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); } @AfterClass @@ -64,7 +64,7 @@ public class OAuth2TestITCase extends AbstractTestITCase { if (_edmClient == null) { _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL); _edmClient.getConfiguration().setHttpClientFactory( - new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); + new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI)); } return _edmClient; @@ -72,18 +72,19 @@ public class OAuth2TestITCase extends AbstractTestITCase { private void read(final ODataClient client, final ODataFormat format) { final URIBuilder uriBuilder = - client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); + client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8); - final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); + final ODataEntityRequest<ClientEntity> req = + client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); - final ODataRetrieveResponse<ODataEntity> res = req.execute(); + final ODataRetrieveResponse<ClientEntity> res = req.execute(); assertEquals(200, res.getStatusCode()); final String etag = res.getETag(); assertTrue(StringUtils.isNotBlank(etag)); - final ODataEntity order = res.getBody(); + 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()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java index 4721ddc..ad9b0a6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.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. */ @@ -30,8 +30,8 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR import org.apache.olingo.client.api.communication.response.ODataDeleteResponse; import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmSchema; @@ -53,14 +53,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase { assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType()); } - private ODataEntity readRow(final ODataFormat format, final String uuid) { + private ClientEntity readRow(final ODataFormat format, final String uuid) { final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid)); return read(format, builder.build()); } private void read(final ODataFormat format) { - ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f"); + ClientEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f"); assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind()); assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind()); @@ -81,7 +81,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase { private void cud(final ODataFormat format) { final Integer id = 1426; - ODataEntity rowIndex = getClient().getObjectFactory().newEntity( + ClientEntity rowIndex = getClient().getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex")); getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newPrimitiveProperty("Id", @@ -114,7 +114,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase { getClient().getObjectFactory().newEnumProperty("aColor", getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue"))); - final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue( + final ClientComplexValue contactDetails = getClient().getObjectFactory().newComplexValue( "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails"); contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("FirstContacted", getClient().getObjectFactory().newPrimitiveValueBuilder().buildBinary("text".getBytes()))); @@ -151,11 +151,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase { getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newComplexProperty("aContact", contactDetails)); - final ODataEntityCreateRequest<ODataEntity> createReq = getClient().getCUDRequestFactory(). + final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory(). getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("RowIndex").build(), rowIndex); createReq.setFormat(format); - final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute(); + final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute(); assertEquals(201, createRes.getStatusCode()); final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java index 261d943..4c0775e 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.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. */ @@ -27,15 +27,15 @@ import java.util.LinkedHashMap; import java.util.Map; import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest; -import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.junit.Test; @@ -44,31 +44,31 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { private void functionImports(final ODataFormat format) throws EdmPrimitiveTypeException { // GetDefaultColor - final ODataInvokeRequest<ODataProperty> defaultColorReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> defaultColorReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetDefaultColor").build(), ODataProperty.class); + appendOperationCallSegment("GetDefaultColor").build(), ClientProperty.class); defaultColorReq.setFormat(format); - final ODataProperty defaultColor = defaultColorReq.execute().getBody(); + final ClientProperty defaultColor = defaultColorReq.execute().getBody(); assertNotNull(defaultColor); assertTrue(defaultColor.hasEnumValue()); assertEquals("Red", defaultColor.getEnumValue().getValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName()); // GetPerson2 - final ODataPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); + final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); - final ODataInvokeRequest<ODataEntity> person2Req = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest<ClientEntity> person2Req = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetPerson2").build(), ODataEntity.class, - Collections.<String, ODataValue> singletonMap("city", city)); + appendOperationCallSegment("GetPerson2").build(), ClientEntity.class, + Collections.<String, ClientValue> singletonMap("city", city)); person2Req.setFormat(format); - final ODataEntity person2 = person2Req.execute().getBody(); + final ClientEntity person2 = person2Req.execute().getBody(); assertNotNull(person2); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString()); assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetPerson - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way"))); @@ -77,34 +77,34 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052"))); - final ODataInvokeRequest<ODataEntity> personReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest<ClientEntity> personReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetPerson").build(), ODataEntity.class, - Collections.<String, ODataValue> singletonMap("address", address)); + appendOperationCallSegment("GetPerson").build(), ClientEntity.class, + Collections.<String, ClientValue> singletonMap("address", address)); personReq.setFormat(format); - final ODataEntity person = personReq.execute().getBody(); + final ClientEntity person = personReq.execute().getBody(); assertNotNull(person); assertEquals(person2, person); // GetAllProducts - final ODataInvokeRequest<ODataEntitySet> productsReq = getClient().getInvokeRequestFactory() + final ODataInvokeRequest<ClientEntitySet> productsReq = getClient().getInvokeRequestFactory() .getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetAllProducts").build(), ODataEntitySet.class); + appendOperationCallSegment("GetAllProducts").build(), ClientEntitySet.class); productsReq.setFormat(format); - final ODataEntitySet products = productsReq.execute().getBody(); + final ClientEntitySet products = productsReq.execute().getBody(); assertNotNull(products); assertEquals(5, products.getEntities().size()); // GetProductsByAccessLevel - final ODataEnumValue accessLevel = getClient().getObjectFactory(). + final ClientEnumValue accessLevel = getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None"); - final ODataInvokeRequest<ODataProperty> prodByALReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> prodByALReq = getClient().getInvokeRequestFactory(). getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetProductsByAccessLevel").build(), ODataProperty.class, - Collections.<String, ODataValue> singletonMap("accessLevel", accessLevel)); + appendOperationCallSegment("GetProductsByAccessLevel").build(), ClientProperty.class, + Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel)); prodByALReq.setFormat(format); - final ODataProperty prodByAL = prodByALReq.execute().getBody(); + final ClientProperty prodByAL = prodByALReq.execute().getBody(); assertNotNull(prodByAL); assertTrue(prodByAL.hasCollectionValue()); assertEquals(5, prodByAL.getCollectionValue().size()); @@ -124,27 +124,27 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledFunctionImports() throws EdmPrimitiveTypeException { // GetDefaultColor - final ODataInvokeRequest<ODataProperty> defaultColorReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> defaultColorReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest("GetDefaultColor"); - final ODataProperty defaultColor = defaultColorReq.execute().getBody(); + final ClientProperty defaultColor = defaultColorReq.execute().getBody(); assertNotNull(defaultColor); assertTrue(defaultColor.hasEnumValue()); assertEquals("Red", defaultColor.getEnumValue().getValue()); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName()); // GetPerson2 - final ODataPrimitiveValue city = + final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London"); - final ODataInvokeRequest<ODataEntity> person2Req = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientEntity> person2Req = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( - "GetPerson2", Collections.<String, ODataValue> singletonMap("city", city)); - final ODataEntity person2 = person2Req.execute().getBody(); + "GetPerson2", Collections.<String, ClientValue> singletonMap("city", city)); + final ClientEntity person2 = person2Req.execute().getBody(); assertNotNull(person2); assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString()); assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0); // GetPerson - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way"))); @@ -153,29 +153,29 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052"))); - final ODataInvokeRequest<ODataEntity> personReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientEntity> personReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( - "GetPerson", Collections.<String, ODataValue> singletonMap("address", address)); - final ODataEntity person = personReq.execute().getBody(); + "GetPerson", Collections.<String, ClientValue> singletonMap("address", address)); + final ClientEntity person = personReq.execute().getBody(); assertNotNull(person); assertEquals(person2, person); // GetAllProducts - final ODataInvokeRequest<ODataEntitySet> productsReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientEntitySet> productsReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest("GetAllProducts"); - final ODataEntitySet products = productsReq.execute().getBody(); + final ClientEntitySet products = productsReq.execute().getBody(); assertNotNull(products); assertEquals(5, products.getEntities().size()); // GetProductsByAccessLevel - final ODataEnumValue accessLevel = getClient().getObjectFactory(). + final ClientEnumValue accessLevel = getClient().getObjectFactory(). newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None"); - final ODataInvokeRequest<ODataProperty> prodByALReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> prodByALReq = edmClient.getInvokeRequestFactory(). getFunctionImportInvokeRequest( "GetProductsByAccessLevel", - Collections.<String, ODataValue> singletonMap("accessLevel", accessLevel)); - final ODataProperty prodByAL = prodByALReq.execute().getBody(); + Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel)); + final ClientProperty prodByAL = prodByALReq.execute().getBody(); assertNotNull(prodByAL); assertTrue(prodByAL.hasCollectionValue()); assertEquals(5, prodByAL.getCollectionValue().size()); @@ -184,17 +184,17 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { private void actionImports(final ODataFormat format) { // Discount - final ODataPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); - final ODataInvokeRequest<ODataNoContent> discountReq = getClient().getInvokeRequestFactory(). + final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); + final ODataInvokeRequest<ClientNoContent> discountReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("Discount").build(), ODataNoContent.class, - Collections.<String, ODataValue> singletonMap("percentage", percentage)); + appendOperationCallSegment("Discount").build(), ClientNoContent.class, + Collections.<String, ClientValue> singletonMap("percentage", percentage)); discountReq.setFormat(format); - final ODataNoContent discount = discountReq.execute().getBody(); + final ClientNoContent discount = discountReq.execute().getBody(); assertNotNull(discount); // ResetBossAddress - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123"))); @@ -203,12 +203,12 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); - final ODataInvokeRequest<ODataProperty> resetBossAddressReq = getClient().getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> resetBossAddressReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("ResetBossAddress").build(), ODataProperty.class, - Collections.<String, ODataValue> singletonMap("address", address)); + appendOperationCallSegment("ResetBossAddress").build(), ClientProperty.class, + Collections.<String, ClientValue> singletonMap("address", address)); resetBossAddressReq.setFormat(format); - final ODataProperty resetBossAddress = resetBossAddressReq.execute().getBody(); + final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody(); assertNotNull(resetBossAddress); assertEquals(address, resetBossAddress.getComplexValue()); } @@ -226,15 +226,15 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { @Test public void edmEnabledActionImports() { // Discount - final ODataPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); - final ODataInvokeRequest<ODataNoContent> discountReq = edmClient.getInvokeRequestFactory(). + final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22); + final ODataInvokeRequest<ClientNoContent> discountReq = edmClient.getInvokeRequestFactory(). getActionImportInvokeRequest( - "Discount", Collections.<String, ODataValue> singletonMap("percentage", percentage)); - final ODataNoContent discount = discountReq.execute().getBody(); + "Discount", Collections.<String, ClientValue> singletonMap("percentage", percentage)); + final ClientNoContent discount = discountReq.execute().getBody(); assertNotNull(discount); // ResetBossAddress - final ODataComplexValue address = getClient().getObjectFactory(). + final ClientComplexValue address = getClient().getObjectFactory(). newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address"); address.add(client.getObjectFactory().newPrimitiveProperty("Street", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123"))); @@ -243,38 +243,38 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase { address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode", client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010"))); - final ODataInvokeRequest<ODataProperty> resetBossAddressReq = edmClient.getInvokeRequestFactory(). + final ODataInvokeRequest<ClientProperty> resetBossAddressReq = edmClient.getInvokeRequestFactory(). getActionImportInvokeRequest( - "ResetBossAddress", Collections.<String, ODataValue> singletonMap("address", address)); - final ODataProperty resetBossAddress = resetBossAddressReq.execute().getBody(); + "ResetBossAddress", Collections.<String, ClientValue> singletonMap("address", address)); + final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody(); assertNotNull(resetBossAddress); assertEquals(address.getTypeName(), resetBossAddress.getComplexValue().getTypeName()); } private void bossEmails(final ODataFormat format) { // ResetBossEmail - final ODataCollectionValue<org.apache.olingo.commons.api.domain.ODataValue> emails = + final ClientCollectionValue<ClientValue> emails = getClient().getObjectFactory().newCollectionValue("Collection(Edm.String)"); emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("[email protected]")); emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("[email protected]")); - ODataInvokeRequest<ODataProperty> bossEmailsReq = getClient().getInvokeRequestFactory(). + ODataInvokeRequest<ClientProperty> bossEmailsReq = getClient().getInvokeRequestFactory(). getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("ResetBossEmail").build(), ODataProperty.class, - Collections.<String, ODataValue> singletonMap("emails", emails)); + appendOperationCallSegment("ResetBossEmail").build(), ClientProperty.class, + Collections.<String, ClientValue> singletonMap("emails", emails)); bossEmailsReq.setFormat(format); - final ODataProperty bossEmails = bossEmailsReq.execute().getBody(); + final ClientProperty bossEmails = bossEmailsReq.execute().getBody(); assertNotNull(bossEmails); assertTrue(bossEmails.hasCollectionValue()); assertEquals(2, bossEmails.getCollectionValue().size()); - final Map<String, ODataValue> params = new LinkedHashMap<String, ODataValue>(2); + final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2); params.put("start", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(0)); params.put("count", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100)); bossEmailsReq = getClient().getInvokeRequestFactory().getFunctionInvokeRequest( getClient().newURIBuilder(testStaticServiceRootURL). - appendOperationCallSegment("GetBossEmails").build(), ODataProperty.class, params); + appendOperationCallSegment("GetBossEmails").build(), ClientProperty.class, params); bossEmailsReq.setFormat(format); - final ODataProperty bossEmailsViaGET = bossEmailsReq.execute().getBody(); + final ClientProperty bossEmailsViaGET = bossEmailsReq.execute().getBody(); assertNotNull(bossEmailsViaGET); assertTrue(bossEmailsViaGET.hasCollectionValue()); assertEquals(2, bossEmailsViaGET.getCollectionValue().size());
