Take two at fixing the failing Jabber account uninstallation test this time pretty much forcing the XML store on the ConfigurationService implementation because the configuration tests write the configuration file in XML format on their own, without the ConfigurationService implementation.

cusax-fix
Lyubomir Marinov 16 years ago
parent 51b9890997
commit 78041d3755

@ -552,7 +552,7 @@ private File getConfigurationFile()
if (!(this.store instanceof XMLConfigurationStore))
this.store = new XMLConfigurationStore();
}
else if (configurationFile.exists())
else
{
String name = configurationFile.getName();
int extensionBeginIndex = name.lastIndexOf('.');
@ -583,21 +583,26 @@ else if (configurationFile.exists())
if (!(this.store instanceof PropertyConfigurationStore))
this.store = new PropertyConfigurationStore();
}
else if (!configurationFile.exists()
&& (getSystemProperty(PNAME_CONFIGURATION_FILE_NAME)
== null))
{
this.configurationFile
= getConfigurationFile("properties", true);
if (!(this.store instanceof PropertyConfigurationStore))
this.store = new PropertyConfigurationStore();
}
else
{
this.configurationFile = configurationFile;
this.configurationFile =
configurationFile.exists()
? configurationFile
: getConfigurationFile("xml", true);
if (!(this.store instanceof XMLConfigurationStore))
this.store = new XMLConfigurationStore();
}
}
}
else
{
this.configurationFile
= getConfigurationFile("properties", true);
if (!(this.store instanceof PropertyConfigurationStore))
this.store = new PropertyConfigurationStore();
}
/*
* Make sure that the properties SC_HOME_DIR_LOCATION and
@ -914,6 +919,9 @@ public void purgeStoredConfiguration()
configurationFile.delete();
configurationFile = null;
}
if (store != null)
for (String name : store.getPropertyNames())
store.removeProperty(name);
}
/**

@ -6,10 +6,13 @@
*/
package net.java.sip.communicator.slick.configuration;
import org.osgi.framework.*;
import java.util.*;
import junit.framework.*;
import net.java.sip.communicator.service.configuration.*;
import org.osgi.framework.*;
/**
* Performs finalization tasks (such as removing the configuration file) at the
* end of the ConfigurationServiceLick.
@ -42,5 +45,11 @@ public void testPurgeConfiguration()
configurationService.purgeStoredConfiguration();
List<String> propertyNames
= configurationService.getPropertyNamesByPrefix("", false);
assertTrue(
"The configuration service contains properties after purging.",
(propertyNames == null) || (propertyNames.size() <= 0));
}
}

Loading…
Cancel
Save