@Test void shouldUpdateImageInLaunchTemplate() { Mockito.when(stack.getTemplate()).thenReturn("AWS::EC2::LaunchTemplate"); underTest.updateImage(ac, stack, cfResource); verify(awsLaunchTemplateImageUpdateService).updateImage(ac, stack, cfResource); verify(awsLaunchConfigurationImageUpdateService, never()).updateImage(ac, stack, cfResource); }
public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) { String cfTemplate = stack.getTemplate(); if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) { awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) { awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else { throw new NotImplementedException("Image update for stack template is not implemented yet."); } }
AwsImageUpdateService { public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) { String cfTemplate = stack.getTemplate(); if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) { awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) { awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else { throw new NotImplementedException("Image update for stack template is not implemented yet."); } } }
AwsImageUpdateService { public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) { String cfTemplate = stack.getTemplate(); if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) { awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) { awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else { throw new NotImplementedException("Image update for stack template is not implemented yet."); } }  }
AwsImageUpdateService { public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) { String cfTemplate = stack.getTemplate(); if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) { awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) { awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else { throw new NotImplementedException("Image update for stack template is not implemented yet."); } }  void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource); }
AwsImageUpdateService { public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) { String cfTemplate = stack.getTemplate(); if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) { awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) { awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource); } else { throw new NotImplementedException("Image update for stack template is not implemented yet."); } }  void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource);  }