-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
312 changed files
with
7,974 additions
and
7,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,34 +24,28 @@ | |
|
||
import org.apache.sshd.common.util.GenericUtils; | ||
import org.apache.sshd.util.test.BaseTestSupport; | ||
import org.apache.sshd.util.test.JUnit4ClassRunnerWithParametersFactory; | ||
import org.apache.sshd.util.test.NoIoTestCase; | ||
import org.junit.FixMethodOrder; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.MethodSorters; | ||
import org.junit.runners.Parameterized; | ||
import org.junit.runners.Parameterized.Parameters; | ||
import org.junit.runners.Parameterized.UseParametersRunnerFactory; | ||
import org.junit.jupiter.api.MethodOrderer.MethodName; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> | ||
*/ | ||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) | ||
@Category({ NoIoTestCase.class }) | ||
@RunWith(Parameterized.class) // see https://github.com/junit-team/junit/wiki/Parameterized-tests | ||
@UseParametersRunnerFactory(JUnit4ClassRunnerWithParametersFactory.class) | ||
@TestMethodOrder(MethodName.class) | ||
@Tag("NoIoTestCase") // see https://github.com/junit-team/junit/wiki/Parameterized-tests | ||
public class CliSupportSplitCommandLineArgumentsTest extends BaseTestSupport { | ||
private final String line; | ||
private final String[] expected; | ||
private String line; | ||
private String[] expected; | ||
|
||
public CliSupportSplitCommandLineArgumentsTest(String line, String[] expected) { | ||
public void initCliSupportSplitCommandLineArgumentsTest(String line, String[] expected) { | ||
this.line = line; | ||
this.expected = expected; | ||
} | ||
|
||
@Parameters(name = "{0}") | ||
public static List<Object[]> parameters() { | ||
return new ArrayList<Object[]>() { | ||
// not serializing it | ||
|
@@ -86,8 +80,10 @@ private void addTestCase(String line, String... expected) { | |
}; | ||
} | ||
|
||
@Test | ||
public void testSplitCommandLineArguments() { | ||
@MethodSource("parameters") | ||
@ParameterizedTest(name = "{0}") | ||
public void splitCommandLineArguments(String line, String[] expected) { | ||
initCliSupportSplitCommandLineArgumentsTest(line, expected); | ||
String[] actual = CliSupport.splitCommandLineArguments(line); | ||
assertArrayEquals(expected, actual); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,24 +29,25 @@ | |
import java.util.List; | ||
|
||
import org.apache.sshd.util.test.JUnitTestSupport; | ||
import org.apache.sshd.util.test.NoIoTestCase; | ||
import org.junit.FixMethodOrder; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.junit.runners.MethodSorters; | ||
import org.junit.jupiter.api.MethodOrderer.MethodName; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> | ||
*/ | ||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) | ||
@Category({ NoIoTestCase.class }) | ||
@TestMethodOrder(MethodName.class) | ||
@Tag("NoIoTestCase") | ||
public class PasswordIdentityProviderTest extends JUnitTestSupport { | ||
public PasswordIdentityProviderTest() { | ||
super(); | ||
} | ||
|
||
@Test | ||
public void testMultiProvider() throws IOException, GeneralSecurityException { | ||
void multiProvider() throws IOException, GeneralSecurityException { | ||
String[][] values = { | ||
{ getClass().getSimpleName(), getCurrentTestName() }, | ||
{ new Date(System.currentTimeMillis()).toString() }, | ||
|
@@ -69,7 +70,7 @@ public void testMultiProvider() throws IOException, GeneralSecurityException { | |
|
||
private static void assertProviderContents(String message, PasswordIdentityProvider p, Iterable<String> expected) | ||
throws IOException, GeneralSecurityException { | ||
assertNotNull(message + ": no provider", p); | ||
assertNotNull(p, message + ": no provider"); | ||
assertEquals(message, expected, p.loadPasswords(null)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,24 +35,30 @@ | |
|
||
import org.apache.sshd.common.util.io.IoUtils; | ||
import org.apache.sshd.util.test.JUnitTestSupport; | ||
import org.apache.sshd.util.test.NoIoTestCase; | ||
import org.junit.FixMethodOrder; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.junit.runners.MethodSorters; | ||
import org.junit.jupiter.api.MethodOrderer.MethodName; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNotSame; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a> | ||
*/ | ||
@FixMethodOrder(MethodSorters.NAME_ASCENDING) | ||
@Category({ NoIoTestCase.class }) | ||
@TestMethodOrder(MethodName.class) | ||
@Tag("NoIoTestCase") | ||
public class ConfigFileHostEntryResolverTest extends JUnitTestSupport { | ||
public ConfigFileHostEntryResolverTest() { | ||
super(); | ||
} | ||
|
||
@Test | ||
public void testIdentityFilePaths() throws IOException { | ||
void identityFilePaths() throws IOException { | ||
final String config = "IdentityFile ~/.ssh/%r.key0\n" // | ||
+ "Host foo\n" // | ||
+ "IdentityFile ~/.ssh/%r.key1\n" // | ||
|
@@ -84,7 +90,7 @@ public void testIdentityFilePaths() throws IOException { | |
} | ||
|
||
@Test | ||
public void testConfigFileReload() throws IOException { | ||
void configFileReload() throws IOException { | ||
Path dir = getTempTargetRelativeFile(getClass().getSimpleName()); | ||
AtomicInteger reloadCount = new AtomicInteger(); | ||
ConfigFileHostEntryResolver resolver = new ConfigFileHostEntryResolver( | ||
|
@@ -159,22 +165,21 @@ private static void testConfigFileReload( | |
null); | ||
|
||
if (entries == null) { | ||
assertEquals(phase + "[" + index + "]: mismatched reload count", 0, reloadCount.get()); | ||
assertEquals(0, reloadCount.get(), phase + "[" + index + "]: mismatched reload count"); | ||
} else { | ||
assertEquals(phase + "[" + index + "]: mismatched reload count", 1, reloadCount.get()); | ||
assertEquals(1, reloadCount.get(), phase + "[" + index + "]: mismatched reload count"); | ||
} | ||
|
||
if (expected == null) { | ||
assertNull(phase + "[" + index + "]: Unexpected success for " + query, actual); | ||
assertNull(actual, phase + "[" + index + "]: Unexpected success for " + query); | ||
} else { | ||
assertNotNull(phase + "[" + index + "]: No result for " + query, actual); | ||
assertNotSame(phase + "[" + index + "]: No cloned result for " + query, expected, actual); | ||
assertEquals(phase + "[" + index + "]: Mismatched host for " + query, | ||
expected.getHostName(), actual.getHostName()); | ||
assertEquals(phase + "[" + index + "]: Mismatched port for " + query, | ||
expected.getPort(), actual.getPort()); | ||
assertEquals(phase + "[" + index + "]: Mismatched user for " + query, | ||
expected.getUsername(), actual.getUsername()); | ||
assertNotNull(actual, phase + "[" + index + "]: No result for " + query); | ||
assertNotSame(expected, actual, phase + "[" + index + "]: No cloned result for " + query); | ||
assertEquals(expected.getHostName(), actual.getHostName(), | ||
phase + "[" + index + "]: Mismatched host for " + query); | ||
assertEquals(expected.getPort(), actual.getPort(), phase + "[" + index + "]: Mismatched port for " + query); | ||
assertEquals(expected.getUsername(), actual.getUsername(), | ||
phase + "[" + index + "]: Mismatched user for " + query); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.