예제 #1
0
 public void testOnlyRetryAuthWhenSetViaProperties() {
   Properties props = new Properties();
   props.setProperty("jclouds.ssh.retry-auth", "true");
   SshjSshClient ssh1 = createClient(props);
   assert ssh1.shouldRetry(new AuthorizationException("problem", null));
   assert ssh1.shouldRetry(new UserAuthException("problem", null));
 }
예제 #2
0
 public void testOnlyRetryAuthWhenSet() {
   SshjSshClient ssh1 = createClient();
   assert !ssh1.shouldRetry(new AuthorizationException("problem", null));
   assert !ssh1.shouldRetry(new UserAuthException("problem", null));
   ssh1.retryAuth = true;
   assert ssh1.shouldRetry(new AuthorizationException("problem", null));
   assert ssh1.shouldRetry(new UserAuthException("problem", null));
 }
예제 #3
0
 public void testRetryNotOnToStringCustomMismatch() {
   Exception nex = new ExceptionWithStrangeToString();
   Properties props = new Properties();
   props.setProperty("jclouds.ssh.retryable-messages", "foo-baR");
   SshjSshClient ssh1 = createClient(props);
   assert !ssh1.shouldRetry(new RuntimeException(nex));
 }
예제 #4
0
 public void testRetryOnToStringNpe() {
   Exception nex = new NullPointerException();
   Properties props = new Properties();
   // ensure we test toString on the exception independently
   props.setProperty("jclouds.ssh.retryable-messages", nex.toString());
   SshjSshClient ssh1 = createClient(props);
   assert ssh1.shouldRetry(new RuntimeException(nex));
 }
예제 #5
0
 public void testExceptionClassesRetry() {
   assert ssh.shouldRetry(
       new ConnectionException(
           "Read timed out",
           new SSHException("Read timed out", new SocketTimeoutException("Read timed out"))));
   assert ssh.shouldRetry(new SFTPException("Failure!"));
   assert ssh.shouldRetry(new SocketTimeoutException("connect timed out"));
   assert ssh.shouldRetry(new TransportException("socket closed"));
   assert ssh.shouldRetry(new ConnectionException("problem"));
   assert ssh.shouldRetry(new ConnectException("Connection refused"));
   assert !ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException()));
 }
예제 #6
0
 public void testExceptionMessagesRetry() {
   assert !ssh.shouldRetry(new SSHException(""));
   assert !ssh.shouldRetry(new NullPointerException((String) null));
 }
예제 #7
0
 public void testExceptionClassesRetry() {
   assert ssh.shouldRetry(new TransportException("socket closed"));
   assert ssh.shouldRetry(new ConnectionException("problem"));
   assert !ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException()));
 }