@Test(expected = ConfigurationProvisioningException.class) public void testSetupConfigurationConfigException() { doThrow(RemoteConfigurationException.class).when(integrationService) .save(any(IntegrationSettings.class), eq(DEFAULT_USER_ID)); Application application = mockApplication(); service.setupConfiguration(application); }
public IntegrationSettings setupConfiguration(Application application) { String appType = application.getComponent(); LOGGER.info("Provisioning integration config for: {}", appType); IntegrationSettings settings = buildIntegrationSettings(application); try { IntegrationSettings saved = getIntegrationByType(appType); if (saved != null) { settings.setConfigurationId(saved.getConfigurationId()); settings.setData(saved.getData()); } return integrationService.save(settings, DEFAULT_USER_ID); } catch (IntegrationConfigException e) { String message = logMessage.getMessage(SAVE_CONFIG_FAIL, appType); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new ConfigurationProvisioningException(message, e, solution); } }
ConfigurationProvisioningService { public IntegrationSettings setupConfiguration(Application application) { String appType = application.getComponent(); LOGGER.info("Provisioning integration config for: {}", appType); IntegrationSettings settings = buildIntegrationSettings(application); try { IntegrationSettings saved = getIntegrationByType(appType); if (saved != null) { settings.setConfigurationId(saved.getConfigurationId()); settings.setData(saved.getData()); } return integrationService.save(settings, DEFAULT_USER_ID); } catch (IntegrationConfigException e) { String message = logMessage.getMessage(SAVE_CONFIG_FAIL, appType); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new ConfigurationProvisioningException(message, e, solution); } } }
ConfigurationProvisioningService { public IntegrationSettings setupConfiguration(Application application) { String appType = application.getComponent(); LOGGER.info("Provisioning integration config for: {}", appType); IntegrationSettings settings = buildIntegrationSettings(application); try { IntegrationSettings saved = getIntegrationByType(appType); if (saved != null) { settings.setConfigurationId(saved.getConfigurationId()); settings.setData(saved.getData()); } return integrationService.save(settings, DEFAULT_USER_ID); } catch (IntegrationConfigException e) { String message = logMessage.getMessage(SAVE_CONFIG_FAIL, appType); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new ConfigurationProvisioningException(message, e, solution); } }  }
ConfigurationProvisioningService { public IntegrationSettings setupConfiguration(Application application) { String appType = application.getComponent(); LOGGER.info("Provisioning integration config for: {}", appType); IntegrationSettings settings = buildIntegrationSettings(application); try { IntegrationSettings saved = getIntegrationByType(appType); if (saved != null) { settings.setConfigurationId(saved.getConfigurationId()); settings.setData(saved.getData()); } return integrationService.save(settings, DEFAULT_USER_ID); } catch (IntegrationConfigException e) { String message = logMessage.getMessage(SAVE_CONFIG_FAIL, appType); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new ConfigurationProvisioningException(message, e, solution); } }  IntegrationSettings setupConfiguration(Application application); IntegrationSettings getIntegrationByType(String appType); }
ConfigurationProvisioningService { public IntegrationSettings setupConfiguration(Application application) { String appType = application.getComponent(); LOGGER.info("Provisioning integration config for: {}", appType); IntegrationSettings settings = buildIntegrationSettings(application); try { IntegrationSettings saved = getIntegrationByType(appType); if (saved != null) { settings.setConfigurationId(saved.getConfigurationId()); settings.setData(saved.getData()); } return integrationService.save(settings, DEFAULT_USER_ID); } catch (IntegrationConfigException e) { String message = logMessage.getMessage(SAVE_CONFIG_FAIL, appType); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new ConfigurationProvisioningException(message, e, solution); } }  IntegrationSettings setupConfiguration(Application application); IntegrationSettings getIntegrationByType(String appType);  }