@Test void whenBuildTemplateThenModelParametersAreSet() throws IOException, TemplateException { StorageAccountParameters storageAccountParameters = new StorageAccountParameters("my-rg", "my-sa", "sa-location", StorageAccountSkuType.STANDARD_LRS, true, Map.of("tagKey", "tagValue")); Template templateMock = mock(Template.class); when(azureStorageAccoutTemplateProviderService.getTemplate()).thenReturn(templateMock); underTest.build(storageAccountParameters); ArgumentCaptor<Map<String, Object>> captor = ArgumentCaptor.forClass(Map.class); verify(freeMarkerTemplateUtils).processTemplateIntoString(any(), captor.capture()); Map<String, Object> templateModel = captor.getValue(); assertThat(templateModel, IsMapContaining.hasEntry("storageAccountName", "my-sa")); assertThat(templateModel, IsMapContaining.hasEntry("location", "sa-location")); assertThat(templateModel, IsMapContaining.hasEntry("encrypted", true)); assertThat(templateModel, IsMapContaining.hasEntry("skuName", StorageAccountSkuType.STANDARD_LRS.name().toString())); assertThat(templateModel, IsMapContaining.hasKey("userDefinedTags")); }
public String build(StorageAccountParameters storageAccountParameters) { try { Map<String, Object> model = new HashMap<>(); model.put("storageAccountName", storageAccountParameters.getStorageAccountName()); model.put("location", storageAccountParameters.getStorageLocation()); model.put("skuName", storageAccountParameters.getStorageAccountSkuType().name().toString()); model.put("encrypted", storageAccountParameters.getEncrypted()); model.put("userDefinedTags", storageAccountParameters.getTags()); String generatedTemplate = freeMarkerTemplateUtils.processTemplateIntoString(azureStorageAccoutTemplateProviderService.getTemplate(), model); LOGGER.info("Generated storage account Arm template: {}", generatedTemplate); return generatedTemplate; } catch (IOException | TemplateException e) { throw new CloudConnectorException("Failed to process the storage account ARM Template", e); } }
AzureStorageAccountTemplateBuilder { public String build(StorageAccountParameters storageAccountParameters) { try { Map<String, Object> model = new HashMap<>(); model.put("storageAccountName", storageAccountParameters.getStorageAccountName()); model.put("location", storageAccountParameters.getStorageLocation()); model.put("skuName", storageAccountParameters.getStorageAccountSkuType().name().toString()); model.put("encrypted", storageAccountParameters.getEncrypted()); model.put("userDefinedTags", storageAccountParameters.getTags()); String generatedTemplate = freeMarkerTemplateUtils.processTemplateIntoString(azureStorageAccoutTemplateProviderService.getTemplate(), model); LOGGER.info("Generated storage account Arm template: {}", generatedTemplate); return generatedTemplate; } catch (IOException | TemplateException e) { throw new CloudConnectorException("Failed to process the storage account ARM Template", e); } } }
AzureStorageAccountTemplateBuilder { public String build(StorageAccountParameters storageAccountParameters) { try { Map<String, Object> model = new HashMap<>(); model.put("storageAccountName", storageAccountParameters.getStorageAccountName()); model.put("location", storageAccountParameters.getStorageLocation()); model.put("skuName", storageAccountParameters.getStorageAccountSkuType().name().toString()); model.put("encrypted", storageAccountParameters.getEncrypted()); model.put("userDefinedTags", storageAccountParameters.getTags()); String generatedTemplate = freeMarkerTemplateUtils.processTemplateIntoString(azureStorageAccoutTemplateProviderService.getTemplate(), model); LOGGER.info("Generated storage account Arm template: {}", generatedTemplate); return generatedTemplate; } catch (IOException | TemplateException e) { throw new CloudConnectorException("Failed to process the storage account ARM Template", e); } }  }
AzureStorageAccountTemplateBuilder { public String build(StorageAccountParameters storageAccountParameters) { try { Map<String, Object> model = new HashMap<>(); model.put("storageAccountName", storageAccountParameters.getStorageAccountName()); model.put("location", storageAccountParameters.getStorageLocation()); model.put("skuName", storageAccountParameters.getStorageAccountSkuType().name().toString()); model.put("encrypted", storageAccountParameters.getEncrypted()); model.put("userDefinedTags", storageAccountParameters.getTags()); String generatedTemplate = freeMarkerTemplateUtils.processTemplateIntoString(azureStorageAccoutTemplateProviderService.getTemplate(), model); LOGGER.info("Generated storage account Arm template: {}", generatedTemplate); return generatedTemplate; } catch (IOException | TemplateException e) { throw new CloudConnectorException("Failed to process the storage account ARM Template", e); } }  String build(StorageAccountParameters storageAccountParameters); }
AzureStorageAccountTemplateBuilder { public String build(StorageAccountParameters storageAccountParameters) { try { Map<String, Object> model = new HashMap<>(); model.put("storageAccountName", storageAccountParameters.getStorageAccountName()); model.put("location", storageAccountParameters.getStorageLocation()); model.put("skuName", storageAccountParameters.getStorageAccountSkuType().name().toString()); model.put("encrypted", storageAccountParameters.getEncrypted()); model.put("userDefinedTags", storageAccountParameters.getTags()); String generatedTemplate = freeMarkerTemplateUtils.processTemplateIntoString(azureStorageAccoutTemplateProviderService.getTemplate(), model); LOGGER.info("Generated storage account Arm template: {}", generatedTemplate); return generatedTemplate; } catch (IOException | TemplateException e) { throw new CloudConnectorException("Failed to process the storage account ARM Template", e); } }  String build(StorageAccountParameters storageAccountParameters);  }