mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [01/16] mina-sshd git commit: [SSHD-698] Code cleanup
Date Thu, 15 Sep 2016 19:34:38 GMT
Repository: mina-sshd
Updated Branches:
  refs/heads/master 13989b4f2 -> 977b7b529


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
index 13ce2a9..4cc8fc5 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/channel/ChannelSessionTest.java
@@ -53,7 +53,7 @@ public class ChannelSessionTest extends BaseTestSupport {
         try (ChannelSession channelSession = new ChannelSession() {
                 {
                     Window wRemote = getRemoteWindow();
-                    wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.<String,
Object>emptyMap()));
+                    wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
                 }
         }) {
             final AtomicBoolean expanded = new AtomicBoolean(false);
@@ -75,7 +75,7 @@ public class ChannelSessionTest extends BaseTestSupport {
         try (ChannelSession session = new ChannelSession() {
             {
                 Window wRemote = getRemoteWindow();
-                wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.<String,
Object>emptyMap()));
+                wRemote.init(PropertyResolverUtils.toPropertyResolver(Collections.emptyMap()));
             }
         }) {
             session.addCloseFutureListener(new SshFutureListener<CloseFuture>() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
index e15aa44..5b41665 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/shell/TtyFilterOutputStreamTest.java
@@ -77,9 +77,9 @@ public class TtyFilterOutputStreamTest extends BaseTestSupport {
                     }
                 }
             };
-            TtyFilterOutputStream ttyOut = new TtyFilterOutputStream(
-                    output, null, PtyMode.ECHO.equals(mode) ? Collections.<PtyMode>emptySet()
: EnumSet.of(mode));
-            Writer writer = new OutputStreamWriter(ttyOut, StandardCharsets.UTF_8)) {
+             TtyFilterOutputStream ttyOut = new TtyFilterOutputStream(
+                    output, null, PtyMode.ECHO.equals(mode) ? Collections.emptySet() : EnumSet.of(mode));
+             Writer writer = new OutputStreamWriter(ttyOut, StandardCharsets.UTF_8)) {
 
             for (String l : lines) {
                 writer.append(l).append("\r\n");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
b/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
index 4cc9472..7c328a1 100644
--- a/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
+++ b/sshd-core/src/test/java/org/apache/sshd/server/subsystem/sftp/SshFsMounter.java
@@ -32,7 +32,6 @@ import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.config.SshConfigFileReader;
 import org.apache.sshd.common.io.IoServiceFactory;
 import org.apache.sshd.common.io.mina.MinaServiceFactory;
@@ -319,7 +318,7 @@ public final class SshFsMounter {
         sshd.setPasswordAuthenticator(AcceptAllPasswordAuthenticator.INSTANCE);
         sshd.setTcpipForwardingFilter(AcceptAllForwardingFilter.INSTANCE);
         sshd.setCommandFactory(new ScpCommandFactory.Builder().withDelegate(MounterCommandFactory.INSTANCE).build());
-        sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new
SftpSubsystemFactory()));
+        sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
         sshd.start();
 
         Thread.sleep(Long.MAX_VALUE);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
index 761075b..7f4eaab 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/BaseTestSupport.java
@@ -137,7 +137,7 @@ public abstract class BaseTestSupport extends Assert {
      * @see #getTargetRelativeFile(Collection)
      */
     protected Path getTempTargetRelativeFile(String ... comps) {
-        return getTempTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList()
: Arrays.asList(comps));
+        return getTempTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList()
: Arrays.asList(comps));
     }
 
     /**
@@ -176,7 +176,7 @@ public abstract class BaseTestSupport extends Assert {
      * @return The {@link Path} representing the result - same as target folder if no components
      */
     protected Path getTargetRelativeFile(String ... comps) {
-        return getTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.<String>emptyList()
: Arrays.asList(comps));
+        return getTargetRelativeFile(GenericUtils.isEmpty(comps) ? Collections.emptyList()
: Arrays.asList(comps));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java b/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
index 637ce43..76a8d5d 100644
--- a/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
+++ b/sshd-core/src/test/java/org/apache/sshd/util/test/EchoShell.java
@@ -35,10 +35,7 @@ public class EchoShell extends CommandExecutionHelper {
         out.write((command + "\n").getBytes(StandardCharsets.UTF_8));
         out.flush();
 
-        if ("exit".equals(command)) {
-            return false;
-        }
+        return !"exit".equals(command);
 
-        return true;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java b/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
index bc26a9c..2bca899 100644
--- a/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
+++ b/sshd-git/src/test/java/org/apache/sshd/git/pack/GitPackCommandTest.java
@@ -24,10 +24,8 @@ import java.util.Collections;
 
 import com.jcraft.jsch.JSch;
 
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.git.transport.GitSshdSessionFactory;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.auth.password.AcceptAllPasswordAuthenticator;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
@@ -73,7 +71,7 @@ public class GitPackCommandTest extends BaseTestSupport {
 
         try (SshServer sshd = setupTestServer()) {
             Path serverRootDir = gitRootDir.resolve("server");
-            sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new
SftpSubsystemFactory()));
+            sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
             sshd.setCommandFactory(new GitPackCommandFactory(Utils.resolveRelativeRemotePath(targetParent,
serverRootDir)));
             sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java b/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
index 1898a47..4b4fda8 100644
--- a/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
+++ b/sshd-git/src/test/java/org/apache/sshd/git/pgm/GitPgmCommandTest.java
@@ -29,9 +29,7 @@ import org.apache.sshd.client.SshClient;
 import org.apache.sshd.client.channel.ChannelExec;
 import org.apache.sshd.client.channel.ClientChannelEvent;
 import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.common.NamedFactory;
 import org.apache.sshd.common.util.net.SshdSocketAddress;
-import org.apache.sshd.server.Command;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
 import org.apache.sshd.util.test.BaseTestSupport;
@@ -60,7 +58,7 @@ public class GitPgmCommandTest extends BaseTestSupport {
         //
 
         try (SshServer sshd = setupTestServer()) {
-            sshd.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new
SftpSubsystemFactory()));
+            sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
             sshd.setCommandFactory(new GitPgmCommandFactory(Utils.resolveRelativeRemotePath(targetParent,
serverDir)));
             sshd.start();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/57f6a6b0/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
----------------------------------------------------------------------
diff --git a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
index 2584ba3..6a3d5a0 100644
--- a/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
+++ b/sshd-ldap/src/main/java/org/apache/sshd/server/auth/pubkey/LdapPublickeyAuthenticator.java
@@ -179,7 +179,7 @@ public class LdapPublickeyAuthenticator extends LdapAuthenticator implements
Pub
         }
 
         PublicKey k = parsePublicKeyValue(username, expected, session, attrs, keyData);
-        return (k == null) ? Collections.<PublicKey>emptyList() : Collections.singletonList(k);
+        return (k == null) ? Collections.emptyList() : Collections.singletonList(k);
     }
 
     /**


Mime
View raw message