Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x cc5528c8a -> 7a2a43596


Fixed the CS errors in camel-2.14.x


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

Branch: refs/heads/camel-2.14.x
Commit: 7a2a4359682bcecd08c667f3817c52843fe280c4
Parents: cc5528c
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Wed May 27 10:49:13 2015 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Wed May 27 10:49:32 2015 +0800

----------------------------------------------------------------------
 .../remote/FtpBadLoginConnectionLeakTest.java   | 12 ++++++-----
 ...FtpBadLoginInProducerConnectionLeakTest.java | 14 +++++++------
 .../FtpBadLoginMockNoopConnectionLeakTest.java  | 21 ++++++++++----------
 .../camel/component/hdfs/HdfsConsumerTest.java  |  7 +++----
 .../camel/component/hdfs2/HdfsConsumerTest.java |  7 +++----
 .../hdfs2/integration/HdfsAppendTest.java       |  2 +-
 .../HdfsProducerConsumerIntegrationTest.java    | 15 ++++----------
 7 files changed, 37 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
index 13c8a16..b62ecaf 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java
@@ -37,8 +37,8 @@ public class FtpBadLoginConnectionLeakTest extends 
FtpServerTestSupport {
     private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, 
boolean[]>();
 
     private String getFtpUrl() {
-        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber" +
-                
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
+        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber" 
+            + 
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
     }
 
     @Override
@@ -101,7 +101,7 @@ public class FtpBadLoginConnectionLeakTest extends 
FtpServerTestSupport {
         @Override
         public Socket createSocket() throws IOException {
             AuditingSocket socket = new AuditingSocket();
-            socketAudits.put(System.identityHashCode(socket), new boolean[] { 
false, false });
+            socketAudits.put(System.identityHashCode(socket), new boolean[] 
{false, false});
             return socket;
         }
 
@@ -119,13 +119,15 @@ public class FtpBadLoginConnectionLeakTest extends 
FtpServerTestSupport {
         @Override
         public void connect(SocketAddress endpoint, int timeout) throws 
IOException {
             super.connect(endpoint, timeout);
-            socketAudits.get(System.identityHashCode(this))[0] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[0] = true;
         }
 
         @Override
         public synchronized void close() throws IOException {
             super.close();
-            socketAudits.get(System.identityHashCode(this))[1] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
index 92d223f..837f37c 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java
@@ -36,8 +36,8 @@ public class FtpBadLoginInProducerConnectionLeakTest extends 
FtpServerTestSuppor
     private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, 
boolean[]>();
 
     private String getFtpUrl() {
-        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber&maximumReconnectAttempts=3" +
-                
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
+        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber&maximumReconnectAttempts=3"
+            + 
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
     }
 
     @Override
@@ -51,7 +51,7 @@ public class FtpBadLoginInProducerConnectionLeakTest extends 
FtpServerTestSuppor
 
     @Test
     public void testConnectionLeak() throws Exception {
-        for (String filename : new String[] { "claus.txt", "grzegorz.txt" }) {
+        for (String filename : new String[] {"claus.txt", "grzegorz.txt"}) {
             try {
                 sendFile(getFtpUrl(), "Hello World", filename);
             } catch (Exception ignored) {
@@ -93,7 +93,7 @@ public class FtpBadLoginInProducerConnectionLeakTest extends 
FtpServerTestSuppor
         @Override
         public Socket createSocket() throws IOException {
             AuditingSocket socket = new AuditingSocket();
-            socketAudits.put(System.identityHashCode(socket), new boolean[] { 
false, false });
+            socketAudits.put(System.identityHashCode(socket), new boolean[] 
{false, false});
             return socket;
         }
 
@@ -111,13 +111,15 @@ public class FtpBadLoginInProducerConnectionLeakTest 
extends FtpServerTestSuppor
         @Override
         public void connect(SocketAddress endpoint, int timeout) throws 
IOException {
             super.connect(endpoint, timeout);
-            socketAudits.get(System.identityHashCode(this))[0] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[0] = true;
         }
 
         @Override
         public synchronized void close() throws IOException {
             super.close();
-            socketAudits.get(System.identityHashCode(this))[1] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
index 3686f3c..44e3198 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java
@@ -34,10 +34,14 @@ import org.junit.Test;
  * Test which checks leaking connections when FTP server returns correct 
status for NOOP operation.
  */
 public class FtpBadLoginMockNoopConnectionLeakTest extends 
FtpServerTestSupport {
+    /**
+     * Mapping of socket hashcode to two element tab ([connect() called, 
close() called])
+     */
+    private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, 
boolean[]>();
 
     private String getFtpUrl() {
-        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber&maximumReconnectAttempts=3" +
-                
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
+        return "ftp://dummy@localhost:"; + getPort() + 
"/badlogin?password=cantremeber&maximumReconnectAttempts=3"
+            + 
"&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf";
     }
 
     @Override
@@ -54,11 +58,6 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends 
FtpServerTestSupport
         });
     }
 
-    /**
-     * Mapping of socket hashcode to two element tab ([connect() called, 
close() called])
-     */
-    private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, 
boolean[]>();
-
     @Override
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jndi = super.createRegistry();
@@ -119,7 +118,7 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends 
FtpServerTestSupport
         @Override
         public Socket createSocket() throws IOException {
             AuditingSocket socket = new AuditingSocket();
-            socketAudits.put(System.identityHashCode(socket), new boolean[] { 
false, false });
+            socketAudits.put(System.identityHashCode(socket), new boolean[] 
{false, false});
             return socket;
         }
 
@@ -138,14 +137,16 @@ public class FtpBadLoginMockNoopConnectionLeakTest 
extends FtpServerTestSupport
         public void connect(SocketAddress endpoint, int timeout) throws 
IOException {
             log.info("Connecting socket {}", System.identityHashCode(this));
             super.connect(endpoint, timeout);
-            socketAudits.get(System.identityHashCode(this))[0] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[0] = true;
         }
 
         @Override
         public synchronized void close() throws IOException {
             log.info("Disconnecting socket {}", System.identityHashCode(this));
             super.close();
-            socketAudits.get(System.identityHashCode(this))[1] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsConsumerTest.java
 
b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsConsumerTest.java
index 92879d3..e3929cf 100644
--- 
a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsConsumerTest.java
+++ 
b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsConsumerTest.java
@@ -59,6 +59,7 @@ import static org.apache.hadoop.io.SequenceFile.createWriter;
 import static org.hamcrest.CoreMatchers.equalTo;
 
 public class HdfsConsumerTest extends HdfsTestSupport {
+    private static final int ITERATIONS = 200;
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -81,7 +82,7 @@ public class HdfsConsumerTest extends HdfsTestSupport {
         deleteDirectory("target/test");
         super.setUp();
     }
-    
+
     @Test
     public void testSimpleConsumer() throws Exception {
         if (!canTest()) {
@@ -117,8 +118,6 @@ public class HdfsConsumerTest extends HdfsTestSupport {
             return;
         }
 
-        int ITERATIONS = 200;
-
         final File dir = new File("target/test/multiple-consumers");
         dir.mkdirs();
         for (int i = 1; i <= ITERATIONS; i++) {
@@ -196,7 +195,7 @@ public class HdfsConsumerTest extends HdfsTestSupport {
         FSDataOutputStream out = fs.create(file);
         // size = 5 times chunk size = 210 bytes
         for (int i = 0; i < 42; ++i) {
-            out.write(new byte[] { 0x61, 0x62, 0x63, 0x64, 0x65 });
+            out.write(new byte[]{0x61, 0x62, 0x63, 0x64, 0x65});
             out.flush();
         }
         out.close();

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/HdfsConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/HdfsConsumerTest.java
 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/HdfsConsumerTest.java
index c9cbbaf..574f81b 100644
--- 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/HdfsConsumerTest.java
+++ 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/HdfsConsumerTest.java
@@ -60,6 +60,7 @@ import static 
org.apache.hadoop.io.SequenceFile.CompressionType;
 import static org.hamcrest.CoreMatchers.equalTo;
 
 public class HdfsConsumerTest extends HdfsTestSupport {
+    private static final int ITERATIONS = 200;
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -82,7 +83,7 @@ public class HdfsConsumerTest extends HdfsTestSupport {
         deleteDirectory("target/test");
         super.setUp();
     }
-    
+
     @Test
     public void testSimpleConsumer() throws Exception {
         if (!canTest()) {
@@ -118,8 +119,6 @@ public class HdfsConsumerTest extends HdfsTestSupport {
             return;
         }
 
-        int ITERATIONS = 200;
-
         final File dir = new File("target/test/multiple-consumers");
         dir.mkdirs();
         for (int i = 1; i <= ITERATIONS; i++) {
@@ -197,7 +196,7 @@ public class HdfsConsumerTest extends HdfsTestSupport {
         FSDataOutputStream out = fs.create(file);
         // size = 5 times chunk size = 210 bytes
         for (int i = 0; i < 42; ++i) {
-            out.write(new byte[] { 0x61, 0x62, 0x63, 0x64, 0x65 });
+            out.write(new byte[]{0x61, 0x62, 0x63, 0x64, 0x65});
             out.flush();
         }
         out.close();

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsAppendTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsAppendTest.java
 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsAppendTest.java
index 5c3f7f8..0018446 100644
--- 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsAppendTest.java
+++ 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsAppendTest.java
@@ -29,6 +29,7 @@ import org.junit.Test;
 
 @Ignore("Must run manual")
 public class HdfsAppendTest extends CamelTestSupport {
+    private static final int ITERATIONS = 10;
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -84,7 +85,6 @@ public class HdfsAppendTest extends CamelTestSupport {
 
     @Test
     public void testAppendWithDynamicFileName() throws Exception {
-        int ITERATIONS = 10;
 
         context.addRoutes(new RouteBuilder() {
             @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/7a2a4359/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsProducerConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsProducerConsumerIntegrationTest.java
 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsProducerConsumerIntegrationTest.java
index c59efc2..cbe2e44 100644
--- 
a/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsProducerConsumerIntegrationTest.java
+++ 
b/components/camel-hdfs2/src/test/java/org/apache/camel/component/hdfs2/integration/HdfsProducerConsumerIntegrationTest.java
@@ -16,25 +16,16 @@
  */
 package org.apache.camel.component.hdfs2.integration;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockComponent;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultScheduledPollConsumerScheduler;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.impl.PropertyPlaceholderDelegateRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -44,10 +35,13 @@ import org.junit.After;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.hamcrest.CoreMatchers.*;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
 
 @Ignore("Must run manual")
 public class HdfsProducerConsumerIntegrationTest extends CamelTestSupport {
+    private static final int ITERATIONS = 400;
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -89,7 +83,6 @@ public class HdfsProducerConsumerIntegrationTest extends 
CamelTestSupport {
     @Test
     // see https://issues.apache.org/jira/browse/CAMEL-7318
     public void testMultipleConsumers() throws Exception {
-        int ITERATIONS = 400;
 
         Path p = new Path("hdfs://localhost:9000/tmp/test/multiple-consumers");
         FileSystem fs = FileSystem.get(p.toUri(), new Configuration());

Reply via email to