/** * Creates a new policy with the given host names. * * <p>See {@link #ofHosts(LoadBalancingPolicy, Iterable)} for more details. */ public static WhiteListPolicy ofHosts(LoadBalancingPolicy childPolicy, String... hostnames) { return ofHosts(childPolicy, Arrays.asList(hostnames)); }
/** * Ensures that {@link WhiteListPolicy#ofHosts(LoadBalancingPolicy, String...)} throws an {@link * IllegalArgumentException} if a name could not be resolved. * * @test_category load_balancing:white_list */ @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) public void should_throw_IAE_if_name_could_not_be_resolved() { WhiteListPolicy.ofHosts(new RoundRobinPolicy(), "a.b.c.d.e.f.UNRESOLVEABLE"); }
/** * Ensures that {@link WhiteListPolicy#ofHosts(LoadBalancingPolicy, String...)} throws a {@link * NullPointerException} if a name provided is null. * * @test_category load_balancing:white_list */ @Test(groups = "unit", expectedExceptions = NullPointerException.class) public void should_throw_NPE_if_null_provided() { WhiteListPolicy.ofHosts(new RoundRobinPolicy(), null, null); }
WhiteListPolicy.ofHosts( new RoundRobinPolicy(), sCluster.address(1).getHostName(),
/** * Ensures that {@link WhiteListPolicy#ofHosts(LoadBalancingPolicy, String...)} throws an {@link * IllegalArgumentException} if a name could not be resolved. * * @test_category load_balancing:white_list */ @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) public void should_throw_IAE_if_name_could_not_be_resolved() { WhiteListPolicy.ofHosts(new RoundRobinPolicy(), "a.b.c.d.e.f.UNRESOLVEABLE"); }
/** * Ensures that {@link WhiteListPolicy#ofHosts(LoadBalancingPolicy, String...)} throws a {@link * NullPointerException} if a name provided is null. * * @test_category load_balancing:white_list */ @Test(groups = "unit", expectedExceptions = NullPointerException.class) public void should_throw_NPE_if_null_provided() { WhiteListPolicy.ofHosts(new RoundRobinPolicy(), null, null); }
WhiteListPolicy.ofHosts( new RoundRobinPolicy(), sCluster.address(1).getHostName(),