[Fat-develop] FAT/src/FAT.Core/Configuration ConfigurationFactory.cs,1.1,1.2 FATConfiguration.cs,1.2
Brought to you by:
exortech
|
From: <exo...@us...> - 2004-01-20 06:01:26
|
Update of /cvsroot/fat/FAT/src/FAT.Core/Configuration
In directory sc8-pr-cvs1:/tmp/cvs-serv9446/src/FAT.Core/Configuration
Modified Files:
ConfigurationFactory.cs FATConfiguration.cs IConfiguration.cs
Log Message:
parser is now configurable. configuration is used as factory for parser
Index: ConfigurationFactory.cs
===================================================================
RCS file: /cvsroot/fat/FAT/src/FAT.Core/Configuration/ConfigurationFactory.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConfigurationFactory.cs 12 Dec 2003 23:28:50 -0000 1.1
--- ConfigurationFactory.cs 20 Jan 2004 06:01:19 -0000 1.2
***************
*** 6,9 ****
--- 6,10 ----
public class ConfigurationFactory
{
+ /// TODO: cache configuration?
public static IConfiguration Create()
{
Index: FATConfiguration.cs
===================================================================
RCS file: /cvsroot/fat/FAT/src/FAT.Core/Configuration/FATConfiguration.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FATConfiguration.cs 15 Jan 2004 00:56:58 -0000 1.2
--- FATConfiguration.cs 20 Jan 2004 06:01:19 -0000 1.3
***************
*** 11,14 ****
--- 11,15 ----
private Assembly[] assemblies;
private string[] paths;
+ private Type parserType;
public FATConfiguration(XmlNode root)
***************
*** 16,19 ****
--- 17,21 ----
assemblies = ParseAssemblies(root);
paths = ParsePaths(root);
+ parserType = ParseParserType(root);
}
***************
*** 39,42 ****
--- 41,45 ----
}
+ // use relative paths for http context?
private string[] ParsePaths(XmlNode root)
{
***************
*** 50,57 ****
--- 53,85 ----
}
+ private Type ParseParserType(XmlNode root)
+ {
+ XmlNode parserTypeNode = root.SelectSingleNode("Parser");
+ if (parserTypeNode != null)
+ {
+ Type parserType = Type.GetType(parserTypeNode.InnerText);
+ if (parserType != null)
+ {
+ return parserType;
+ }
+ Log.Warning("Unable to load parser using type string from configuration file: " + parserTypeNode.InnerText);
+ }
+ return typeof(TestParser);
+ }
+
public ITestFileScanner TestFileScanner
{
get { return new TestFileScanner(paths); }
}
+
+ public ITestParser TestParser
+ {
+ get { return (ITestParser)Activator.CreateInstance(parserType); }
+ }
+
+ public ITestRunner TestRunner
+ {
+ get { return new TestRunner(new TestFixtureLoader(this)); }
+ }
}
}
Index: IConfiguration.cs
===================================================================
RCS file: /cvsroot/fat/FAT/src/FAT.Core/Configuration/IConfiguration.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IConfiguration.cs 12 Dec 2003 23:28:50 -0000 1.1
--- IConfiguration.cs 20 Jan 2004 06:01:19 -0000 1.2
***************
*** 7,10 ****
--- 7,13 ----
{
Assembly[] Assemblies { get; }
+ ITestFileScanner TestFileScanner { get; }
+ ITestParser TestParser { get; }
+ ITestRunner TestRunner { get; }
}
}
|