ControllerConfiguration extends Configuration { public void setRemoteCommandResponseTimeout(String timeout) { try { remoteCommandResponseTimeout = timeStringToMillis(timeout); } catch (InvalidTimeException e) { log.info( "Remote command response timeout was set to {0}, will wait for response indefinitely.", timeout ); remoteCommandResponseTimeout = 0; } catch (ConfigurationException e) { log.warn( "Unable to parse remote command response timeout value ''{0}'', " + "using default {1} milliseconds...", timeout, DEFAULT_REMOTE_COMMAND_RESPONSE_TIMEOUT); } }  static ControllerConfiguration readXML(); String getIrsendPath(); void setIrsendPath(String irsendPath); String getLircdconfPath(); void setLircdconfPath(String lircdconfPath); boolean isCopyLircdconf(); void setCopyLircdconf(boolean copyLircdconf); int getWebappPort(); void setWebappPort(int webappPort); String getMulticastAddress(); void setMulticastAddress(String multicastAddress); int getMulticastPort(); void setMulticastPort(int multicastPort); String getResourcePath(); void setResourcePath(String resourcePath); boolean isResourceUploadAllowed(); void setResourceUploadAllowed(boolean resourceUpload); String getComPort(); void setComPort(String comPort); String getX10transmitter(); void setX10transmitter(String x10transmitter); long getMacroIRExecutionDelay(); void setMacroIRExecutionDelay(long macroIRExecutionDelay); String getWebappIp(); void setWebappIp(String webappIp); String getBeehiveRESTRootUrl(); void setBeehiveRESTRootUrl(String beehiveRESTRootUrl); String getBeehiveAccountServiceRESTRootUrl(); void setBeehiveAccountServiceRESTRootUrl(String beehiveAccountServiceRESTRootUrl); String getBeehiveDeviceDiscoveryServiceRESTRootUrl(); void setBeehiveDeviceDiscoveryServiceRESTRootUrl(String beehiveDeviceDiscoveryServiceRESTRootUrl); String getWebappName(); void setWebappName(String webappName); int getProxyTimeout(); void setProxyTimeout(int proxyTimeout); String getLagartoBroadcastAddr(); void setLagartoBroadcastAddr(String broadcastAddress); String getRemoteCommandServiceURI(); URI[] getRemoteCommandURIs(); void setRemoteCommandServiceURI(String remoteCommandServiceURI); int getRemoteCommandConnectionTimeoutMillis(); String getRemoteCommandConnectionTimeout(); void setRemoteCommandConnectionTimeout(String timeout); int getRemoteCommandResponseTimeoutMillis(); String getRemoteCommandResponseTimeout(); void setRemoteCommandResponseTimeout(String timeout); int getRemoteCommandRequestIntervalMillis(); String getRemoteCommandRequestInterval(); void setRemoteCommandRequestInterval(String interval); boolean getBeehiveSyncing(); void setBeehiveSyncing(boolean beehiveSyncing); void setSecurityPasswordStorageAsString(String securityPasswordStorageAsString); void setSecurityPasswordStorage(SecurityPasswordStorage securityPasswordStorage); SecurityPasswordStorage getSecurityPasswordStorage(); final static String DEFAULT_LINE_SEPARATOR; final static String LINE_SEPARATOR; static final String RESOURCE_UPLOAD_ALLOWED; static final String RESOURCE_PATH; static final String BEEHIVE_REST_ROOT_URL; static final String REMOTE_COMMAND_SERVICE_URI; final static String REMOTE_COMMAND_REQUEST_INTERVAL; final static String REMOTE_COMMAND_CONNECTION_TIMEOUT; final static String REMOTE_COMMAND_RESPONSE_TIMEOUT; static final String BEEHIVE_ACCOUNT_SERVICE_REST_ROOT_URL; static final String BEEHIVE_DEVICE_DISCOVERY_SERVICE_REST_ROOT_URL; static final String BEEHIVE_SYNCING; static final String IRSEND_PATH; static final String MULTICAST_PORT; static final String MULTICAST_ADDRESS; static final String WEBAPP_PORT; static final String COPY_LIRCD_CONF_ON; static final String LIRCD_CONF_PATH; static final String WEBAPP_IP; static final String PROXY_TIMEOUT; static final String LAGARTO_BROADCAST_ADDRESS; static final String CONTROLLER_APPLICATIONNAME; static final String SECURITY_PASSWORD_STORAGE; final static int DEFAULT_REMOTE_COMMAND_REQUEST_INTERVAL; final static int DEFAULT_REMOTE_COMMAND_CONNECTION_TIMEOUT; final static int DEFAULT_REMOTE_COMMAND_RESPONSE_TIMEOUT; }
@Test public void testSetRemoteCommandResponseTimeout() { ControllerConfiguration config = new ControllerConfiguration(); config.setRemoteCommandResponseTimeout("1"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 1000); config.setRemoteCommandResponseTimeout("-1"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("0"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("1s"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 1000); config.setRemoteCommandResponseTimeout("-1s"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("0s"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("1ms"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 1); config.setRemoteCommandResponseTimeout("0ms"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("-1ms"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("1m"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 1000 * 60); config.setRemoteCommandResponseTimeout("0m"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); config.setRemoteCommandResponseTimeout("-1m"); Assert.assertTrue(config.getRemoteCommandResponseTimeoutMillis() == 0); }