use of com.amazonaws.services.elasticbeanstalk.model.LoadBalancer 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.LoadBalancer 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.LoadBalancer in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetup method createAlarms.
public void createAlarms(EnvironmentDescription ed) throws InterruptedException {
String topicArn = resources.getStackInstanceNotificationTopicArn();
LoadBalancer loadBalancer = getLoadBalancerFromEnvironmentName(ed.getEnvironmentName());
List<PutMetricAlarmRequest> reqs = createAllPutMetricAlarmRequests(ed.getEnvironmentName(), loadBalancer.getName(), topicArn);
for (PutMetricAlarmRequest req : reqs) {
this.cloudWatchClient.putMetricAlarm(req);
}
}
use of com.amazonaws.services.elasticbeanstalk.model.LoadBalancer in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetup method describeAlarms.
public DescribeAlarmsResult describeAlarms(EnvironmentDescription ed) throws InterruptedException {
String topicArn = resources.getStackInstanceNotificationTopicArn();
LoadBalancer loadBalancer = getLoadBalancerFromEnvironmentName(ed.getEnvironmentName());
DescribeAlarmsRequest req = createDescribeAlarmsRequest(ed.getEnvironmentName(), loadBalancer.getName(), topicArn);
DescribeAlarmsResult res = this.cloudWatchClient.describeAlarms(req);
return res;
}
use of com.amazonaws.services.elasticbeanstalk.model.LoadBalancer 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");
}
Aggregations