Elffuss BraidHub

kikocis/java-driver public

Update test to reflect changes in cluster init (JAVA-522).
Changesetaadd1c48e7ab43e7cf27e41d9b553f653e899c06349b9695ac73a71f8b286605
Authorolim7t <omichallat+github@gmail.com> · 2014-11-12 19:25 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2014-11-12 19:25 +01:00
Parents437ad5b67816

Browse the files at this changeset

1 file changed

modified driver-core/src/test/java/com/datastax/driver/core/LoadBalancingPolicyBootstrapTest.java +10 −1
@@ -17,6 +17,7 @@
1717
1818 import java.io.PrintWriter;
1919 import java.io.StringWriter;
20+import java.util.Collection;
2021
2122 import org.testng.annotations.AfterClass;
2223 import org.testng.annotations.BeforeClass;
@@ -41,7 +42,8 @@
4142
4243 @Test(groups = "short")
4344 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);
4547 assertEquals(policy.suspecteds, 0, "suspecteds\n" + policy.history);
4648 assertEquals(policy.removes, 0, "removes\n" + policy.history);
4749 assertEquals(policy.ups, 0, "ups\n" + policy.history);
@@ -55,6 +57,7 @@
5557
5658 static class CountingPolicy extends DelegatingLoadBalancingPolicy {
5759
60+ int inits;
5861 int adds;
5962 int suspecteds;
6063 int removes;
@@ -68,6 +71,12 @@
6871 super(delegate);
6972 }
7073
74+ @Override
75+ public void init(Cluster cluster, Collection<Host> hosts) {
76+ super.init(cluster, hosts);
77+ inits += hosts.size();
78+ }
79+
7180 public void onAdd(Host host) {
7281 out.printf("add %s%n", host);
7382 adds++;