diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-04 19:20:49 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-04 19:20:49 +0000 |
commit | 75e6e6d036e6089eced4806a1be5ea48e3545c73 (patch) | |
tree | bde27ed0361ccb6328dd4cf7b018c87e8d8f62ad | |
parent | 19f509b6524fea5b253e1166841c7e0947b06573 (diff) | |
download | jitsi-75e6e6d036e6089eced4806a1be5ea48e3545c73.zip jitsi-75e6e6d036e6089eced4806a1be5ea48e3545c73.tar.gz jitsi-75e6e6d036e6089eced4806a1be5ea48e3545c73.tar.bz2 |
Fixes the unit tests of the ConfigurationService broken by the previous commit.
5 files changed, 28 insertions, 24 deletions
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java index 1c9c67d..fe493e1 100644 --- a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java @@ -33,13 +33,6 @@ public class ConfigurationServiceImpl { private final Logger logger = Logger.getLogger(ConfigurationServiceImpl.class); - /** - * The name of the system property that stores the name of the configuration - * file. - */ - private static final String FILE_NAME_PROPERTY - = "net.java.sip.communicator.CONFIGURATION_FILE_NAME"; - private static final String SYS_PROPS_FILE_NAME_PROPERTY = "net.java.sip.communicator.SYS_PROPS_FILE_NAME"; @@ -729,7 +722,7 @@ public class ConfigurationServiceImpl throws IOException { //see whether we have a user specified name for the conf file - String pFileName = getSystemProperty(FILE_NAME_PROPERTY); + String pFileName = getSystemProperty(PNAME_CONFIGURATION_FILE_NAME); if (pFileName == null) pFileName = "sip-communicator." + extension; diff --git a/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java b/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java index 8d7fb33..a4dbca3 100644 --- a/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java +++ b/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java @@ -19,7 +19,9 @@ public class PropertyConfigurationStore public Object getProperty(String name)
{
- return properties.get(name);
+ Object value = properties.get(name);
+
+ return (value != null) ? value : System.getProperty(name);
}
public String[] getPropertyNames()
diff --git a/src/net/java/sip/communicator/service/configuration/ConfigurationService.java b/src/net/java/sip/communicator/service/configuration/ConfigurationService.java index 36ee67d..7d5b7e0 100644 --- a/src/net/java/sip/communicator/service/configuration/ConfigurationService.java +++ b/src/net/java/sip/communicator/service/configuration/ConfigurationService.java @@ -39,6 +39,12 @@ public interface ConfigurationService public static final String PNAME_SC_HOME_DIR_LOCATION = "net.java.sip.communicator.SC_HOME_DIR_LOCATION"; + /** + * The name of the system property that stores the name of the configuration + * file. + */ + public static final String PNAME_CONFIGURATION_FILE_NAME + = "net.java.sip.communicator.CONFIGURATION_FILE_NAME"; /** * Sets the property with the specified name to the specified value. Calling diff --git a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java index d30bb9a..aa88af3 100644 --- a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java +++ b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java @@ -8,12 +8,13 @@ package net.java.sip.communicator.slick.configuration; import java.util.*; -import org.osgi.framework.*; import junit.framework.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.configuration.event.*; import net.java.sip.communicator.util.*; +import org.osgi.framework.*; + /** * Tests basic ConfiguratioService behaviour. * @@ -35,23 +36,23 @@ public class TestConfigurationService extends TestCase /** * The name of a property that we will be using for testing. */ - private String propertyName = new String("my.test.property"); + private final String propertyName = "my.test.property"; /** * The name of a property that we will be using for testing custom event * notification. */ - private String listenedPropertyName = new String("a.property.i.listen.to"); + private final String listenedPropertyName = "a.property.i.listen.to"; /** * The value of the property with name propertyName. */ - private Integer propertyValue = new Integer(19200); + private final String propertyValue = "19200"; /** * A new value for the property with name propertyName */ - private Integer propertyNewValue = new Integer(19201); + private final String propertyNewValue = "19201"; /** * A PropertyChange listener impl that registers the last received event. @@ -364,8 +365,8 @@ public class TestConfigurationService extends TestCase */ public void testMulticastEventNotificationToVetoableListeners() { - Integer propertyValue = new Integer(19200); - Integer propertyNewValue = new Integer(19201); + String propertyValue = "19200"; + String propertyNewValue = "19201"; propertyChangeEvent = null; configurationService.addVetoableChangeListener(gentleVetoListener); @@ -507,8 +508,8 @@ public class TestConfigurationService extends TestCase public void testSinglePropertyEventNotification() throws PropertyVetoException { - Double listenedPropertyValue = new Double(19.2598); - Double listenedPropertyNewValue = new Double(19.29581); + String listenedPropertyValue = "19.2598"; + String listenedPropertyNewValue = "19.29581"; //test basic selective event dispatch configurationService.addPropertyChangeListener( @@ -582,8 +583,8 @@ public class TestConfigurationService extends TestCase public void testSinglePropertyVetoEventNotification() throws PropertyVetoException { - Double listenedPropertyValue = new Double(19.2598); - Double listenedPropertyNewValue = new Double(19.29581); + String listenedPropertyValue = "19.2598"; + String listenedPropertyNewValue = "19.29581"; VetoableChangeListener vetoListener = new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent event) diff --git a/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java b/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java index 0d8e7ee..836589a 100644 --- a/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java +++ b/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java @@ -122,10 +122,12 @@ public class TestConfigurationServicePersistency extends TestCase + ourConfFileName); configurationService.purgeStoredConfiguration(); - originalConfFileName = System.getProperty( - "net.java.sip.communicator.CONFIGURATION_FILE_NAME"); - System.setProperty("net.java.sip.communicator.CONFIGURATION_FILE_NAME", - ourConfFileName); + originalConfFileName + = System.getProperty( + ConfigurationService.PNAME_CONFIGURATION_FILE_NAME); + System.setProperty( + ConfigurationService.PNAME_CONFIGURATION_FILE_NAME, + ourConfFileName); confFile.createNewFile(); |