karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [09/11] karaf git commit: KARAF-3882: get the test all set up.
Date Sat, 22 Aug 2015 07:05:28 GMT
KARAF-3882: get the test all set up.


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

Branch: refs/heads/master
Commit: c264abcd44804fd25f1e74c1b126161372794b03
Parents: bd84368
Author: Benson Margulies <bimargulies@gmail.com>
Authored: Mon Jul 27 17:49:20 2015 -0400
Committer: Benson Margulies <bimargulies@gmail.com>
Committed: Mon Jul 27 17:49:20 2015 -0400

----------------------------------------------------------------------
 itests/pom.xml                                  | 14 ++++++++
 .../apache/karaf/itests/SshKeyFormatTest.java   | 34 ++++++++------------
 itests/src/test/resources/etc/test.pem          | 27 ----------------
 itests/src/test/resources/etc/test.pem.pub      |  1 -
 .../resources/org/apache/karaf/itests/test.pem  | 27 ++++++++++++++++
 5 files changed, 55 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/c264abcd/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 7682526..a72933e 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -103,6 +103,20 @@
             <groupId>org.apache.karaf.package</groupId>
             <artifactId>org.apache.karaf.package.core</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.not-yet-commons-ssl</artifactId>
+            <version>0.3.11_1</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>16.0.1</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/karaf/blob/c264abcd/itests/src/test/java/org/apache/karaf/itests/SshKeyFormatTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/SshKeyFormatTest.java b/itests/src/test/java/org/apache/karaf/itests/SshKeyFormatTest.java
index 23c4af5..dd9184b 100644
--- a/itests/src/test/java/org/apache/karaf/itests/SshKeyFormatTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/SshKeyFormatTest.java
@@ -20,17 +20,19 @@
 
 package org.apache.karaf.itests;
 
+import com.google.common.io.ByteSource;
+import com.google.common.io.Resources;
+import org.apache.commons.ssl.PKCS8Key;
 import org.apache.sshd.ClientSession;
 import org.apache.sshd.SshClient;
-import org.apache.sshd.client.ServerKeyVerifier;
 import org.apache.sshd.client.future.ConnectFuture;
+import org.apache.sshd.client.keyverifier.RequiredServerKeyVerifier;
 import org.junit.Test;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 
 import java.io.File;
-import java.net.SocketAddress;
-import java.security.PublicKey;
+import java.net.URL;
 
 import static org.ops4j.pax.exam.CoreOptions.*;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
@@ -42,31 +44,23 @@ public class SshKeyFormatTest extends SshCommandTestBase {
 
     @Configuration
     public Option[] config() {
-        File keyFile = new File("src/test/resources/etc/test.pem");
+        File keyFile = new File("src/test/resources/org/apache/karaf/itests/test.pem");
         return options(composite(super.config()),
                 editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "hostKey", keyFile.getAbsolutePath()),
-                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "hostKeyFormat",
"PEM")
-//                ,
-//                vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
+                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "hostKeyFormat",
"PEM"),
+                bundle("mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.not-yet-commons-ssl/0.3.11_1"),
+                bundle("mvn:com.google.guava/guava/16.0.1")
                 );
     }
 
     @Test
     public void usePemKey() throws Exception {
         SshClient client = SshClient.setUpDefaultClient();
-        client.setServerKeyVerifier(new ServerKeyVerifier() {
-            @Override
-            public boolean verifyServerKey(ClientSession sshClientSession, SocketAddress
remoteAddress, PublicKey serverKey) {
-                System.err.println(serverKey.getAlgorithm());
-                System.err.println(serverKey.getFormat());
-                StringBuilder dump = new StringBuilder();
-                for (byte b : serverKey.getEncoded()) {
-                    dump.append(String.format("%02x", b));
-                }
-                System.err.println(dump.toString());
-                return true;
-            }
-        });
+        URL testPemURL = Resources.getResource(SshKeyFormatTest.class, "test.pem");
+        ByteSource source = Resources.asByteSource(testPemURL);
+        PKCS8Key pkcs8 = new PKCS8Key(source.openStream(), null);
+
+        client.setServerKeyVerifier(new RequiredServerKeyVerifier(pkcs8.getPublicKey()));
         client.start();
         ConnectFuture future = client.connect("karaf", "localhost", 8101).await();
         ClientSession session = future.getSession();

http://git-wip-us.apache.org/repos/asf/karaf/blob/c264abcd/itests/src/test/resources/etc/test.pem
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/etc/test.pem b/itests/src/test/resources/etc/test.pem
deleted file mode 100644
index 64c6eb4..0000000
--- a/itests/src/test/resources/etc/test.pem
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEAvHFgGEKjSgg5382ZMw4DUafHmWeQYp7nnvao9ME9O16czyAD
-BsdmyTH9rfKdZ14CkzC40LEAQ5kv/ZeDD4/8LsVfUpExhuh9g86hyG4zK9q3GfGg
-IeV26GlUeDlBV9W5xJRdJbbj4Cp0OzkxX0+BmgS+f0qUDxUGnTljOlZlnVLgJcbD
-YZ5nxHnQ4gtxHtkmmkkIwz4sMiWOdcIoDIV1OQ6dqZoRqwOkpfc+jdsEEnQJZzPx
-4BLkD9fcNW5g3uaJupD4idHDTtLhYeTx9c8KvPVurNoF8T2hvWZz9etAez0fmT6f
-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jSvrBSbxeFKfeZs9EJ6KMaBuu+8cC3vw3FMqHdPrt5bna
-i0QGolUCgYAi7fZAo3BhS8GgAMAcg/Uu9rxNuupW+GHiQNaP53Quq+I9T2RyCvEn
-gUiOSRyqW+y7P7nqrL4NQe+PHSJQqWZypQZIoDdNvvIZvpHERjcOKKxPuPhdi0/j
-fPJkMBCIbjoRJoQDbiqZoQ7v2YCpYhT85MXX8PMtCeW1OWRKwpepMA==
------END RSA PRIVATE KEY-----

http://git-wip-us.apache.org/repos/asf/karaf/blob/c264abcd/itests/src/test/resources/etc/test.pem.pub
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/etc/test.pem.pub b/itests/src/test/resources/etc/test.pem.pub
deleted file mode 100644
index dd950c4..0000000
--- a/itests/src/test/resources/etc/test.pem.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8cWAYQqNKCDnfzZkzDgNRp8eZZ5Binuee9qj0wT07XpzPIAMGx2bJMf2t8p1nXgKTMLjQsQBDmS/9l4MPj/wuxV9SkTGG6H2DzqHIbjMr2rcZ8aAh5XboaVR4OUFX1bnElF0ltuPgKnQ7OTFfT4GaBL5/SpQPFQadOWM6VmWdUuAlxsNhnmfEedDiC3Ee2SaaSQjDPiwyJY51wigMhXU5Dp2pmhGrA6Sl9z6N2wQSdAlnM/HgEuQP19w1bmDe5om6kPiJ0cNO0uFh5PH1zwq89W6s2gXxPaG9ZnP160B7PR+ZPp+2+n/1M+uh+slBMLckl5McG4h+WN+RInx5wnBN
benson@tinfoilhat.local

http://git-wip-us.apache.org/repos/asf/karaf/blob/c264abcd/itests/src/test/resources/org/apache/karaf/itests/test.pem
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/org/apache/karaf/itests/test.pem b/itests/src/test/resources/org/apache/karaf/itests/test.pem
new file mode 100644
index 0000000..64c6eb4
--- /dev/null
+++ b/itests/src/test/resources/org/apache/karaf/itests/test.pem
@@ -0,0 +1,27 @@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