Author: atsushi
Date: 2007-06-20 12:26:15 -0400 (Wed, 20 Jun 2007)
New Revision: 80335
Modified:
trunk/mcs/class/System.Configuration/System.Configuration/ChangeLog
trunk/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs
trunk/mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
Log:
2007-06-20 Atsushi Enomoto <[EMAIL PROTECTED]>
* ConfigurationManager.cs : in OpenExeConfiguration() and
OpenMappedExeConfiguration(), take userLevel into consideration.
* InternalConfigurationHost.cs : consider ConfigurationUserLevel and
use correct config map file in InitForConfiguration().
* ConfigurationManagerTest.cs : Enabled some tests with related to
roaming user config. Marked some tests for negative check as
[NotWorking] (they are rather uncovered bugs than enbug).
Modified: trunk/mcs/class/System.Configuration/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System.Configuration/System.Configuration/ChangeLog
2007-06-20 16:20:29 UTC (rev 80334)
+++ trunk/mcs/class/System.Configuration/System.Configuration/ChangeLog
2007-06-20 16:26:15 UTC (rev 80335)
@@ -1,3 +1,10 @@
+2007-06-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * ConfigurationManager.cs : in OpenExeConfiguration() and
+ OpenMappedExeConfiguration(), take userLevel into consideration.
+ * InternalConfigurationHost.cs : consider ConfigurationUserLevel and
+ use correct config map file in InitForConfiguration().
+
2007-06-18 Atsushi Enomoto <[EMAIL PROTECTED]>
* ClientConfigurationSystem.cs : do not asume GetEntryAssembly()
Modified:
trunk/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs
===================================================================
---
trunk/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs
2007-06-20 16:20:29 UTC (rev 80334)
+++
trunk/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs
2007-06-20 16:26:15 UTC (rev 80335)
@@ -118,7 +118,7 @@
break;
}
- return ConfigurationFactory.Create
(typeof(ExeConfigurationHost), map);
+ return ConfigurationFactory.Create
(typeof(ExeConfigurationHost), map, userLevel);
}
#if TARGET_JVM
@@ -137,7 +137,7 @@
[MonoLimitation("ConfigurationUserLevel parameter is not
supported.")]
public static Configuration OpenMappedExeConfiguration
(ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel)
{
- return ConfigurationFactory.Create
(typeof(ExeConfigurationHost), fileMap);
+ return ConfigurationFactory.Create
(typeof(ExeConfigurationHost), fileMap, userLevel);
}
public static Configuration OpenMachineConfiguration ()
Modified:
trunk/mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
===================================================================
---
trunk/mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
2007-06-20 16:20:29 UTC (rev 80334)
+++
trunk/mcs/class/System.Configuration/System.Configuration/InternalConfigurationHost.cs
2007-06-20 16:26:15 UTC (rev 80335)
@@ -249,6 +249,7 @@
class ExeConfigurationHost: InternalConfigurationHost
{
ExeConfigurationFileMap map;
+ ConfigurationUserLevel level;
public override void Init (IInternalConfigRoot root, params
object[] hostInitParams)
{
@@ -260,33 +261,61 @@
switch (configPath) {
case "exe": return map.ExeConfigFilename;
case "local": return
map.LocalUserConfigFilename;
- case "roaming": return
map.LocalUserConfigFilename;
+ case "roaming": return
map.RoamingUserConfigFilename;
case "machine": return
map.MachineConfigFilename;
- default: return map.ExeConfigFilename;
+ default://return map.ExeConfigFilename;
+ switch (level) {
+ case ConfigurationUserLevel.None:
+ return map.ExeConfigFilename;
+ case
ConfigurationUserLevel.PerUserRoaming:
+ return
map.RoamingUserConfigFilename;
+ case
ConfigurationUserLevel.PerUserRoamingAndLocal:
+ return
map.LocalUserConfigFilename;
+ default:
+ return
map.MachineConfigFilename;
+ }
}
}
public override void InitForConfiguration (ref string
locationSubPath, out string configPath, out string locationConfigPath,
IInternalConfigRoot root, params object[] hostInitConfigurationParams)
{
map = (ExeConfigurationFileMap)
hostInitConfigurationParams [0];
+
+ if (hostInitConfigurationParams.Length > 1 &&
+ hostInitConfigurationParams [1] is
ConfigurationUserLevel)
+ level = (ConfigurationUserLevel)
hostInitConfigurationParams [1];
+ if (locationSubPath == null)
+ switch (level) {
+ case ConfigurationUserLevel.PerUserRoaming:
+ if (map.RoamingUserConfigFilename ==
null)
+ throw new ArgumentException
("RoamingUserConfigFilename must be set correctly");
+ locationSubPath = "roaming";
+ break;
+ case
ConfigurationUserLevel.PerUserRoamingAndLocal:
+ if (map.LocalUserConfigFilename == null)
+ throw new ArgumentException
("LocalUserConfigFilename must be set correctly");
+ locationSubPath = "local";
+ break;
+ }
+
configPath = null;
string next = null;
locationConfigPath = null;
- if ((locationSubPath == "exe" || locationSubPath ==
null) && map.ExeConfigFilename != null) {
+ if (locationSubPath == "exe" || locationSubPath == null
&& map.ExeConfigFilename != null) {
configPath = "exe";
next = "local";
locationConfigPath = map.ExeConfigFilename;
}
- if ((locationSubPath == "local" || configPath == null)
&& map.LocalUserConfigFilename != null) {
+ if (locationSubPath == "local" &&
map.LocalUserConfigFilename != null) {
configPath = "local";
next = "roaming";
locationConfigPath =
map.LocalUserConfigFilename;
}
- if ((locationSubPath == "roaming" || configPath ==
null) && map.RoamingUserConfigFilename != null) {
+ if (locationSubPath == "roaming" &&
map.RoamingUserConfigFilename != null) {
configPath = "roaming";
next = "machine";
locationConfigPath =
map.RoamingUserConfigFilename;
@@ -296,7 +325,6 @@
configPath = "machine";
next = null;
}
-
locationSubPath = next;
}
}
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
2007-06-20 16:20:29 UTC (rev 80334)
+++ trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
2007-06-20 16:26:15 UTC (rev 80335)
@@ -1,3 +1,9 @@
+2007-06-20 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * ConfigurationManagerTest.cs : Enabled some tests with related to
+ roaming user config. Marked some tests for negative check as
+ [NotWorking] (they are rather uncovered bugs than enbug).
+
2007-06-13 Atsushi Enomoto <[EMAIL PROTECTED]>
* ConfigurationSectionGroupTest.cs : new (my change is with tests.)
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
2007-06-20 16:20:29 UTC (rev 80334)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
2007-06-20 16:26:15 UTC (rev 80335)
@@ -132,7 +132,6 @@
}
[Test]
- [Category ("NotWorking")]
public void mapped_UserLevelPerRoaming ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
@@ -148,20 +147,16 @@
[Test]
[ExpectedException (typeof (ArgumentException))]
+ [Category ("NotWorking")]
public void mapped_UserLevelPerRoaming_no_execonfig ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
map.RoamingUserConfigFilename = "roaminguser";
- SysConfig config =
ConfigurationManager.OpenMappedExeConfiguration(map,
ConfigurationUserLevel.PerUserRoaming);
- Console.WriteLine("mapped roaming user config path:
{0}", config.FilePath);
-
- FileInfo fi = new FileInfo (config.FilePath);
- Assert.AreEqual ("roaminguser", fi.Name);
+ ConfigurationManager.OpenMappedExeConfiguration (map,
ConfigurationUserLevel.PerUserRoaming);
}
[Test]
- [Category ("NotWorking")]
public void mapped_UserLevelPerRoamingAndLocal ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
@@ -178,17 +173,14 @@
[Test]
[ExpectedException (typeof (ArgumentException))]
+ [Category ("NotWorking")]
public void mapped_UserLevelPerRoamingAndLocal_no_execonfig ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
map.RoamingUserConfigFilename = "roaminguser";
map.LocalUserConfigFilename = "localuser";
- SysConfig config =
ConfigurationManager.OpenMappedExeConfiguration(map,
ConfigurationUserLevel.PerUserRoamingAndLocal);
- Console.WriteLine("mapped local user config path: {0}",
config.FilePath);
-
- FileInfo fi = new FileInfo (config.FilePath);
- Assert.AreEqual ("localuser", fi.Name);
+ ConfigurationManager.OpenMappedExeConfiguration (map,
ConfigurationUserLevel.PerUserRoamingAndLocal);
}
[Test]
@@ -200,11 +192,7 @@
map.ExeConfigFilename = "execonfig";
map.LocalUserConfigFilename = "localuser";
- SysConfig config =
ConfigurationManager.OpenMappedExeConfiguration(map,
ConfigurationUserLevel.PerUserRoamingAndLocal);
- Console.WriteLine("mapped local user config path: {0}",
config.FilePath);
-
- FileInfo fi = new FileInfo (config.FilePath);
- Assert.AreEqual ("localuser", fi.Name);
+ ConfigurationManager.OpenMappedExeConfiguration (map,
ConfigurationUserLevel.PerUserRoamingAndLocal);
}
[Test]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches