@Test(expected = InvalidInstanceIdException.class) public void testInvalidInstanceIdException() throws IntegrationConfigException { service.save((IntegrationInstance) null, null); }
@Override public IntegrationSettings save(IntegrationSettings settings, String usedId) { if ((settings == null) || (settings.getConfigurationId() == null)) { String message = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS); String solution = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS_SOLUTION); throw new InvalidConfigurationIdException(message, solution); } try { IntegrationRepository copy = new IntegrationRepository(repository); copy.putIntegration(settings); saveRepository(copy); return settings; } catch (IOException e) { String message = logMessage.getMessage(FAILED_TO_SAVE_CONFIGURATION, settings.getConfigurationId()); String solution = logMessage.getMessage(FAILED_TO_SAVE_LOCAL_FILE_SOLUTION, fileName); throw new SaveConfigurationException(message, e, solution); } }
LocalIntegrationService implements IntegrationService { @Override public IntegrationSettings save(IntegrationSettings settings, String usedId) { if ((settings == null) || (settings.getConfigurationId() == null)) { String message = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS); String solution = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS_SOLUTION); throw new InvalidConfigurationIdException(message, solution); } try { IntegrationRepository copy = new IntegrationRepository(repository); copy.putIntegration(settings); saveRepository(copy); return settings; } catch (IOException e) { String message = logMessage.getMessage(FAILED_TO_SAVE_CONFIGURATION, settings.getConfigurationId()); String solution = logMessage.getMessage(FAILED_TO_SAVE_LOCAL_FILE_SOLUTION, fileName); throw new SaveConfigurationException(message, e, solution); } } }
LocalIntegrationService implements IntegrationService { @Override public IntegrationSettings save(IntegrationSettings settings, String usedId) { if ((settings == null) || (settings.getConfigurationId() == null)) { String message = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS); String solution = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS_SOLUTION); throw new InvalidConfigurationIdException(message, solution); } try { IntegrationRepository copy = new IntegrationRepository(repository); copy.putIntegration(settings); saveRepository(copy); return settings; } catch (IOException e) { String message = logMessage.getMessage(FAILED_TO_SAVE_CONFIGURATION, settings.getConfigurationId()); String solution = logMessage.getMessage(FAILED_TO_SAVE_LOCAL_FILE_SOLUTION, fileName); throw new SaveConfigurationException(message, e, solution); } }  }
LocalIntegrationService implements IntegrationService { @Override public IntegrationSettings save(IntegrationSettings settings, String usedId) { if ((settings == null) || (settings.getConfigurationId() == null)) { String message = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS); String solution = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS_SOLUTION); throw new InvalidConfigurationIdException(message, solution); } try { IntegrationRepository copy = new IntegrationRepository(repository); copy.putIntegration(settings); saveRepository(copy); return settings; } catch (IOException e) { String message = logMessage.getMessage(FAILED_TO_SAVE_CONFIGURATION, settings.getConfigurationId()); String solution = logMessage.getMessage(FAILED_TO_SAVE_LOCAL_FILE_SOLUTION, fileName); throw new SaveConfigurationException(message, e, solution); } }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String usedId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId); }
LocalIntegrationService implements IntegrationService { @Override public IntegrationSettings save(IntegrationSettings settings, String usedId) { if ((settings == null) || (settings.getConfigurationId() == null)) { String message = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS); String solution = logMessage.getMessage(INTEGRATION_INVALID_INTEGRATIONS_SETTINGS_SOLUTION); throw new InvalidConfigurationIdException(message, solution); } try { IntegrationRepository copy = new IntegrationRepository(repository); copy.putIntegration(settings); saveRepository(copy); return settings; } catch (IOException e) { String message = logMessage.getMessage(FAILED_TO_SAVE_CONFIGURATION, settings.getConfigurationId()); String solution = logMessage.getMessage(FAILED_TO_SAVE_LOCAL_FILE_SOLUTION, fileName); throw new SaveConfigurationException(message, e, solution); } }  @Override @PostConstruct void init(); @Override IntegrationSettings getIntegrationById(String integrationId, String userId); @Override IntegrationSettings getIntegrationByType(String integrationType, String userId); @Override IntegrationSettings save(IntegrationSettings settings, String usedId); @Override IntegrationInstance getInstanceById(String configurationId, String instanceId,
      String userId); @Override IntegrationInstance save(IntegrationInstance instance, String userId);  }