use of com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentResourcesResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testGetLoadBalancerFromEnvironmentNameOneLoadBalancer.
@Test
public void testGetLoadBalancerFromEnvironmentNameOneLoadBalancer() throws Exception {
// Return 1 load balancers
List<LoadBalancer> loadBalancers = new ArrayList<>();
LoadBalancer lb = new LoadBalancer().withName("loadBalancer");
loadBalancers.add(lb);
EnvironmentResourceDescription erd = new EnvironmentResourceDescription().withLoadBalancers(loadBalancers);
DescribeEnvironmentResourcesResult expectedRes = new DescribeEnvironmentResourcesResult().withEnvironmentResources(erd);
when(beanstalkClient.describeEnvironmentResources(any(DescribeEnvironmentResourcesRequest.class))).thenReturn(expectedRes);
doNothing().when(mockSleeper).sleep(anyLong());
LoadBalancer b = setup.getLoadBalancerFromEnvironmentName("repoEnvName");
// Should have same name
assertEquals(lb.getName(), b.getName());
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentResourcesResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testCreateAlarms.
@Test
public void testCreateAlarms() throws Exception {
EnvironmentResourceDescription erd = new EnvironmentResourceDescription().withLoadBalancers(new LoadBalancer().withName("loadBalancer"));
DescribeEnvironmentResourcesResult expectedErr = new DescribeEnvironmentResourcesResult().withEnvironmentResources(erd);
when(beanstalkClient.describeEnvironmentResources(any(DescribeEnvironmentResourcesRequest.class))).thenReturn(expectedErr);
setup.createAlarms(resources.getEnvironment(StackEnvironmentType.REPO));
verify(mockCwClient).putMetricAlarm(any(PutMetricAlarmRequest.class));
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentResourcesResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testGetLoadBalancerFromEnvironmentNameTwoLoadBalancers.
@Test(expected = IllegalStateException.class)
public void testGetLoadBalancerFromEnvironmentNameTwoLoadBalancers() throws Exception {
// Return 2 load balancers
List<LoadBalancer> loadBalancers = new ArrayList<>();
LoadBalancer lb = new LoadBalancer();
loadBalancers.add(lb);
loadBalancers.add(lb);
EnvironmentResourceDescription erd = new EnvironmentResourceDescription().withLoadBalancers(loadBalancers);
DescribeEnvironmentResourcesResult expectedRes = new DescribeEnvironmentResourcesResult().withEnvironmentResources(erd);
when(beanstalkClient.describeEnvironmentResources(any(DescribeEnvironmentResourcesRequest.class))).thenReturn(expectedRes);
doNothing().when(mockSleeper).sleep(anyLong());
setup.getLoadBalancerFromEnvironmentName("repoEnvName");
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentResourcesResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testGetLoadBalancerFromEnvironmentNameNoLoadBalancer.
@Test(expected = IllegalStateException.class)
public void testGetLoadBalancerFromEnvironmentNameNoLoadBalancer() throws Exception {
// Return empty list
EnvironmentResourceDescription erd = new EnvironmentResourceDescription().withLoadBalancers(new ArrayList<LoadBalancer>());
DescribeEnvironmentResourcesResult expectedRes = new DescribeEnvironmentResourcesResult().withEnvironmentResources(erd);
when(beanstalkClient.describeEnvironmentResources(any(DescribeEnvironmentResourcesRequest.class))).thenReturn(expectedRes);
doNothing().when(mockSleeper).sleep(anyLong());
setup.getLoadBalancerFromEnvironmentName("repoEnvName");
}
use of com.amazonaws.services.elasticbeanstalk.model.DescribeEnvironmentResourcesResult in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testGetLoadBalancerFromEnvironmentNameNullLoadBalancers.
@Test(expected = IllegalStateException.class)
public void testGetLoadBalancerFromEnvironmentNameNullLoadBalancers() throws Exception {
EnvironmentResourceDescription erd = new EnvironmentResourceDescription();
DescribeEnvironmentResourcesResult expectedRes = new DescribeEnvironmentResourcesResult().withEnvironmentResources(erd);
when(beanstalkClient.describeEnvironmentResources(any(DescribeEnvironmentResourcesRequest.class))).thenReturn(expectedRes);
doNothing().when(mockSleeper).sleep(anyLong());
setup.getLoadBalancerFromEnvironmentName("repoEnvName");
}
Aggregations