Fixes the unit tests of the ConfigurationService broken by the previous commit.

cusax-fix
Lyubomir Marinov 16 years ago
parent 19f509b652
commit 75e6e6d036

@ -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 @@ private File getConfigurationFile(String extension, boolean create)
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;

@ -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()

@ -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

@ -8,12 +8,13 @@
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 void testMulticastEventNotification()
*/
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 void vetoableChange(PropertyChangeEvent event)
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 void testSinglePropertyEventNotification()
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)

@ -122,10 +122,12 @@ protected void setUp() throws Exception
+ 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();

Loading…
Cancel
Save