mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
license headers in tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package net.schmizz.sshj;/*
|
||||
/*
|
||||
* Copyright 2010 Shikhar Bhushan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -13,6 +13,7 @@ package net.schmizz.sshj;/*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package net.schmizz.sshj;
|
||||
|
||||
import net.schmizz.sshj.transport.TransportException;
|
||||
import net.schmizz.sshj.userauth.UserAuthException;
|
||||
@@ -48,7 +49,8 @@ public class SmokeTest {
|
||||
private static final String fingerprint = "ce:a7:c1:cf:17:3f:96:49:6a:53:1a:05:0b:ba:90:db";
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
public void setUp()
|
||||
throws IOException {
|
||||
ServerSocket s = new ServerSocket(0);
|
||||
port = s.getLocalPort();
|
||||
s.close();
|
||||
@@ -65,20 +67,23 @@ public class SmokeTest {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearUp() throws IOException, InterruptedException {
|
||||
public void tearUp()
|
||||
throws IOException, InterruptedException {
|
||||
ssh.disconnect();
|
||||
sshd.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuthenticate() throws IOException {
|
||||
public void testAuthenticate()
|
||||
throws IOException {
|
||||
connect();
|
||||
authenticate();
|
||||
assertTrue(ssh.isAuthenticated());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConnect() throws IOException {
|
||||
public void testConnect()
|
||||
throws IOException {
|
||||
connect();
|
||||
assertTrue(ssh.isConnected());
|
||||
}
|
||||
@@ -97,11 +102,13 @@ public class SmokeTest {
|
||||
// assertFalse(shell.isOpen());
|
||||
// }
|
||||
|
||||
private void authenticate() throws UserAuthException, TransportException {
|
||||
private void authenticate()
|
||||
throws UserAuthException, TransportException {
|
||||
ssh.authPassword("same", "same");
|
||||
}
|
||||
|
||||
private void connect() throws IOException {
|
||||
private void connect()
|
||||
throws IOException {
|
||||
ssh.connect(hostname, port);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
/*
|
||||
* 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
|
||||
* Copyright 2010 Shikhar Bhushan
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Licensed 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
|
||||
*
|
||||
* 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.
|
||||
* 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 net.schmizz.sshj.keyprovider;
|
||||
|
||||
@@ -82,7 +79,8 @@ public class OpenSSHKeyFileTest {
|
||||
};
|
||||
|
||||
@Test
|
||||
public void blankingOut() throws IOException, GeneralSecurityException {
|
||||
public void blankingOut()
|
||||
throws IOException, GeneralSecurityException {
|
||||
FileKeyProvider dsa = new OpenSSHKeyFile();
|
||||
dsa.init(new File("src/test/resources/id_dsa"), PasswordUtils.createOneOff(correctPassphrase));
|
||||
assertEquals(KeyUtil.newDSAPrivateKey(x, p, q, g), dsa.getPrivate());
|
||||
@@ -93,7 +91,8 @@ public class OpenSSHKeyFileTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getters() throws IOException, GeneralSecurityException {
|
||||
public void getters()
|
||||
throws IOException, GeneralSecurityException {
|
||||
FileKeyProvider dsa = new OpenSSHKeyFile();
|
||||
dsa.init(new File("src/test/resources/id_dsa"), onlyGivesWhenReady);
|
||||
assertEquals(dsa.getType(), KeyType.DSA);
|
||||
@@ -103,14 +102,16 @@ public class OpenSSHKeyFileTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void retries() throws IOException, GeneralSecurityException {
|
||||
public void retries()
|
||||
throws IOException, GeneralSecurityException {
|
||||
FileKeyProvider dsa = new OpenSSHKeyFile();
|
||||
dsa.init(new File("src/test/resources/id_dsa"), givesOn3rdTry);
|
||||
assertEquals(KeyUtil.newDSAPrivateKey(x, p, q, g), dsa.getPrivate());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() throws UnsupportedEncodingException, GeneralSecurityException {
|
||||
public void setup()
|
||||
throws UnsupportedEncodingException, GeneralSecurityException {
|
||||
if (!SecurityUtils.isBouncyCastleRegistered())
|
||||
throw new AssertionError("bouncy castle needed");
|
||||
}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
/*
|
||||
* 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
|
||||
* Copyright 2010 Shikhar Bhushan
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Licensed 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
|
||||
*
|
||||
* 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.
|
||||
* 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 net.schmizz.sshj.keyprovider;
|
||||
|
||||
@@ -42,20 +39,23 @@ public class PKCS8KeyFileTest {
|
||||
static final String privExp = "57bcee2e2656eb2c94033d802dd62d726c6705fabad1fd0df86b67600a96431301620d395cbf5871c7af3d3974dfe5c30f5c60d95d7e6e75df69ed6c5a36a9c8aef554b5058b76a719b8478efa08ad1ebf08c8c25fe4b9bc0bfbb9be5d4f60e6213b4ab1c26ad33f5bba7d93e1cd65f65f5a79eb6ebfb32f930a2b0244378b4727acf83b5fb376c38d4abecc5dc3fc399e618e792d4c745d2dbbb9735242e5033129f2985ca3e28fa33cad2afe3e70e1b07ed2b6ec8a3f843fb4bffe3385ad211c6600618488f4ac70397e8eb036b82d811283dc728504cddbe1533c4dd31b1ec99ffa74fd0e3883a9cb3e2315cc1a56f55d38ed40520dd9ec91b4d2dd790d1b";
|
||||
|
||||
@Before
|
||||
public void setUp() throws UnsupportedEncodingException, GeneralSecurityException {
|
||||
public void setUp()
|
||||
throws UnsupportedEncodingException, GeneralSecurityException {
|
||||
if (!SecurityUtils.isBouncyCastleRegistered())
|
||||
throw new AssertionError("bouncy castle needed");
|
||||
rsa.init(new File("src/test/resources/id_rsa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeys() throws IOException, GeneralSecurityException {
|
||||
public void testKeys()
|
||||
throws IOException, GeneralSecurityException {
|
||||
assertEquals(KeyUtil.newRSAPublicKey(modulus, pubExp), rsa.getPublic());
|
||||
assertEquals(KeyUtil.newRSAPrivateKey(modulus, privExp), rsa.getPrivate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testType() throws IOException {
|
||||
public void testType()
|
||||
throws IOException {
|
||||
assertEquals(rsa.getType(), KeyType.RSA);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user