diff --git a/pom.xml b/pom.xml index eac39be8..b995f614 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -43,54 +44,55 @@ org.slf4j slf4j-api - 1.6.1 - - - org.bouncycastle - bcprov-jdk15on - 1.47 + 1.7.5 org.bouncycastle bcpkix-jdk15on - 1.47 - + 1.49 + - junit - junit - 4.8.2 - test + org.bouncycastle + bcprov-jdk15on + 1.49 + provided com.jcraft jzlib - 1.0.7 + 1.1.2 provided org.apache.sshd sshd-core - 0.5.0 + 0.8.0 test ch.qos.logback logback-core - 0.9.29 + 1.0.13 + test + + + junit + junit + 4.11 test ch.qos.logback logback-classic - 0.9.29 + 1.0.13 + test + + + org.mockito + mockito-all + 1.9.5 test - - org.mockito - mockito-all - 1.9.0-rc1 - test - @@ -112,7 +114,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.1 examples/*.java @@ -124,29 +126,11 @@ org.apache.maven.plugins maven-release-plugin - 2.1 + 2.4.1 forked-path - - maven-assembly-plugin - 2.2.1 - - - src/assemble/examples.xml - - - - - make-assembly - package - - single - - - - org.apache.maven.plugins maven-source-plugin @@ -163,7 +147,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 + 2.9.1 ${project.build.sourceEncoding} @@ -179,15 +163,15 @@ org.apache.felix maven-bundle-plugin - 2.3.6 + 2.4.0 true !net.schmizz.*, javax.crypto*, - com.jcraft.jzlib*;version="[1.0,2)", - org.slf4j*;version="[1.6,2)", + com.jcraft.jzlib*;version="[1.1,2)", + org.slf4j*;version="[1.7,5)", org.bouncycastle*, * @@ -217,8 +201,8 @@ org.bouncycastle - bcprov-jdk16 - 1.45 + bcprov-jdk15on + 1.49 com.jcraft @@ -228,12 +212,12 @@ ch.qos.logback logback-core - 0.9.24 + 1.0.13 ch.qos.logback logback-classic - 0.9.24 + 1.0.13 @@ -250,7 +234,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.3 + 1.4 ${gpg.passphrase} @@ -265,7 +249,6 @@ - diff --git a/src/test/java/net/schmizz/sshj/transport/verification/OpenSSHKnownHostsTest.java b/src/test/java/net/schmizz/sshj/transport/verification/OpenSSHKnownHostsTest.java index 1085f385..02e9f585 100644 --- a/src/test/java/net/schmizz/sshj/transport/verification/OpenSSHKnownHostsTest.java +++ b/src/test/java/net/schmizz/sshj/transport/verification/OpenSSHKnownHostsTest.java @@ -16,7 +16,6 @@ package net.schmizz.sshj.transport.verification; import net.schmizz.sshj.util.KeyUtil; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -25,7 +24,6 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.net.UnknownHostException; import java.security.GeneralSecurityException; import java.security.PublicKey; @@ -33,61 +31,46 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.junit.internal.matchers.IsCollectionContaining.hasItem; public class OpenSSHKnownHostsTest { - // static { - // BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n"))); - // } + @Rule + public TemporaryFolder temp = new TemporaryFolder(); - @Rule - public TemporaryFolder temp = new TemporaryFolder(); - - @Before - public void setUp() - throws IOException, GeneralSecurityException { -// kh = new OpenSSHKnownHosts(new File("src/test/resources/known_hosts")); + public File writeKnownHosts(String line) + throws IOException { + File known_hosts = temp.newFile("known_hosts"); + FileWriter fileWriter = new FileWriter(known_hosts); + BufferedWriter writer = new BufferedWriter(fileWriter); + writer.write(line); + writer.write("\r\n"); + writer.flush(); + writer.close(); + return known_hosts; } - public File writeKnownHosts(String line) throws IOException { - File known_hosts = temp.newFile("known_hosts"); - FileWriter fileWriter = new FileWriter(known_hosts); - BufferedWriter writer = new BufferedWriter(fileWriter); - writer.write(line); - writer.write("\r\n"); - writer.flush(); - writer.close(); - return known_hosts; - } + @Test + public void shouldAddCommentForEmptyLine() + throws IOException { + File file = writeKnownHosts(""); + OpenSSHKnownHosts openSSHKnownHosts = new OpenSSHKnownHosts(file); + assertThat(openSSHKnownHosts.entries().size(), equalTo(1)); + assertThat(openSSHKnownHosts.entries().get(0), instanceOf(OpenSSHKnownHosts.CommentEntry.class)); + } - @Test - public void shouldAddCommentForEmptyLine() throws IOException { - File file = writeKnownHosts(""); - OpenSSHKnownHosts openSSHKnownHosts = new OpenSSHKnownHosts(file); - assertThat(openSSHKnownHosts.entries().size(), equalTo(1)); - assertThat(openSSHKnownHosts.entries().get(0), instanceOf(OpenSSHKnownHosts.CommentEntry.class)); - } + @Test + public void shouldAddCommentForCommentLine() + throws IOException { + File file = writeKnownHosts("# this is a comment"); + OpenSSHKnownHosts openSSHKnownHosts = new OpenSSHKnownHosts(file); + assertThat(openSSHKnownHosts.entries().size(), equalTo(1)); + assertThat(openSSHKnownHosts.entries().get(0), instanceOf(OpenSSHKnownHosts.CommentEntry.class)); + } - @Test - public void shouldAddCommentForCommentLine() throws IOException { - File file = writeKnownHosts("# this is a comment"); - OpenSSHKnownHosts openSSHKnownHosts = new OpenSSHKnownHosts(file); - assertThat(openSSHKnownHosts.entries().size(), equalTo(1)); - assertThat(openSSHKnownHosts.entries().get(0), instanceOf(OpenSSHKnownHosts.CommentEntry.class)); - } - -// -// @Test -// public void testLocalhostEntry() -// throws UnknownHostException, GeneralSecurityException { -// -// } -// @Test public void testSchmizzEntry() - throws IOException, GeneralSecurityException { - OpenSSHKnownHosts kh = new OpenSSHKnownHosts(new File("src/test/resources/known_hosts")); + throws IOException, GeneralSecurityException { + OpenSSHKnownHosts kh = new OpenSSHKnownHosts(new File("src/test/resources/known_hosts")); final PublicKey key = KeyUtil .newRSAPublicKey( "e8ff4797075a861db9d2319960a836b2746ada3da514955d2921f2c6a6c9895cbd557f604e43772b6303e3cab2ad82d83b21acdef4edb72524f9c2bef893335115acacfe2989bcbb2e978e4fedc8abc090363e205d975c1fdc35e55ba4daa4b5d5ab7a22c40f547a4a0fd1c683dfff10551c708ff8c34ea4e175cb9bf2313865308fa23601e5a610e2f76838be7ded3b4d3a2c49d2d40fa20db51d1cc8ab20d330bb0dadb88b1a12853f0ecb7c7632947b098dcf435a54566bcf92befd55e03ee2a57d17524cd3d59d6e800c66059067e5eb6edb81946b3286950748240ec9afa4389f9b62bc92f94ec0fba9e64d6dc2f455f816016a4c5f3d507382ed5d3365",