Return-Path: X-Original-To: apmail-olingo-commits-archive@minotaur.apache.org Delivered-To: apmail-olingo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E50151113F for ; Mon, 30 Jun 2014 14:57:31 +0000 (UTC) Received: (qmail 58058 invoked by uid 500); 30 Jun 2014 14:57:31 -0000 Delivered-To: apmail-olingo-commits-archive@olingo.apache.org Received: (qmail 57996 invoked by uid 500); 30 Jun 2014 14:57:31 -0000 Mailing-List: contact commits-help@olingo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.apache.org Delivered-To: mailing list commits@olingo.apache.org Received: (qmail 57905 invoked by uid 99); 30 Jun 2014 14:57:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jun 2014 14:57:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4D3DA91BE7A; Mon, 30 Jun 2014 14:57:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sklevenz@apache.org To: commits@olingo.apache.org Date: Mon, 30 Jun 2014 14:57:36 -0000 Message-Id: <8ae6ee297f7f4d54989473c18b17b220@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/51] [abbrv] [partial] [OLINGO-328] code cleanup and checkstyle issues http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java index 6e694e2..a26e4b6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/AbstractTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/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. */ @@ -71,7 +71,7 @@ import org.junit.BeforeClass; public abstract class AbstractTestITCase extends AbstractBaseTestITCase { protected static final FullQualifiedName TEST_PRODUCT_TYPE = - new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Product"); + new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Product"); protected static ODataClient client; @@ -95,7 +95,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V30/OpenType.svc"; testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V30/Static.svc/large"; testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V30/Static.svc"; - + client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM); } @@ -119,9 +119,9 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { for (ODataLink actualLink : actual) { if (actualLink.getType() == originalLink.getType() - && (originalLink.getLink() == null - || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString())) - && actualLink.getName().equals(originalLink.getName())) { + && (originalLink.getLink() == null + || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString())) + && actualLink.getName().equals(originalLink.getName())) { foundOriginal = originalLink; foundActual = actualLink; @@ -144,7 +144,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void checkProperties(final Collection original, - final Collection actual) { + final Collection actual) { assertTrue(original.size() <= actual.size()); @@ -175,23 +175,23 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void checkPropertyValue(final String propertyName, - final ODataValue original, final ODataValue actual) { + final ODataValue original, final ODataValue actual) { assertNotNull("Null original value for " + propertyName, original); assertNotNull("Null actual value for " + propertyName, actual); assertEquals("Type mismatch for '" + propertyName + "': " - + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(), - original.getClass().getSimpleName(), actual.getClass().getSimpleName()); + + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(), + original.getClass().getSimpleName(), actual.getClass().getSimpleName()); if (original.isComplex()) { final List originalFileds = new ArrayList(); - for (ODataProperty prop : original.asComplex()) { + for (ODataProperty prop : original. asComplex()) { originalFileds.add(prop); } final List actualFileds = new ArrayList(); - for (ODataProperty prop : actual.asComplex()) { + for (ODataProperty prop : actual. asComplex()) { actualFileds.add(prop); } @@ -215,81 +215,81 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { assertTrue("Found " + actual + " but expected " + original, found); } else { assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive(). - getTypeKind() + "-" + actual.asPrimitive().getTypeKind(), - original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind())); + getTypeKind() + "-" + actual.asPrimitive().getTypeKind(), + original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind())); assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString() - + "-" + actual.asPrimitive().toString(), - original.asPrimitive().toString(), actual.asPrimitive().toString()); + + "-" + actual.asPrimitive().toString(), + original.asPrimitive().toString(), actual.asPrimitive().toString()); } } protected ODataEntity getSampleCustomerInfo(final String sampleinfo) { final ODataEntity entity = getClient().getObjectFactory().newEntity(new FullQualifiedName( - "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo")); + "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo")); entity.setMediaEntity(true); getClient().getBinder().add(entity, - getClient().getObjectFactory().newPrimitiveProperty("Information", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(sampleinfo))); + getClient().getObjectFactory().newPrimitiveProperty("Information", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(sampleinfo))); return entity; } protected ODataEntity getSampleCustomerProfile( - final int id, final String sampleName, final boolean withInlineInfo) { + final int id, final String sampleName, final boolean withInlineInfo) { final ODataEntity entity = getClient().getObjectFactory(). - newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); + newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); // add name attribute getClient().getBinder().add(entity, - getClient().getObjectFactory().newPrimitiveProperty("Name", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(sampleName))); + getClient().getObjectFactory().newPrimitiveProperty("Name", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(sampleName))); // add key attribute getClient().getBinder().add(entity, - getClient().getObjectFactory().newPrimitiveProperty("CustomerId", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + getClient().getObjectFactory().newPrimitiveProperty("CustomerId", + getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); // add BackupContactInfo attribute (collection) final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue( - "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"); + "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"); getClient().getBinder().add(entity, - getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue)); + getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue)); // add BackupContactInfo.ContactDetails attribute (complex) final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue( - "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"); + "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"); backupContactInfoValue.add(contactDetails); // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection) final ODataCollectionValue altNamesValue = getClient().getObjectFactory(). - newCollectionValue("Collection(Edm.String)"); + newCollectionValue("Collection(Edm.String)"); altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("myname")); contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue)); // add BackupContactInfo.ContactDetails.EmailBag attribute (collection) final ODataCollectionValue emailBagValue = getClient().getObjectFactory(). - newCollectionValue("Collection(Edm.String)"); + newCollectionValue("Collection(Edm.String)"); emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("myname@mydomain.com")); contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue)); // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex) final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue( - "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"); + "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"); contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue)); // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection) final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory(). - newCollectionValue("Collection(Edm.String)"); + newCollectionValue("Collection(Edm.String)"); aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("myAlternativeName")); contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue)); if (withInlineInfo) { final ODataInlineEntity inlineInfo = getClient().getObjectFactory().newDeepInsertEntity( - "Info", - getSampleCustomerInfo(sampleName + "_Info")); + "Info", + getSampleCustomerInfo(sampleName + "_Info")); inlineInfo.getEntity().setMediaEntity(true); entity.addLink(inlineInfo); } @@ -299,7 +299,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { protected String getETag(final URI uri) { final ODataRetrieveResponse res = getClient().getRetrieveRequestFactory(). - getEntityRequest(uri).execute(); + getEntityRequest(uri).execute(); try { return res.getETag(); } finally { @@ -309,7 +309,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { protected ODataEntity read(final ODataFormat format, final URI editLink) { final ODataEntityRequest req = getClient().getRetrieveRequestFactory(). - getEntityRequest(editLink); + getEntityRequest(editLink); req.setFormat(format); final ODataRetrieveResponse res = req.execute(); @@ -325,18 +325,18 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected ODataEntity createEntity( - final String serviceRootURL, - final ODataFormat format, - final ODataEntity original, - final String entitySetName) { + final String serviceRootURL, + final ODataFormat format, + final ODataEntity original, + final String entitySetName) { final URIBuilder uriBuilder = getClient().newURIBuilder(serviceRootURL). - appendEntitySetSegment(entitySetName); + appendEntitySetSegment(entitySetName); debugODataEntity(original, "About to create"); final ODataEntityCreateRequest createReq = - getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); + getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); createReq.setFormat(format); final ODataEntityCreateResponse createRes = createReq.execute(); @@ -352,13 +352,13 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected ODataEntity compareEntities(final String serviceRootURL, - final ODataFormat format, - final ODataEntity original, - final int actualObjectId, - final Collection expands) { + final ODataFormat format, + final ODataEntity original, + final int actualObjectId, + final Collection expands) { final URIBuilder uriBuilder = getClient().newURIBuilder(serviceRootURL). - appendEntitySetSegment("Customer").appendKeySegment(actualObjectId); + appendEntitySetSegment("Customer").appendKeySegment(actualObjectId); // search expanded if (expands != null) { @@ -368,7 +368,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } final ODataEntityRequest req = getClient().getRetrieveRequestFactory(). - getEntityRequest(uriBuilder.build()); + getEntityRequest(uriBuilder.build()); req.setFormat(format); final ODataRetrieveResponse res = req.execute(); @@ -389,10 +389,10 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void cleanAfterCreate( - final ODataFormat format, - final ODataEntity created, - final boolean includeInline, - final String baseUri) { + final ODataFormat format, + final ODataEntity created, + final boolean includeInline, + final String baseUri) { final Set toBeDeleted = new HashSet(); toBeDeleted.add(created.getEditLink()); @@ -429,7 +429,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { deleteRes.close(); final ODataEntityRequest retrieveReq = getClient().getRetrieveRequestFactory(). - getEntityRequest(link); + getEntityRequest(link); // bug that needs to be fixed on the SampleService - cannot get entity not found with header // Accept: application/json;odata=minimalmetadata retrieveReq.setFormat(format == ODataFormat.JSON_FULL_METADATA ? ODataFormat.JSON : format); @@ -447,13 +447,13 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { } protected void updateEntityDescription( - final ODataFormat format, final ODataEntity changes, final UpdateType type) { + final ODataFormat format, final ODataEntity changes, final UpdateType type) { updateEntityDescription(format, changes, type, null); } protected void updateEntityDescription( - final ODataFormat format, final ODataEntity changes, final UpdateType type, final String etag) { + final ODataFormat format, final ODataEntity changes, final UpdateType type, final String etag) { updateEntityStringProperty("Description", format, changes, type, etag); } @@ -478,8 +478,8 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { assertNotEquals(newm, oldm); getClient().getBinder().add(changes, - getClient().getObjectFactory().newPrimitiveProperty(propertyName, - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newm))); + getClient().getObjectFactory().newPrimitiveProperty(propertyName, + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newm))); update(type, changes, format, etag); @@ -501,7 +501,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase { final UpdateType type, final ODataEntity changes, final ODataFormat format, final String etag) { final ODataEntityUpdateRequest req = - getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes); + getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes); if (getClient().getConfiguration().isUseXHTTPMethod()) { assertEquals(HttpMethod.POST, req.getMethod()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java index d9e617b..7f607c3 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java @@ -1,28 +1,29 @@ /* * 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.v3; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.LinkedHashMap; import java.util.Map; + import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.api.uri.v3.URIBuilder; @@ -41,23 +42,23 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase { // 1. unbound final URIBuilder builder = getClient().newURIBuilder(testActionOverloadingServiceRootURL). - appendOperationCallSegment(actionImportName); + appendOperationCallSegment(actionImportName); final ODataInvokeResponse unboundRes = getClient().getInvokeRequestFactory(). - getActionInvokeRequest(builder.build(), ODataProperty.class).execute(); + getActionInvokeRequest(builder.build(), ODataProperty.class).execute(); assertNotNull(unboundRes); assertEquals(200, unboundRes.getStatusCode()); assertEquals(Integer.valueOf(-10), unboundRes.getBody().getPrimitiveValue().toCastValue(Integer.class)); // 2. bound to Product final ODataEntity product = getClient().getRetrieveRequestFactory().getEntityRequest( - getClient().newURIBuilder(testActionOverloadingServiceRootURL). + getClient().newURIBuilder(testActionOverloadingServiceRootURL). appendEntitySetSegment("Product").appendKeySegment(-10).build()). - execute().getBody(); + execute().getBody(); assertNotNull(product); final ODataInvokeResponse productBoundRes = getClient().getInvokeRequestFactory(). - getActionInvokeRequest(product.getOperation(actionImportName).getTarget(), ODataProperty.class). - execute(); + getActionInvokeRequest(product.getOperation(actionImportName).getTarget(), ODataProperty.class). + execute(); assertNotNull(productBoundRes); assertEquals(200, productBoundRes.getStatusCode()); assertEquals(Integer.valueOf(-10), productBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class)); @@ -67,14 +68,14 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase { key.put("OrderId", -10); key.put("ProductId", -10); final ODataEntity orderLine = getClient().getRetrieveRequestFactory().getEntityRequest( - getClient().newURIBuilder(testActionOverloadingServiceRootURL). + getClient().newURIBuilder(testActionOverloadingServiceRootURL). appendEntitySetSegment("OrderLine").appendKeySegment(key).build()). - execute().getBody(); + execute().getBody(); assertNotNull(orderLine); final ODataInvokeResponse orderLineBoundRes = getClient().getInvokeRequestFactory(). - getActionInvokeRequest(orderLine.getOperation(actionImportName).getTarget(), ODataProperty.class). - execute(); + getActionInvokeRequest(orderLine.getOperation(actionImportName).getTarget(), ODataProperty.class). + execute(); assertNotNull(orderLineBoundRes); assertEquals(200, orderLineBoundRes.getStatusCode()); assertEquals(Integer.valueOf(-10), orderLineBoundRes.getBody().getPrimitiveValue().toCastValue(Integer.class)); @@ -89,29 +90,29 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase { // 1. bound to employees final URIBuilder employeeBuilder = getClient().newURIBuilder(testActionOverloadingServiceRootURL). - appendEntitySetSegment("Person"). - appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee"); + appendEntitySetSegment("Person"). + appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee"); final ODataEntitySet employees = getClient().getRetrieveRequestFactory().getEntitySetRequest( - employeeBuilder.build()).execute().getBody(); + employeeBuilder.build()).execute().getBody(); assertNotNull(employees); final ODataInvokeResponse employeeRes = getClient().getInvokeRequestFactory(). - getActionInvokeRequest(employeeBuilder.appendOperationCallSegment(actionImportName).build(), - ODataNoContent.class, parameters).execute(); + getActionInvokeRequest(employeeBuilder.appendOperationCallSegment(actionImportName).build(), + ODataNoContent.class, parameters).execute(); assertNotNull(employeeRes); assertEquals(204, employeeRes.getStatusCode()); // 2. bound to special employees final URIBuilder specEmpBuilder = getClient().newURIBuilder(testActionOverloadingServiceRootURL). - appendEntitySetSegment("Person"). - appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee"); + appendEntitySetSegment("Person"). + appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee"); final ODataEntitySet specEmps = getClient().getRetrieveRequestFactory().getEntitySetRequest( - specEmpBuilder.build()).execute().getBody(); + specEmpBuilder.build()).execute().getBody(); assertNotNull(specEmps); final ODataInvokeResponse specEmpsRes = getClient().getInvokeRequestFactory(). - getActionInvokeRequest(specEmpBuilder.appendOperationCallSegment(actionImportName).build(), - ODataNoContent.class, parameters).execute(); + getActionInvokeRequest(specEmpBuilder.appendOperationCallSegment(actionImportName).build(), + ODataNoContent.class, parameters).execute(); assertNotNull(specEmpsRes); assertEquals(204, specEmpsRes.getStatusCode()); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java index 1482545..254782a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/AsyncTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/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. */ @@ -26,6 +26,7 @@ import java.io.InputStream; import java.net.URI; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; + import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType; @@ -45,9 +46,9 @@ public class AsyncTestITCase extends AbstractTestITCase { @Test public void retrieveEntitySet() throws InterruptedException, ExecutionException { final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Product"); + appendEntitySetSegment("Product"); final Future> futureRes = - client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute(); + client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute(); assertNotNull(futureRes); while (!futureRes.isDone()) { @@ -63,10 +64,10 @@ public class AsyncTestITCase extends AbstractTestITCase { @Test public void updateEntity() throws InterruptedException, ExecutionException { final URI uri = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); final ODataRetrieveResponse entityRes = client.getRetrieveRequestFactory(). - getEntityRequest(uri).execute(); + getEntityRequest(uri).execute(); final ODataEntity entity = entityRes.getBody(); entity.getAssociationLinks().clear(); entity.getNavigationLinks().clear(); @@ -74,11 +75,11 @@ public class AsyncTestITCase extends AbstractTestITCase { entity.getProperties().remove(entity.getProperty("Description")); getClient().getBinder().add(entity, - client.getObjectFactory().newPrimitiveProperty("Description", + client.getObjectFactory().newPrimitiveProperty("Description", client.getObjectFactory().newPrimitiveValueBuilder().setValue("AsyncTest#updateEntity").build())); final ODataEntityUpdateRequest updateReq = - client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity); + client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity); updateReq.setIfMatch(entityRes.getETag()); final Future> futureRes = updateReq.asyncExecute(); @@ -99,7 +100,7 @@ public class AsyncTestITCase extends AbstractTestITCase { final InputStream input = IOUtils.toInputStream(TO_BE_UPDATED); final ODataMediaEntityCreateRequest createReq = - client.getCUDRequestFactory().getMediaEntityCreateRequest(builder.build(), input); + client.getCUDRequestFactory().getMediaEntityCreateRequest(builder.build(), input); final MediaEntityCreateStreamManager streamManager = createReq.payloadManager(); final Future> futureCreateRes = streamManager.getAsyncResponse(); @@ -116,8 +117,8 @@ public class AsyncTestITCase extends AbstractTestITCase { assertEquals(2, created.getProperties().size()); final int id = "VIN".equals(created.getProperties().get(0).getName()) - ? created.getProperties().get(0).getPrimitiveValue().toCastValue(Integer.class) - : created.getProperties().get(1).getPrimitiveValue().toCastValue(Integer.class); + ? created.getProperties().get(0).getPrimitiveValue().toCastValue(Integer.class) + : created.getProperties().get(1).getPrimitiveValue().toCastValue(Integer.class); builder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").appendKeySegment(id); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/AuthEntityRetrieveTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/AuthEntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/AuthEntityRetrieveTestITCase.java index a991de1..cdb9ded 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/AuthEntityRetrieveTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/AuthEntityRetrieveTestITCase.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. */ http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java index 88bbfb9..ea38100 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/BatchTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/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. */ @@ -114,16 +114,16 @@ public class BatchTestITCase extends AbstractTestITCase { for (int i = 1; i <= 2; i++) { // Create Customer into the changeset createReq = client.getCUDRequestFactory().getEntityCreateRequest( - targetURI.build(), - getSampleCustomerProfile(100 + i, "Sample customer", false)); + targetURI.build(), + getSampleCustomerProfile(100 + i, "Sample customer", false)); createReq.setFormat(ODataFormat.JSON); changeset.addRequest(createReq); } targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet"); createReq = client.getCUDRequestFactory().getEntityCreateRequest( - targetURI.build(), - getSampleCustomerProfile(105, "Sample customer", false)); + targetURI.build(), + getSampleCustomerProfile(105, "Sample customer", false)); createReq.setFormat(ODataFormat.JSON); changeset.addRequest(createReq); @@ -131,8 +131,8 @@ public class BatchTestITCase extends AbstractTestITCase { for (int i = 3; i <= 4; i++) { // Create Customer into the changeset createReq = client.getCUDRequestFactory().getEntityCreateRequest( - targetURI.build(), - getSampleCustomerProfile(100 + i, "Sample customer", false)); + targetURI.build(), + getSampleCustomerProfile(100 + i, "Sample customer", false)); createReq.setFormat(ODataFormat.ATOM); changeset.addRequest(createReq); } @@ -148,7 +148,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(chgResponseItem.hasNext()); } @@ -166,7 +166,7 @@ public class BatchTestITCase extends AbstractTestITCase { // add create request final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), customer); + client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), customer); changeset.addRequest(createReq); @@ -176,12 +176,12 @@ public class BatchTestITCase extends AbstractTestITCase { // add update request: link CustomerInfo(17) to the new customer final ODataEntity customerChanges = client.getObjectFactory().newEntity(customer.getTypeName()); customerChanges.addLink(client.getObjectFactory().newEntityNavigationLink( - "Info", - client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo"). + "Info", + client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo"). appendKeySegment(17).build())); final ODataEntityUpdateRequest updateReq = client.getCUDRequestFactory().getEntityUpdateRequest( - URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges); + URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges); changeset.addRequest(updateReq); @@ -204,10 +204,10 @@ public class BatchTestITCase extends AbstractTestITCase { customer = ((ODataEntityCreateResponse) res).getBody(); ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString() + "/Info")); + URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString() + "/Info")); assertEquals(Integer.valueOf(17), - req.execute().getBody().getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); + req.execute().getBody().getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); res = chgitem.next(); assertEquals(204, res.getStatusCode()); @@ -215,13 +215,13 @@ public class BatchTestITCase extends AbstractTestITCase { // clean ... assertEquals(204, client.getCUDRequestFactory().getDeleteRequest( - URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString())).execute(). - getStatusCode()); + URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString())).execute(). + getStatusCode()); try { client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString())). - execute().getBody(); + URIUtils.getURI(testStaticServiceRootURL, customer.getEditLink().toASCIIString())). + execute().getBody(); fail(); } catch (Exception e) { // ignore @@ -238,16 +238,16 @@ public class BatchTestITCase extends AbstractTestITCase { final ODataChangeset changeset = streamManager.addChangeset(); final ODataEntity info = - client.getObjectFactory().newEntity( + client.getObjectFactory().newEntity( new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo")); info.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("Sample information about customer 30"))); + client.getObjectFactory().newPrimitiveValueBuilder().buildString("Sample information about customer 30"))); URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("CustomerInfo"); ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), info); + client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), info); changeset.addRequest(createReq); @@ -256,7 +256,7 @@ public class BatchTestITCase extends AbstractTestITCase { ODataEntity customer = getSampleCustomerProfile(30, "sample customer", false); customer.getNavigationLinks().add( - client.getObjectFactory().newEntityNavigationLink("Info", URI.create("$" + createRequestRef))); + client.getObjectFactory().newEntityNavigationLink("Info", URI.create("$" + createRequestRef))); uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer"); @@ -292,12 +292,12 @@ public class BatchTestITCase extends AbstractTestITCase { uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(30); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(testStaticServiceRootURL, uriBuilder.build() + "/Info")); + URIUtils.getURI(testStaticServiceRootURL, uriBuilder.build() + "/Info")); final ODataEntity navigatedInfo = req.execute().getBody(); assertEquals(infoEntity.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class), - navigatedInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); + navigatedInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); } @Test @@ -314,7 +314,7 @@ public class BatchTestITCase extends AbstractTestITCase { // prepare URI URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL); targetURI.appendEntitySetSegment("Customer").appendKeySegment(-10). - expand("Logins").select("CustomerId,Logins/Username"); + expand("Logins").select("CustomerId,Logins/Username"); // create new request ODataEntityRequest queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); @@ -330,18 +330,18 @@ public class BatchTestITCase extends AbstractTestITCase { // Update Product into the changeset targetURI = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Product").appendKeySegment(-10); + appendEntitySetSegment("Product").appendKeySegment(-10); final URI editLink = targetURI.build(); final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); merge.setEditLink(editLink); merge.getProperties().add(client.getObjectFactory().newPrimitiveProperty( - "Description", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("new description from batch"))); + "Description", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("new description from batch"))); final ODataEntityUpdateRequest changeReq = - client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, merge); + client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, merge); changeReq.setFormat(ODataFormat.JSON_FULL_METADATA); changeReq.setIfMatch(getETag(editLink)); @@ -351,13 +351,13 @@ public class BatchTestITCase extends AbstractTestITCase { targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer"); final ODataEntity original = getSampleCustomerProfile(1000, "Sample customer", false); final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); + client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original); createReq.setFormat(ODataFormat.ATOM); changeset.addRequest(createReq); // Delete customer created above targetURI = - client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(1000); + client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customer").appendKeySegment(1000); final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(targetURI.build()); changeset.addRequest(deleteReq); // ------------------------------------------- @@ -368,7 +368,7 @@ public class BatchTestITCase extends AbstractTestITCase { // prepare URI targetURI = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Product").appendKeySegment(-10); + appendEntitySetSegment("Product").appendKeySegment(-10); // create new request queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build()); @@ -392,7 +392,7 @@ public class BatchTestITCase extends AbstractTestITCase { assertEquals("OK", res.getStatusMessage()); ODataEntityRequestImpl.ODataEntityResponseImpl entres = - (ODataEntityRequestImpl.ODataEntityResponseImpl) res; + (ODataEntityRequestImpl.ODataEntityResponseImpl) res; ODataEntity entity = entres.getBody(); assertEquals(-10, entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -433,7 +433,7 @@ public class BatchTestITCase extends AbstractTestITCase { entres = (ODataEntityRequestImpl.ODataEntityResponseImpl) res; entity = entres.getBody(); assertEquals("new description from batch", - entity.getProperty("Description").getPrimitiveValue().toCastValue(String.class)); + entity.getProperty("Description").getPrimitiveValue().toCastValue(String.class)); assertFalse(iter.hasNext()); } @@ -444,13 +444,13 @@ public class BatchTestITCase extends AbstractTestITCase { super(new Wrapper>()); } - public ODataPayloadManager addObject(byte[] src) { + public ODataPayloadManager addObject(final byte[] src) { stream(src); return this; } @Override - protected ODataBatchResponse getResponse(long timeout, TimeUnit unit) { + protected ODataBatchResponse getResponse(final long timeout, final TimeUnit unit) { throw new UnsupportedOperationException("Not supported yet."); } }; @@ -492,35 +492,4 @@ public class BatchTestITCase extends AbstractTestITCase { } } } - - private static class BatchStreamingThread extends Thread { - - private final BatchManager streaming; - - public BatchStreamingThread(final BatchManager streaming) { - this.streaming = streaming; - } - - @Override - public void run() { - try { - final StringBuilder builder = new StringBuilder(); - - byte[] buff = new byte[1024]; - - int len; - - while ((len = streaming.getBody().read(buff)) >= 0) { - builder.append(new String(buff, 0, len)); - } - - LOG.debug("Batch request {}", builder.toString()); - - assertTrue(builder.toString().contains("Content-Id:2")); - assertTrue(builder.toString().contains("GET " + testStaticServiceRootURL)); - } catch (IOException e) { - fail(); - } - } - } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java index 673acdf..2faf5cd 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/CountTestITCase.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. */ @@ -34,7 +34,7 @@ public class CountTestITCase extends AbstractTestITCase { @Test public void entityCount() { CommonURIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Customer").count(); + appendEntitySetSegment("Customer").count(); final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); try { @@ -48,7 +48,7 @@ public class CountTestITCase extends AbstractTestITCase { @Test public void invalidAccept() { final CommonURIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Customer").count(); + appendEntitySetSegment("Customer").count(); final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build()); req.setFormat(ODataFormat.TEXT_PLAIN); req.setAccept("application/json;odata=fullmetadata"); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/EntityCreateTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/EntityCreateTestITCase.java index 04fb6c1..afc3954 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/EntityCreateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/EntityCreateTestITCase.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. */ @@ -93,7 +93,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { createEntity(getServiceRoot(), format, original, "Customer"); final ODataEntity actual = - compareEntities(getServiceRoot(), format, original, id, Collections.singleton("Info")); + compareEntities(getServiceRoot(), format, original, id, Collections. singleton("Info")); cleanAfterCreate(format, actual, true, getServiceRoot()); } @@ -107,7 +107,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { createEntity(getServiceRoot(), format, original, "Customer"); final ODataEntity actual = - compareEntities(getServiceRoot(), format, original, id, Collections.singleton("Info")); + compareEntities(getServiceRoot(), format, original, id, Collections. singleton("Info")); cleanAfterCreate(format, actual, true, getServiceRoot()); } @@ -119,11 +119,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false); original.addLink(client.getObjectFactory().newDeepInsertEntity( - "Info", getSampleCustomerInfo("Sample Customer_Info"))); + "Info", getSampleCustomerInfo("Sample Customer_Info"))); createEntity(getServiceRoot(), format, original, "Customer"); final ODataEntity actual = - compareEntities(getServiceRoot(), format, original, id, Collections.singleton("Info")); + compareEntities(getServiceRoot(), format, original, id, Collections. singleton("Info")); boolean found = false; @@ -146,11 +146,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false); original.addLink(client.getObjectFactory().newDeepInsertEntity( - "Info", getSampleCustomerInfo("Sample Customer_Info"))); + "Info", getSampleCustomerInfo("Sample Customer_Info"))); createEntity(getServiceRoot(), format, original, "Customer"); final ODataEntity actual = - compareEntities(getServiceRoot(), format, original, id, Collections.singleton("Info")); + compareEntities(getServiceRoot(), format, original, id, Collections. singleton("Info")); boolean found = false; @@ -227,13 +227,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false); final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest( - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original); + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original); createReq.setPrefer(client.newPreferences().returnNoContent()); final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(204, createRes.getStatusCode()); assertEquals(client.newPreferences().returnNoContent(), - createRes.getHeader(HeaderName.preferenceApplied).iterator().next()); + createRes.getHeader(HeaderName.preferenceApplied).iterator().next()); try { createRes.getBody(); @@ -243,8 +243,8 @@ public class EntityCreateTestITCase extends AbstractTestITCase { } final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest( - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id).build()). - execute(); + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id).build()). + execute(); assertEquals(204, deleteRes.getStatusCode()); } @@ -255,7 +255,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final URIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer"); final ODataEntityCreateRequest createReq = - client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); + client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original); createReq.setFormat(ODataFormat.JSON_FULL_METADATA); createReq.setContentType(ContentType.APPLICATION_ATOM_XML.getMimeType()); createReq.setPrefer(client.newPreferences().returnContent()); @@ -267,15 +267,15 @@ public class EntityCreateTestITCase extends AbstractTestITCase { fail(e.getMessage()); } finally { final ODataDeleteResponse deleteRes = client.getCUDRequestFactory().getDeleteRequest( - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id). + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").appendKeySegment(id). build()). - execute(); + execute(); assertEquals(204, deleteRes.getStatusCode()); } } private ODataEntity createWithFeedNavigationLink(final ODataFormat format, final int id) - throws EdmPrimitiveTypeException { + throws EdmPrimitiveTypeException { final String sampleName = "Sample customer"; final ODataEntity original = getSampleCustomerProfile(id, sampleName, false); @@ -286,20 +286,20 @@ public class EntityCreateTestITCase extends AbstractTestITCase { for (Integer key : keys) { final ODataEntity order = client.getObjectFactory(). - newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Order")); + newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Order")); order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId", - client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(key))); + client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(key))); order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId", - client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest( - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order); + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order); createReq.setFormat(format); original.addLink(client.getObjectFactory().newEntitySetNavigationLink( - "Orders", - createReq.execute().getBody().getEditLink())); + "Orders", + createReq.execute().getBody().getEditLink())); } final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer"); @@ -310,7 +310,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders"); final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). - getEntitySetRequest(uriBuilder.build()); + getEntitySetRequest(uriBuilder.build()); req.setFormat(format); final ODataRetrieveResponse res = req.execute(); @@ -328,7 +328,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { keys.remove(key); final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest( - URIUtils.getURI(getServiceRoot(), entity.getEditLink().toASCIIString())); + URIUtils.getURI(getServiceRoot(), entity.getEditLink().toASCIIString())); deleteReq.setFormat(format); assertEquals(204, deleteReq.execute().getStatusCode()); @@ -342,7 +342,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { final ODataEntity original = getSampleCustomerProfile(id, sampleName, false); original.addLink(client.getObjectFactory().newEntityNavigationLink( - "Info", URI.create(getServiceRoot() + "/CustomerInfo(12)"))); + "Info", URI.create(getServiceRoot() + "/CustomerInfo(12)"))); final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer"); // now, compare the created one with the actual one and go deeply into the associated customer info..... @@ -375,7 +375,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { } private ODataEntity createWithBackNavigationLink(final ODataFormat format, final int id) - throws EdmPrimitiveTypeException { + throws EdmPrimitiveTypeException { final String sampleName = "Sample customer"; @@ -383,48 +383,48 @@ public class EntityCreateTestITCase extends AbstractTestITCase { customer = createEntity(getServiceRoot(), format, customer, "Customer"); ODataEntity order = client.getObjectFactory().newEntity(new FullQualifiedName( - "Microsoft.Test.OData.Services.AstoriaDefaultService.Order")); + "Microsoft.Test.OData.Services.AstoriaDefaultService.Order")); getClient().getBinder().add(order, - client.getObjectFactory().newPrimitiveProperty("CustomerId", - client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + client.getObjectFactory().newPrimitiveProperty("CustomerId", + client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); getClient().getBinder().add(order, - client.getObjectFactory().newPrimitiveProperty("OrderId", - client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + client.getObjectFactory().newPrimitiveProperty("OrderId", + client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); order.addLink(client.getObjectFactory().newEntityNavigationLink( - "Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString()))); + "Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString()))); order = createEntity(getServiceRoot(), format, order, "Order"); final ODataEntity changes = client.getObjectFactory().newEntity(new FullQualifiedName( - "Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); + "Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); changes.setEditLink(customer.getEditLink()); changes.addLink(client.getObjectFactory().newEntitySetNavigationLink( - "Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString()))); + "Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString()))); update(UpdateType.PATCH, changes, format, null); final ODataEntityRequest customerreq = client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer")); + URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer")); customerreq.setFormat(format); customer = customerreq.execute().getBody(); assertEquals(Integer.valueOf(id), - customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class)); + customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class)); final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest( - URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders")); + URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders")); orderreq.setFormat(format); final ODataRetrieveResponse orderres = orderreq.execute(); assertEquals(200, orderres.getStatusCode()); assertEquals(Integer.valueOf(id), - orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue(). + orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue(). toCastValue(Integer.class)); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest( - URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders")); + URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders")); req.setFormat(format); customer = req.execute().getBody(); @@ -442,31 +442,31 @@ public class EntityCreateTestITCase extends AbstractTestITCase { private void multiKey(final ODataFormat format) { final ODataEntity message = client.getObjectFactory().newEntity(new FullQualifiedName( - "Microsoft.Test.OData.Services.AstoriaDefaultService.Message")); + "Microsoft.Test.OData.Services.AstoriaDefaultService.Message")); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("MessageId", - client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1000))); + client.getObjectFactory().newPrimitiveProperty("MessageId", + client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1000))); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("FromUsername", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("1"))); + client.getObjectFactory().newPrimitiveProperty("FromUsername", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("1"))); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("ToUsername", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("xlodhxzzusxecbzptxlfxprneoxkn"))); + client.getObjectFactory().newPrimitiveProperty("ToUsername", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("xlodhxzzusxecbzptxlfxprneoxkn"))); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("Subject", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test subject"))); + client.getObjectFactory().newPrimitiveProperty("Subject", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test subject"))); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("Body", - client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test body"))); + client.getObjectFactory().newPrimitiveProperty("Body", + client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test body"))); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("IsRead", - client.getObjectFactory().newPrimitiveValueBuilder().buildBoolean(false))); + client.getObjectFactory().newPrimitiveProperty("IsRead", + client.getObjectFactory().newPrimitiveValueBuilder().buildBoolean(false))); final URIBuilder builder = - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Message"); + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Message"); final ODataEntityCreateRequest req = client.getCUDRequestFactory(). - getEntityCreateRequest(builder.build(), message); + getEntityCreateRequest(builder.build(), message); req.setFormat(format); final ODataEntityCreateResponse res = req.execute(); @@ -478,7 +478,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase { multiKey.put("MessageId", 1000); final ODataDeleteResponse deleteRes = client.getCUDRequestFactory(). - getDeleteRequest(builder.appendKeySegment(multiKey).build()).execute(); + getDeleteRequest(builder.appendKeySegment(multiKey).build()).execute(); assertEquals(204, deleteRes.getStatusCode()); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/EntityRetrieveTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/EntityRetrieveTestITCase.java index 39fc464..fc30086 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/EntityRetrieveTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/EntityRetrieveTestITCase.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. */ @@ -57,7 +57,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void withInlineEntry(final ODataFormat format) { final CommonURIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Info"); + appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Info"); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); @@ -85,9 +85,9 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { assertEquals(2, properties.size()); assertTrue(properties.get(0).getName().equals("CustomerInfoId") - || properties.get(1).getName().equals("CustomerInfoId")); + || properties.get(1).getName().equals("CustomerInfoId")); assertTrue(properties.get(0).getValue().toString().equals("11") - || properties.get(1).getValue().toString().equals("11")); + || properties.get(1).getValue().toString().equals("11")); found = true; } @@ -109,7 +109,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void withInlineFeed(final ODataFormat format) { final CommonURIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Orders"); + appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Orders"); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); @@ -147,7 +147,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void rawRequest(final ODataFormat format) { final CommonURIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Car").appendKeySegment(16); + appendEntitySetSegment("Car").appendKeySegment(16); final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build()); req.setFormat(format.getContentType(client.getServiceVersion()).toContentTypeString()); @@ -179,7 +179,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { multiKey.put("MessageId", -10); final CommonURIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Message").appendKeySegment(multiKey); + appendEntitySetSegment("Message").appendKeySegment(multiKey); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); @@ -212,7 +212,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void checkForETag(final ODataFormat format) { final CommonURIBuilder uriBuilder = - client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10); + client.newURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); @@ -241,7 +241,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { private void geospatial(final ODataFormat format) { final URIBuilder uriBuilder = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("AllGeoTypesSet").appendKeySegment(-10); + appendEntitySetSegment("AllGeoTypesSet").appendKeySegment(-10); final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); req.setFormat(format); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/EntitySetTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/EntitySetTestITCase.java index 83a0a5a..ff0b5a8 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/EntitySetTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/EntitySetTestITCase.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. */ @@ -103,7 +103,7 @@ public class EntitySetTestITCase extends AbstractTestITCase { uriBuilder.appendEntitySetSegment("Customer"); final ODataEntitySetRequest req = client.getRetrieveRequestFactory(). - getEntitySetRequest(uriBuilder.build()); + getEntitySetRequest(uriBuilder.build()); req.setFormat(format); final ODataRetrieveResponse res = req.execute(); @@ -127,7 +127,7 @@ public class EntitySetTestITCase extends AbstractTestITCase { uriBuilder.appendEntitySetSegment("Customer"); final ODataEntitySetIteratorRequest req = - client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build()); + client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build()); req.setFormat(format); final ODataRetrieveResponse> res = req.execute(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/test/java/org/apache/olingo/fit/v3/EntityUpdateTestITCase.java ---------------------------------------------------------------------- diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/EntityUpdateTestITCase.java index 72f4ed7..8768859 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/EntityUpdateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/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. */ @@ -50,7 +50,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void mergeAsAtom() { final ODataFormat format = ODataFormat.ATOM; final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); final String etag = getETag(uri); final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); merge.setEditLink(uri); @@ -61,7 +61,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void mergeAsJSON() { final ODataFormat format = ODataFormat.JSON_FULL_METADATA; final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); final String etag = getETag(uri); final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); merge.setEditLink(uri); @@ -72,7 +72,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void patchAsAtom() { final ODataFormat format = ODataFormat.ATOM; final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); final String etag = getETag(uri); final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); patch.setEditLink(uri); @@ -83,7 +83,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void patchAsJSON() { final ODataFormat format = ODataFormat.JSON_FULL_METADATA; final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); final String etag = getETag(uri); final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); patch.setEditLink(uri); @@ -94,7 +94,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void replaceAsAtom() { final ODataFormat format = ODataFormat.ATOM; final ODataEntity changes = read(format, client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Car").appendKeySegment(14).build()); + appendEntitySetSegment("Car").appendKeySegment(14).build()); updateEntityDescription(format, changes, UpdateType.REPLACE); } @@ -102,7 +102,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void replaceAsJSON() { final ODataFormat format = ODataFormat.JSON_FULL_METADATA; final ODataEntity changes = read(format, client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Car").appendKeySegment(14).build()); + appendEntitySetSegment("Car").appendKeySegment(14).build()); updateEntityDescription(format, changes, UpdateType.REPLACE); } @@ -118,24 +118,24 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { public void patchLink(final ODataFormat format) throws EdmPrimitiveTypeException { final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Customer").appendKeySegment(-10).build(); + appendEntitySetSegment("Customer").appendKeySegment(-10).build(); final ODataEntity patch = client.getObjectFactory(). - newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); + newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer")); patch.setEditLink(uri); // --------------------------------------- // Update to CustomerInfo(12) // --------------------------------------- URI customerInfoURI = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("CustomerInfo").appendKeySegment(12).build(); + appendEntitySetSegment("CustomerInfo").appendKeySegment(12).build(); patch.addLink(client.getObjectFactory().newEntityNavigationLink("Info", customerInfoURI)); update(UpdateType.PATCH, patch, format, null); customerInfoURI = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build(); + appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build(); ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI); req.setFormat(format); @@ -143,7 +143,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { ODataEntity newInfo = req.execute().getBody(); assertEquals(Integer.valueOf(12), - newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); + newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); // --------------------------------------- // --------------------------------------- @@ -152,7 +152,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { patch.getNavigationLinks().clear(); customerInfoURI = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("CustomerInfo").appendKeySegment(11).build(); + appendEntitySetSegment("CustomerInfo").appendKeySegment(11).build(); read(format, customerInfoURI); patch.addLink(client.getObjectFactory().newEntityNavigationLink("Info", customerInfoURI)); @@ -160,7 +160,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { update(UpdateType.PATCH, patch, format, null); customerInfoURI = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build(); + appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build(); req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI); req.setFormat(format); @@ -168,26 +168,26 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { newInfo = req.execute().getBody(); assertEquals(Integer.valueOf(11), - newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); + newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class)); // --------------------------------------- } private ODataEntityUpdateRequest buildMultiKeyUpdateReq(final ODataFormat format) - throws EdmPrimitiveTypeException { + throws EdmPrimitiveTypeException { final LinkedHashMap multiKey = new LinkedHashMap(); multiKey.put("FromUsername", "1"); multiKey.put("MessageId", -10); final ODataEntity message = read(format, client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Message").appendKeySegment(multiKey).build()); + appendEntitySetSegment("Message").appendKeySegment(multiKey).build()); message.getAssociationLinks().clear(); message.getNavigationLinks().clear(); final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class); message.getProperties().remove(message.getProperty("IsRead")); getClient().getBinder().add(message, - client.getObjectFactory().newPrimitiveProperty("IsRead", - client.getObjectFactory().newPrimitiveValueBuilder().buildBoolean(!before))); + client.getObjectFactory().newPrimitiveProperty("IsRead", + client.getObjectFactory().newPrimitiveValueBuilder().buildBoolean(!before))); return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message); } @@ -210,30 +210,30 @@ public class EntityUpdateTestITCase extends AbstractTestITCase { @Test public void updateReturnContent() throws EdmPrimitiveTypeException { final ODataEntityUpdateRequest req = - buildMultiKeyUpdateReq(client.getConfiguration().getDefaultPubFormat()); + buildMultiKeyUpdateReq(client.getConfiguration().getDefaultPubFormat()); req.setPrefer(client.newPreferences().returnContent()); final ODataEntityUpdateResponse res = req.execute(); assertEquals(200, res.getStatusCode()); assertEquals(client.newPreferences().returnContent(), - res.getHeader(HeaderName.preferenceApplied).iterator().next()); + res.getHeader(HeaderName.preferenceApplied).iterator().next()); assertNotNull(res.getBody()); } @Test public void concurrentModification() { final URI uri = client.newURIBuilder(getServiceRoot()). - appendEntitySetSegment("Product").appendKeySegment(-10).build(); + appendEntitySetSegment("Product").appendKeySegment(-10).build(); String etag = getETag(uri); final ODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE); product.setEditLink(uri); updateEntityStringProperty("BaseConcurrency", - client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag); + client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag); try { etag += "-invalidone"; updateEntityStringProperty("BaseConcurrency", - client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag); + client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag); fail(); } catch (ODataClientErrorException e) { assertEquals(412, e.getStatusLine().getStatusCode());