Skip to content

Commit

Permalink
add Pinger test
Browse files Browse the repository at this point in the history
  • Loading branch information
denger committed Jun 2, 2014
1 parent ee914e6 commit d816259
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/java/org/springstack/rsf/util/PingerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.springstack.rsf.util;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.springstack.rsf.RSFServer;

public class PingerTest {

@Test
public void testCheckServerListAvaliable(){
List<RSFServer> servers = new ArrayList<RSFServer>();

RSFServer baidu = new RSFServer("baidu.com");
servers.add(baidu);
assertFalse(baidu.isAlive());

RSFServer example = new RSFServer("example.com");
servers.add(example);
assertFalse(example.isAlive());

RSFServer abs = new RSFServer("notfound.domain");
servers.add(abs);
assertFalse(abs.isAlive());

new Pinger(servers).runPinger();

assertTrue(baidu.isAlive());
assertTrue(example.isAlive());
assertFalse(abs.isAlive());
}
}

0 comments on commit d816259

Please sign in to comment.