Author: gnodet
Date: Thu Feb 11 13:19:21 2010
New Revision: 908957
URL: http://svn.apache.org/viewvc?rev=908957&view=rev
Log:
SSHD-71: Skip tests if native library is not available
Patch provided by Stephen Connolly with many thanks.
Modified:
mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/AgentTest.java
Modified: mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/AgentTest.java
URL:
http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/AgentTest.java?rev=908957&r1=908956&r2=908957&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/AgentTest.java
(original)
+++ mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/AgentTest.java Thu
Feb 11 13:19:21 2010
@@ -18,24 +18,35 @@
*/
package org.apache.sshd;
+import java.security.KeyPair;
+import java.security.PublicKey;
+import java.util.List;
+
+import org.junit.*;
+import org.hamcrest.*;
+
import org.apache.sshd.agent.AgentClient;
import org.apache.sshd.agent.AgentServer;
import org.apache.sshd.agent.SshAgent;
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-import org.junit.Test;
-
-import java.security.KeyPair;
-import java.security.PublicKey;
-import java.util.List;
-import static junit.framework.Assert.*;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+import static org.junit.Assume.*;
public class AgentTest {
@Test
public void testAgent() throws Exception {
AgentServer agent = new AgentServer();
- String authSocket = agent.start();
+ String authSocket;
+ try {
+ authSocket = agent.start();
+ } catch (UnsatisfiedLinkError e) {
+ // the native library is not available, so these tests should be
skipped
+ authSocket = null;
+ }
+ assumeThat(authSocket, notNullValue());
SshAgent client = new AgentClient(authSocket);
List<SshAgent.Pair<PublicKey, String>> keys = client.getIdentities();