@Test(expected = ImmutableEntityException.class) public void shouldThrowExceptionWhenLoaBalancerNotActive() throws Exception { loadBalancerService.setStatus(loadBalancer, LoadBalancerStatus.ERROR); LoadBalancer newLoadBalancer = new LoadBalancer(); newLoadBalancer.setId(loadBalancer.getId()); newLoadBalancer.setAccountId(loadBalancer.getAccountId()); newLoadBalancer.addAccessList(accessList); accessListService.updateAccessList(newLoadBalancer); }
@Test(expected = BadRequestException.class) public void shouldThrowExceptionWhenDuplicateAccessLists() throws Exception { LoadBalancer newLoadBalancer = new LoadBalancer(); newLoadBalancer.setId(loadBalancer.getId()); newLoadBalancer.setAccountId(loadBalancer.getAccountId()); accessList.setLoadbalancer(loadBalancer); newLoadBalancer.addAccessList(accessList); accessListService.updateAccessList(newLoadBalancer); loadBalancerService.setStatus(loadBalancer, LoadBalancerStatus.ACTIVE); newLoadBalancer.addAccessList(accessList); accessListService.updateAccessList(newLoadBalancer); }
private LoadBalancer createLoadBalancerInActiveStatus(LoadBalancer loadBalancer) throws Exception { LoadBalancer dbLoadBalancer = loadBalancerService.create(loadBalancer); loadBalancerService.setStatus(dbLoadBalancer, LoadBalancerStatus.ACTIVE); return dbLoadBalancer; }