From 1dfa382e44bdb386136d84f3d7f67cfdb080fe16 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 11 Mar 2008 20:15:07 +0000 Subject: [PATCH] moving everything into OpenSim.TestSuite namespace --- OpenSim/TestSuite/BotManager.cs | 2 +- OpenSim/TestSuite/{pCampBot.cs => Main.cs} | 29 ++++-------- OpenSim/TestSuite/PhysicsBot.cs | 3 +- OpenSim/TestSuite/Util.cs | 55 ++++++++++++++++++++++ 4 files changed, 68 insertions(+), 21 deletions(-) rename OpenSim/TestSuite/{pCampBot.cs => Main.cs} (81%) create mode 100644 OpenSim/TestSuite/Util.cs diff --git a/OpenSim/TestSuite/BotManager.cs b/OpenSim/TestSuite/BotManager.cs index efd1613e90..6ef1dea94d 100644 --- a/OpenSim/TestSuite/BotManager.cs +++ b/OpenSim/TestSuite/BotManager.cs @@ -37,7 +37,7 @@ using System.Threading; using OpenSim.Framework; using OpenSim.Framework.Console; -namespace pCampBot +namespace OpenSim.TestSuite { /// /// Thread/Bot manager for the application diff --git a/OpenSim/TestSuite/pCampBot.cs b/OpenSim/TestSuite/Main.cs similarity index 81% rename from OpenSim/TestSuite/pCampBot.cs rename to OpenSim/TestSuite/Main.cs index d42d4bd233..c2cd7a1fb1 100644 --- a/OpenSim/TestSuite/pCampBot.cs +++ b/OpenSim/TestSuite/Main.cs @@ -37,7 +37,7 @@ using log4net.Config; using System.Threading; using OpenSim.Framework.Console; -namespace pCampBot +namespace OpenSim.TestSuite { /// /// Event Types from the BOT. Add new events here @@ -49,17 +49,16 @@ namespace pCampBot DISCONNECTED = 2 } - public class pCampBot + public class TestSuite { - - private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - [STAThread] public static void Main(string[] args) { - // log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - // log4net call - // BasicConfigurator.Configure(); + + // TODO: config parser + + // TODO: load tests from addings + + // TODO: create base bot cloud for use in tests IConfig config = ParseConfig(args); if (config.Get("help") != null || config.Get("loginuri") == null) { @@ -67,17 +66,9 @@ namespace pCampBot } else { int botcount = config.GetInt("botcount", 1); - BotManager bm = new BotManager(); + // BotManager bm = new BotManager(); - System.Console.WriteLine("Error enabled: {0}", m_log.IsErrorEnabled); - //startup specified number of bots. 1 is the default - m_log.Error("pCampBot started with " + botcount + "bots"); - -// bm.dobotStartup(botcount, config); -// while (true) -// { -// MainConsole.Instance.Prompt(); -// } + Utils.TestPass("Completed Startup"); } } diff --git a/OpenSim/TestSuite/PhysicsBot.cs b/OpenSim/TestSuite/PhysicsBot.cs index 3e12bb1bc5..5c1d9662a9 100644 --- a/OpenSim/TestSuite/PhysicsBot.cs +++ b/OpenSim/TestSuite/PhysicsBot.cs @@ -37,8 +37,9 @@ using System.Threading; using OpenSim.Framework; using OpenSim.Framework.Console; using Timer = System.Timers.Timer; +using log4net; -namespace pCampBot +namespace OpenSim.TestSuite { public class PhysicsBot { diff --git a/OpenSim/TestSuite/Util.cs b/OpenSim/TestSuite/Util.cs new file mode 100644 index 0000000000..edc2a54bb8 --- /dev/null +++ b/OpenSim/TestSuite/Util.cs @@ -0,0 +1,55 @@ +using System; + +namespace OpenSim.TestSuite +{ + + public class Utils + { + enum Result { + Fail = 0, + Pass = 1, + Skip = 3 + } + + private static String ResultToString(Result r) + { + if (r == Result.Pass) + { + return "PASS"; + } + else if (r == Result.Fail) + { + return "FAIL"; + } + else if (r == Result.Skip) + { + return "SKIP"; + } + else + { + return "UNKNOWN"; + } + } + + + private static void TestResult(Result r, String msg) + { + System.Console.WriteLine("[{0}]: {1}", ResultToString(r), msg); + } + + public static void TestFail(String msg) + { + TestResult(Result.Fail, msg); + } + + public static void TestPass(String msg) + { + TestResult(Result.Pass, msg); + } + + public static void TestSkip(String msg) + { + TestResult(Result.Skip, msg); + } + } +} \ No newline at end of file