/** * OverridingVersion can override a version in AWS EBT. * @throws Exception If something is wrong */ @Test public void overridesVersionInEbt() throws Exception { final String app = "some-app"; final String key = "some-bundle-key"; final Bundle bundle = Mockito.mock(Bundle.class); Mockito.doReturn(key).when(bundle).name(); final AWSElasticBeanstalk ebt = Mockito.mock(AWSElasticBeanstalk.class); Mockito.doReturn(new DescribeApplicationVersionsResult()) .when(ebt).describeApplicationVersions( Mockito.any(DescribeApplicationVersionsRequest.class) ); Mockito.doReturn( new CreateApplicationVersionResult() .withApplicationVersion( new ApplicationVersionDescription() .withVersionLabel(key) ) ).when(ebt) .createApplicationVersion( Mockito.any(CreateApplicationVersionRequest.class) ); final Version version = new OverridingVersion(ebt, app, bundle); MatcherAssert.assertThat( version.label(), Matchers.equalTo(key) ); }
public List<ApplicationVersionDescription> getVersions(String applicationName){ DescribeApplicationVersionsRequest request = new DescribeApplicationVersionsRequest().withApplicationName(applicationName); DescribeApplicationVersionsResult result = awsElasticBeanstalkAsyncClient.describeApplicationVersions(request); return result.getApplicationVersions(); }