@Test public void testSaveParameters() throws IOException { parameters = setupWizardActionBean.getParameters(); advancedParameters = setupWizardActionBean.getAdvancedParameters(); parameters.put("nuxeo.bind.address", "127.0.0.1"); parameters.put(ConfigurationGenerator.PARAM_TEMPLATE_DBNAME, "postgresql"); advancedParameters.put("test.default.nuxeo.defaults", "false"); setupWizardActionBean.saveParameters(); log.debug("Generated nuxeoConf: " + nuxeoConf); expectedNuxeoConf = FileUtils.getResourceFileFromContext("configurator/nuxeo.conf.expected"); BufferedReader bfNew = new BufferedReader(new FileReader(nuxeoConf)); BufferedReader bfExp = new BufferedReader(new FileReader( expectedNuxeoConf)); String newStr, expStr; while ((newStr = bfNew.readLine()) != null) { expStr = bfExp.readLine(); if (newStr.startsWith(ConfigurationGenerator.BOUNDARY_BEGIN)) { assertTrue(expStr.startsWith(ConfigurationGenerator.BOUNDARY_BEGIN)); } else if (newStr.startsWith(ConfigurationGenerator.PARAM_STATUS_KEY)) { assertTrue(expStr.startsWith(ConfigurationGenerator.PARAM_STATUS_KEY)); } else { assertEquals(expStr, newStr); } } expStr = bfExp.readLine(); assertNull(expStr); bfNew.close(); bfExp.close(); }
@SuppressWarnings("unchecked") protected void saveParameters() { for (Iterator<?> entries = parameters.entrySet().iterator(); entries.hasNext();) { @SuppressWarnings("rawtypes") Entry entry = (Entry<String, ?>) entries.next(); if (entry.getValue() instanceof Long) { entry.setValue(((Long) entry.getValue()).toString()); } if (entry.getValue() instanceof Boolean) { entry.setValue(((Boolean) entry.getValue()).toString()); } if(entry.getValue() instanceof BigDecimal){ entry.setValue(entry.getValue().toString()); } } if (!PROXY_AUTHENTICATED.equals(proxyType)) { parameters.put("nuxeo.http.proxy.login", ""); parameters.put("nuxeo.http.proxy.password", ""); } if (PROXY_NONE.equals(proxyType)) { parameters.put("nuxeo.http.proxy.host", ""); parameters.put("nuxeo.http.proxy.port", ""); } for (String pwdKey : new String[] { "nuxeo.db.password", "mailservice.password", "mail.transport.password", "nuxeo.http.proxy.password" }) { if (StringUtils.isEmpty(parameters.get(pwdKey))) { parameters.remove(pwdKey); } } Map<String, String> customParameters = new HashMap<String, String>(); customParameters.putAll(parameters); customParameters.putAll(advancedParameters); try { setupConfigGenerator.saveFilteredConfiguration(customParameters); } catch (ConfigurationException e) { log.error(e, e); } }
SetupWizardActionBean implements Serializable { @SuppressWarnings("unchecked") protected void saveParameters() { for (Iterator<?> entries = parameters.entrySet().iterator(); entries.hasNext();) { @SuppressWarnings("rawtypes") Entry entry = (Entry<String, ?>) entries.next(); if (entry.getValue() instanceof Long) { entry.setValue(((Long) entry.getValue()).toString()); } if (entry.getValue() instanceof Boolean) { entry.setValue(((Boolean) entry.getValue()).toString()); } if(entry.getValue() instanceof BigDecimal){ entry.setValue(entry.getValue().toString()); } } if (!PROXY_AUTHENTICATED.equals(proxyType)) { parameters.put("nuxeo.http.proxy.login", ""); parameters.put("nuxeo.http.proxy.password", ""); } if (PROXY_NONE.equals(proxyType)) { parameters.put("nuxeo.http.proxy.host", ""); parameters.put("nuxeo.http.proxy.port", ""); } for (String pwdKey : new String[] { "nuxeo.db.password", "mailservice.password", "mail.transport.password", "nuxeo.http.proxy.password" }) { if (StringUtils.isEmpty(parameters.get(pwdKey))) { parameters.remove(pwdKey); } } Map<String, String> customParameters = new HashMap<String, String>(); customParameters.putAll(parameters); customParameters.putAll(advancedParameters); try { setupConfigGenerator.saveFilteredConfiguration(customParameters); } catch (ConfigurationException e) { log.error(e, e); } } }
SetupWizardActionBean implements Serializable { @SuppressWarnings("unchecked") protected void saveParameters() { for (Iterator<?> entries = parameters.entrySet().iterator(); entries.hasNext();) { @SuppressWarnings("rawtypes") Entry entry = (Entry<String, ?>) entries.next(); if (entry.getValue() instanceof Long) { entry.setValue(((Long) entry.getValue()).toString()); } if (entry.getValue() instanceof Boolean) { entry.setValue(((Boolean) entry.getValue()).toString()); } if(entry.getValue() instanceof BigDecimal){ entry.setValue(entry.getValue().toString()); } } if (!PROXY_AUTHENTICATED.equals(proxyType)) { parameters.put("nuxeo.http.proxy.login", ""); parameters.put("nuxeo.http.proxy.password", ""); } if (PROXY_NONE.equals(proxyType)) { parameters.put("nuxeo.http.proxy.host", ""); parameters.put("nuxeo.http.proxy.port", ""); } for (String pwdKey : new String[] { "nuxeo.db.password", "mailservice.password", "mail.transport.password", "nuxeo.http.proxy.password" }) { if (StringUtils.isEmpty(parameters.get(pwdKey))) { parameters.remove(pwdKey); } } Map<String, String> customParameters = new HashMap<String, String>(); customParameters.putAll(parameters); customParameters.putAll(advancedParameters); try { setupConfigGenerator.saveFilteredConfiguration(customParameters); } catch (ConfigurationException e) { log.error(e, e); } }  }
SetupWizardActionBean implements Serializable { @SuppressWarnings("unchecked") protected void saveParameters() { for (Iterator<?> entries = parameters.entrySet().iterator(); entries.hasNext();) { @SuppressWarnings("rawtypes") Entry entry = (Entry<String, ?>) entries.next(); if (entry.getValue() instanceof Long) { entry.setValue(((Long) entry.getValue()).toString()); } if (entry.getValue() instanceof Boolean) { entry.setValue(((Boolean) entry.getValue()).toString()); } if(entry.getValue() instanceof BigDecimal){ entry.setValue(entry.getValue().toString()); } } if (!PROXY_AUTHENTICATED.equals(proxyType)) { parameters.put("nuxeo.http.proxy.login", ""); parameters.put("nuxeo.http.proxy.password", ""); } if (PROXY_NONE.equals(proxyType)) { parameters.put("nuxeo.http.proxy.host", ""); parameters.put("nuxeo.http.proxy.port", ""); } for (String pwdKey : new String[] { "nuxeo.db.password", "mailservice.password", "mail.transport.password", "nuxeo.http.proxy.password" }) { if (StringUtils.isEmpty(parameters.get(pwdKey))) { parameters.remove(pwdKey); } } Map<String, String> customParameters = new HashMap<String, String>(); customParameters.putAll(parameters); customParameters.putAll(advancedParameters); try { setupConfigGenerator.saveFilteredConfiguration(customParameters); } catch (ConfigurationException e) { log.error(e, e); } }  @Factory(value = "setupRequiresRestart", scope = ScopeType.EVENT) boolean isNeedsRestart(); void setNeedsRestart(boolean needsRestart); @Factory(value = "setupConfigGenerator", scope = ScopeType.PAGE) ConfigurationGenerator getConfigurationGenerator(); @Factory(value = "setupConfigurable", scope = ScopeType.APPLICATION) boolean isConfigurable(); @Factory(value = "advancedParams", scope = ScopeType.EVENT) Map<String, String> getAdvancedParameters(); @Factory(value = "setupParams", scope = ScopeType.EVENT) Map<String, String> getParameters(); void save(); void resetParameters(); void checkDatabaseParameters(FacesContext context,
            UIComponent component, Object value); void templateChange(AjaxBehaviorEvent event); void proxyChange(AjaxBehaviorEvent event); String getProxyType(); void setProxyType(String proxyType); String getDirectoryType(); String setDirectoryStorage(String directoryStorage); void ldapStorageChange(); boolean getNeedGroupConfiguration(); void setDirectoryType(String directoryType); void directoryChange(AjaxBehaviorEvent event); void checkLdapNetworkParameters(FacesContext context,
            UIComponent component, Object value); void checkLdapAuthenticationParameters(FacesContext context,
            UIComponent component, Object value); }
