kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | aadd1c48e7ab43e7cf27e41d9b553f653e899c06349b9695ac73a71f8b286605 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-11-12 19:25 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-11-12 19:25 +01:00 |
| Parents | 437ad5b67816 |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java +10 −1
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | |
| 18 | 18 | import java.io.PrintWriter; |
| 19 | 19 | import java.io.StringWriter; |
| 20 | +import java.util.Collection; | |
| 20 | 21 | |
| 21 | 22 | import org.testng.annotations.AfterClass; |
| 22 | 23 | import org.testng.annotations.BeforeClass; |
| @@ -41,7 +42,8 @@ | ||
| 41 | 42 | |
| 42 | 43 | @Test(groups = "short") |
| 43 | 44 | public void notificationsTest() throws Exception { |
| 44 | - assertEquals(policy.adds, 2, "adds\n" + policy.history); | |
| 45 | + assertEquals(policy.inits, 2, "inits\n" + policy.history); | |
| 46 | + assertEquals(policy.adds, 0, "adds\n" + policy.history); | |
| 45 | 47 | assertEquals(policy.suspecteds, 0, "suspecteds\n" + policy.history); |
| 46 | 48 | assertEquals(policy.removes, 0, "removes\n" + policy.history); |
| 47 | 49 | assertEquals(policy.ups, 0, "ups\n" + policy.history); |
| @@ -55,6 +57,7 @@ | ||
| 55 | 57 | |
| 56 | 58 | static class CountingPolicy extends DelegatingLoadBalancingPolicy { |
| 57 | 59 | |
| 60 | + int inits; | |
| 58 | 61 | int adds; |
| 59 | 62 | int suspecteds; |
| 60 | 63 | int removes; |
| @@ -68,6 +71,12 @@ | ||
| 68 | 71 | super(delegate); |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + @Override | |
| 75 | + public void init(Cluster cluster, Collection<Host> hosts) { | |
| 76 | + super.init(cluster, hosts); | |
| 77 | + inits += hosts.size(); | |
| 78 | + } | |
| 79 | + | |
| 71 | 80 | public void onAdd(Host host) { |
| 72 | 81 | out.printf("add %s%n", host); |
| 73 | 82 | adds++; |