@SerializedNames({ "provisioningState", "backendIPConfigurations", "loadBalancingRules"}) public static BackendAddressPoolProperties create(final String provisioningState, final List<IdReference> backendIPConfigurations, final List<IdReference> loadBalancingRules) { return builder().provisioningState(provisioningState).backendIPConfigurations(backendIPConfigurations).loadBalancingRules(loadBalancingRules).build(); }
@Test(dependsOnMethods = { "testAddBackendPool", "testAddProbe", "testAddLoadBalancingRule" }) public void testAttachNodesToBackendPool() throws Exception { nicNames = createVirtualMachinesInGroupAndGetNicRefs(group, 2); // Add the first IP of each node to the pool List<NetworkInterfaceCard> attachedNics = new ArrayList<NetworkInterfaceCard>(); BackendAddressPool targetPool = lb.properties().backendAddressPools().get(0); for (String nicName : nicNames) { attachedNics.add(attachNicToBackendPool(nicName, targetPool)); } // Refresh the LB after having attached NICs to the pool lb = lbApi.get(lbName); List<BackendAddressPool> pools = lb.properties().backendAddressPools(); assertEquals(pools.size(), 1); List<IdReference> backendIps = pools.get(0).properties().backendIPConfigurations(); assertEquals(backendIps.size(), attachedNics.size()); assertTrue(backendIps.containsAll(newArrayList(transform(attachedNics, ToFirstIpReference)))); }
@SerializedNames({ "provisioningState", "backendIPConfigurations", "loadBalancingRules"}) public static BackendAddressPoolProperties create(final String provisioningState, final List<IdReference> backendIPConfigurations, final List<IdReference> loadBalancingRules) { return builder().provisioningState(provisioningState).backendIPConfigurations(backendIPConfigurations).loadBalancingRules(loadBalancingRules).build(); }
@Test(dependsOnMethods = "testGetLoadBalancer") public void testAddBackendPool() throws Exception { List<IdReference> rules = newArrayList(transform(lb.properties().loadBalancingRules(), ToIdReference)); BackendAddressPool pool = BackendAddressPool.create("backpools", null, BackendAddressPoolProperties.builder() .loadBalancingRules(rules).build(), null); LoadBalancerProperties props = lb.properties().toBuilder().backendAddressPools(ImmutableList.of(pool)).build(); lb = updateLoadBalancer(lbName, props); assertEquals(lb.properties().backendAddressPools().size(), 1); assertEquals(lb.properties().backendAddressPools().get(0).name(), pool.name()); }