SetupWizardActionBean implements Serializable { @SuppressWarnings("unchecked") protected void saveParameters() { for (Iterator<?> entries = parameters.entrySet().iterator(); entries.hasNext();) { @SuppressWarnings("rawtypes") Entry entry = (Entry<String, ?>) entries.next(); if (entry.getValue() instanceof Long) { entry.setValue(((Long) entry.getValue()).toString()); } if (entry.getValue() instanceof Boolean) { entry.setValue(((Boolean) entry.getValue()).toString()); } if(entry.getValue() instanceof BigDecimal){ entry.setValue(entry.getValue().toString()); } } if (!PROXY_AUTHENTICATED.equals(proxyType)) { parameters.put("nuxeo.http.proxy.login", ""); parameters.put("nuxeo.http.proxy.password", ""); } if (PROXY_NONE.equals(proxyType)) { parameters.put("nuxeo.http.proxy.host", ""); parameters.put("nuxeo.http.proxy.port", ""); } for (String pwdKey : new String[] { "nuxeo.db.password", "mailservice.password", "mail.transport.password", "nuxeo.http.proxy.password" }) { if (StringUtils.isEmpty(parameters.get(pwdKey))) { parameters.remove(pwdKey); } } Map<String, String> customParameters = new HashMap<String, String>(); customParameters.putAll(parameters); customParameters.putAll(advancedParameters); try { setupConfigGenerator.saveFilteredConfiguration(customParameters); } catch (ConfigurationException e) { log.error(e, e); } }  @Factory(value = "setupRequiresRestart", scope = ScopeType.EVENT) boolean isNeedsRestart(); void setNeedsRestart(boolean needsRestart); @Factory(value = "setupConfigGenerator", scope = ScopeType.PAGE) ConfigurationGenerator getConfigurationGenerator(); @Factory(value = "setupConfigurable", scope = ScopeType.APPLICATION) boolean isConfigurable(); @Factory(value = "advancedParams", scope = ScopeType.EVENT) Map<String, String> getAdvancedParameters(); @Factory(value = "setupParams", scope = ScopeType.EVENT) Map<String, String> getParameters(); void save(); void resetParameters(); void checkDatabaseParameters(FacesContext context,
            UIComponent component, Object value); void templateChange(AjaxBehaviorEvent event); void proxyChange(AjaxBehaviorEvent event); String getProxyType(); void setProxyType(String proxyType); String getDirectoryType(); String setDirectoryStorage(String directoryStorage); void ldapStorageChange(); boolean getNeedGroupConfiguration(); void setDirectoryType(String directoryType); void directoryChange(AjaxBehaviorEvent event); void checkLdapNetworkParameters(FacesContext context,
            UIComponent component, Object value); void checkLdapAuthenticationParameters(FacesContext context,
            UIComponent component, Object value);  }