Search in sources :

Example 1 with DescribeConfigurationOptionsRequest

use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElasticBeanstalkSetupTest method testDescribeConfigurationTemplateExistingTemplate.

@Test
public void testDescribeConfigurationTemplateExistingTemplate() {
    DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName("tempExist");
    DescribeConfigurationOptionsResult expectedDcoRes = new DescribeConfigurationOptionsResult();
    when(mockClient.describeConfigurationOptions(dcoReq)).thenReturn(expectedDcoRes);
    DescribeConfigurationOptionsResult dcoRes = setup.describeConfigurationTemplate("tempExist");
    assertNotNull(dcoRes);
}
Also used : DescribeConfigurationOptionsResult(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult) DescribeConfigurationOptionsRequest(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest) Test(org.junit.Test)

Example 2 with DescribeConfigurationOptionsRequest

use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElasticBeanstalkSetupTest method testDescribeConfigurationTemplateNonExistingtTemplate.

@Test
public void testDescribeConfigurationTemplateNonExistingtTemplate() {
    DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName("nonExist");
    AmazonServiceException expectedAmznException = new AmazonServiceException("Invalid template name");
    expectedAmznException.setErrorCode("InvalidParameterValue");
    when(mockClient.describeConfigurationOptions(dcoReq)).thenThrow(expectedAmznException);
    DescribeConfigurationOptionsResult dcorExpectedRes = setup.describeConfigurationTemplate("nonExist");
    assertNull(dcorExpectedRes);
}
Also used : AmazonServiceException(com.amazonaws.AmazonServiceException) DescribeConfigurationOptionsResult(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult) DescribeConfigurationOptionsRequest(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest) Test(org.junit.Test)

Example 3 with DescribeConfigurationOptionsRequest

use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElasticBeanstalkSetupTest method testCreateConfigurationTemplate.

@Test
public void testCreateConfigurationTemplate() {
    List<ConfigurationOptionSetting> cfgOptSettings = new ArrayList<ConfigurationOptionSetting>();
    String templateName = "newTemplate";
    DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName(templateName);
    AmazonServiceException expectedAmznException = new AmazonServiceException("Invalid template name");
    expectedAmznException.setErrorCode("InvalidParameterValue");
    when(mockClient.describeConfigurationOptions(dcoReq)).thenThrow(expectedAmznException);
    CreateConfigurationTemplateRequest expectedCctReq = new CreateConfigurationTemplateRequest();
    expectedCctReq.setApplicationName(config.getElasticBeanstalkApplicationName());
    expectedCctReq.setOptionSettings(cfgOptSettings);
    expectedCctReq.setSolutionStackName(Constants.SOLUTION_STACK_NAME_64BIT_TOMCAT8_JAVA8_2017_03_AMI);
    expectedCctReq.setTemplateName(templateName);
    setup.createOrUpdateConfigurationTemplate(templateName, cfgOptSettings);
    verify(mockClient).createConfigurationTemplate(expectedCctReq);
}
Also used : ArrayList(java.util.ArrayList) AmazonServiceException(com.amazonaws.AmazonServiceException) CreateConfigurationTemplateRequest(com.amazonaws.services.elasticbeanstalk.model.CreateConfigurationTemplateRequest) ConfigurationOptionSetting(com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting) DescribeConfigurationOptionsRequest(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest) Test(org.junit.Test)

Example 4 with DescribeConfigurationOptionsRequest

use of com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElasticBeanstalkSetupTest method testUpdateConfigurationTemplate.

@Test
public void testUpdateConfigurationTemplate() {
    List<ConfigurationOptionSetting> cfgOptSettings = new ArrayList<ConfigurationOptionSetting>();
    String templateName = "existingTemplate";
    DescribeConfigurationOptionsRequest dcoReq = new DescribeConfigurationOptionsRequest().withApplicationName(config.getElasticBeanstalkApplicationName()).withTemplateName(templateName);
    DescribeConfigurationOptionsResult expectedDcoRes = new DescribeConfigurationOptionsResult();
    when(mockClient.describeConfigurationOptions(dcoReq)).thenReturn(expectedDcoRes);
    UpdateConfigurationTemplateRequest expectedUctReq = new UpdateConfigurationTemplateRequest();
    expectedUctReq.setApplicationName(config.getElasticBeanstalkApplicationName());
    expectedUctReq.setOptionSettings(cfgOptSettings);
    expectedUctReq.setTemplateName(templateName);
    setup.createOrUpdateConfigurationTemplate(templateName, cfgOptSettings);
    verify(mockClient).updateConfigurationTemplate(expectedUctReq);
}
Also used : UpdateConfigurationTemplateRequest(com.amazonaws.services.elasticbeanstalk.model.UpdateConfigurationTemplateRequest) ArrayList(java.util.ArrayList) DescribeConfigurationOptionsResult(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult) ConfigurationOptionSetting(com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting) DescribeConfigurationOptionsRequest(com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest) Test(org.junit.Test)

Aggregations

DescribeConfigurationOptionsRequest (com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsRequest)4 Test (org.junit.Test)4 DescribeConfigurationOptionsResult (com.amazonaws.services.elasticbeanstalk.model.DescribeConfigurationOptionsResult)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2 ConfigurationOptionSetting (com.amazonaws.services.elasticbeanstalk.model.ConfigurationOptionSetting)2 ArrayList (java.util.ArrayList)2 CreateConfigurationTemplateRequest (com.amazonaws.services.elasticbeanstalk.model.CreateConfigurationTemplateRequest)1 UpdateConfigurationTemplateRequest (com.amazonaws.services.elasticbeanstalk.model.UpdateConfigurationTemplateRequest)1