You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/01/23 17:21:47 UTC

[4/5] [olingo-117] cleanup, rat and checkstyle issues

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index a02a12b..909ce19 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
 package org.apache.olingo.odata2.fit.client;
 
 import static org.junit.Assert.assertEquals;
@@ -67,7 +85,8 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     private int deletedRoomDataCount = 2;
 
     @Override
-    public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException {
+    public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
+        throws ODataException {
       try {
         ArrayList<Map<String, Object>> deletedRoomData = null;
         ODataResponse response = null;
@@ -152,7 +171,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertEquals(6, sets.size());
   }
 
-  private void testDeltaFeedWithDeltaLink(String contentType) throws Exception {
+  private void testDeltaFeedWithDeltaLink(final String contentType) throws Exception {
     ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
     String deltaLink = feed.getFeedMetadata().getDeltaLink();
 
@@ -174,7 +193,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('4')", deletedEntries.get(1).getUri());
   }
 
-  private void testDeltaFeedWithZeroEntries(String contentType) throws Exception {
+  private void testDeltaFeedWithZeroEntries(final String contentType) throws Exception {
     processor.roomDataCount = 0;
     processor.deletedRoomDataCount = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
index 55b6fef..dfe27fe 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
 package org.apache.olingo.odata2.fit.client.util;
 
 import java.io.IOException;
@@ -38,46 +56,49 @@ public class Client {
 
   private Edm edm;
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port) throws IOException, ODataException,
+  public Client(final String serviceUrl, final Proxy.Type protocol, final String proxy, final int port)
+      throws IOException, ODataException,
       HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
     this.port = port;
-    this.useProxy = true;
-    this.useAuthentication = false;
+    useProxy = true;
+    useAuthentication = false;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl) throws IOException, ODataException, HttpException {
+  public Client(final String serviceUrl) throws IOException, ODataException, HttpException {
     this.serviceUrl = serviceUrl;
-    this.useProxy = false;
-    this.useAuthentication = false;
+    useProxy = false;
+    useAuthentication = false;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port, String username, String password)
+  public Client(final String serviceUrl, final Proxy.Type protocol, final String proxy, final int port,
+      final String username, final String password)
       throws IOException, ODataException, HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
     this.port = port;
-    this.useProxy = true;
+    useProxy = true;
     this.username = username;
     this.password = password;
-    this.useAuthentication = true;
+    useAuthentication = true;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl, String username, String password) throws IOException, ODataException, HttpException {
+  public Client(final String serviceUrl, final String username, final String password) throws IOException,
+      ODataException, HttpException {
     this.serviceUrl = serviceUrl;
-    this.useProxy = false;
+    useProxy = false;
     this.username = username;
     this.password = password;
-    this.useAuthentication = true;
+    useAuthentication = true;
 
     edm = getEdmInternal();
   }
@@ -88,7 +109,7 @@ public class Client {
     return edm;
   }
 
-  private void checkStatus(HttpURLConnection connection) throws IOException, HttpException {
+  private void checkStatus(final HttpURLConnection connection) throws IOException, HttpException {
     if (400 <= connection.getResponseCode() && connection.getResponseCode() <= 599) {
       HttpStatusCodes httpStatusCode = HttpStatusCodes.fromStatusCode(connection.getResponseCode());
       throw new HttpException(httpStatusCode, httpStatusCode.getStatusCode() + " " + httpStatusCode.toString());
@@ -103,12 +124,14 @@ public class Client {
     return edm.getServiceMetadata().getEntitySetInfos();
   }
 
-  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType) throws IOException,
+  public ODataFeed readFeed(final String entityContainerName, final String entitySetName, final String contentType)
+      throws IOException,
       ODataException, HttpException {
     return readFeed(entityContainerName, entitySetName, contentType, null);
   }
 
-  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType, String query)
+  public ODataFeed readFeed(final String entityContainerName, final String entitySetName, final String contentType,
+      final String query)
       throws IOException, ODataException, HttpException {
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
     String relativeUri;
@@ -123,7 +146,7 @@ public class Client {
         EntityProviderReadProperties.init().build());
   }
 
-  private HttpURLConnection connect(String absoluteUri, String contentType, String httpMethod)
+  private HttpURLConnection connect(final String absoluteUri, final String contentType, final String httpMethod)
       throws IOException,
       HttpException {
     URL url = new URL(absoluteUri);
@@ -139,7 +162,7 @@ public class Client {
 
     if (useAuthentication) {
       String authorization = "Basic ";
-      authorization += new String(Base64.encodeBase64((this.username + ":" + this.password).getBytes()));
+      authorization += new String(Base64.encodeBase64((username + ":" + password).getBytes()));
       connection.setRequestProperty("Authorization", authorization);
     }
 
@@ -150,7 +173,8 @@ public class Client {
     return connection;
   }
 
-  private HttpURLConnection connect(String relativeUri, String query, String contentType, String httpMethod)
+  private HttpURLConnection connect(final String relativeUri, final String query, final String contentType,
+      final String httpMethod)
       throws IOException,
       HttpException {
     URL url = new URL(serviceUrl + relativeUri + (query != null ? "?" + query : ""));
@@ -158,7 +182,8 @@ public class Client {
   }
 
   public ODataDeltaFeed
-      readDeltaFeed(String entityContainerName, String entitySetName, String contentType, String deltaLink)
+      readDeltaFeed(final String entityContainerName, final String entitySetName, final String contentType,
+          final String deltaLink)
           throws IOException, ODataException, HttpException {
 
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
index cb35db1..2597518 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
 package org.apache.olingo.odata2.fit.client.util;
 
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
@@ -8,7 +26,7 @@ public class HttpException extends Exception {
 
   private HttpStatusCodes httpStatusCode;
 
-  public HttpException(HttpStatusCodes httpStatusCode, String message) {
+  public HttpException(final HttpStatusCodes httpStatusCode, final String message) {
     super(message);
     this.httpStatusCode = httpStatusCode;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
index 32f196f..7e22a3d 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
@@ -115,7 +115,7 @@ import org.apache.olingo.odata2.ref.processor.ScenarioDataSource.BinaryData;
 
 /**
  * Implementation of the centralized parts of OData processing,
- * allowing to use the simplified {@link DataSource} for the
+ * allowing to use the simplified DataSource for the
  * actual data handling.
  * 
  */
@@ -129,7 +129,7 @@ public class ListsProcessor extends ODataSingleProcessor {
   public ListsProcessor(final ScenarioDataSource dataSource) {
     this(dataSource, new BeanPropertyAccess());
   }
-  
+
   public ListsProcessor(final ScenarioDataSource dataSource, final BeanPropertyAccess valueAccess) {
     this.dataSource = dataSource;
     this.valueAccess = valueAccess;
@@ -212,16 +212,16 @@ public class ListsProcessor extends ODataSingleProcessor {
     return ODataResponse.fromResponse(response).build();
   }
 
-  String percentEncodeNextLink(String link) {
-    if(link == null) {
+  String percentEncodeNextLink(final String link) {
+    if (link == null) {
       return null;
     }
-       
+
     return link.replaceAll("\\$skiptoken=.+?(?:&|$)", "")
         .replaceAll("\\$skip=.+?(?:&|$)", "")
         .replaceFirst("(?:\\?|&)$", ""); // Remove potentially trailing "?" or "&" left over from remove actions
   }
-  
+
   @Override
   public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType)
       throws ODataException {
@@ -913,7 +913,7 @@ public class ListsProcessor extends ODataSingleProcessor {
           keys.isEmpty() ?
               dataSource.readData(startEntitySet) : dataSource.readData(startEntitySet, keys) :
           dataSource.readData(functionImport, functionImportParameters, keys);
-  
+
       EdmEntitySet currentEntitySet =
           functionImport == null ? startEntitySet : functionImport.getEntitySet();
       for (NavigationSegment navigationSegment : navigationSegments) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
index cb055ed..d2f55aa 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
@@ -605,7 +605,7 @@ public class ScenarioDataSource {
       throw new ODataNotImplementedException();
     }
   }
-  
+
   /**
    * Container to store binary data (as byte array) and the associated MIME type.
    */

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java b/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
index bfca445..b695a55 100644
--- a/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
+++ b/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
@@ -26,9 +26,9 @@ import org.junit.Test;
  * 
  */
 public class ListsProcessorTest {
-  
+
   private ListsProcessor listsProcessor;
-  
+
   public ListsProcessorTest() {
     listsProcessor = new ListsProcessor(null);
   }
@@ -68,7 +68,7 @@ public class ListsProcessorTest {
     String url = "Rooms?$orderby=Seats%20desc&$skiptoken=213&$top=200";
     String result = listsProcessor.percentEncodeNextLink(url);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc&$top=200", result);
-    
+
     String url2 = "Rooms?$orderby=Seats%20desc&$skiptoken=213";
     String result2 = listsProcessor.percentEncodeNextLink(url2);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc", result2);