From 1441758bc67c9fd70516173552225d59f48e6362 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 30 Apr 2012 18:44:22 +0100 Subject: [PATCH] Create TestHelpers.EnableLogging() and DisableLogging() to turn logging on and off within tests. This makes *.Tests.dll.config files no longer needed, hence deleted. --- .../Framework/Scenes/Tests/BorderTests.cs | 4 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 6 +++ .../Tests/ScenePresenceTeleportTests.cs | 3 +- OpenSim/Tests/Common/TestHelpers.cs | 46 +++++++++++++++++++ ....Framework.Communications.Tests.dll.config | 33 ------------- ...m.Framework.Serialization.Tests.dll.config | 33 ------------- ...OpenSim.Framework.Servers.Tests.dll.config | 33 ------------- bin/OpenSim.Framework.Tests.dll.config | 33 ------------- ...on.ClientStack.LindenCaps.Tests.dll.config | 33 ------------- ...ion.ClientStack.LindenUDP.Tests.dll.config | 33 ------------- ...penSim.Region.CoreModules.Tests.dll.config | 33 ------------- bin/OpenSim.Region.Framework.Tests.dll.config | 33 ------------- ...im.Region.OptionalModules.Tests.dll.config | 33 ------------- ...enSim.Region.ScriptEngine.Tests.dll.config | 33 ------------- bin/OpenSim.Tests.Torture.dll.config | 33 ------------- 15 files changed, 55 insertions(+), 367 deletions(-) delete mode 100644 bin/OpenSim.Framework.Communications.Tests.dll.config delete mode 100644 bin/OpenSim.Framework.Serialization.Tests.dll.config delete mode 100644 bin/OpenSim.Framework.Servers.Tests.dll.config delete mode 100644 bin/OpenSim.Framework.Tests.dll.config delete mode 100644 bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config delete mode 100644 bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config delete mode 100644 bin/OpenSim.Region.CoreModules.Tests.dll.config delete mode 100644 bin/OpenSim.Region.Framework.Tests.dll.config delete mode 100644 bin/OpenSim.Region.OptionalModules.Tests.dll.config delete mode 100644 bin/OpenSim.Region.ScriptEngine.Tests.dll.config delete mode 100644 bin/OpenSim.Tests.Torture.dll.config diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index ab6311b520..4a21dc9730 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Text; using NUnit.Framework; using OpenMetaverse; @@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 position = new Vector3(200,200,21); foreach (Border b in testborders) - { Assert.That(!b.TestCross(position)); - } - position = new Vector3(200,280,21); Assert.That(NorthBorder.TestCross(position)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 1c33a5f27a..d23c96511c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -26,7 +26,9 @@ */ using System; +using System.IO; using System.Reflection; +using System.Text; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; @@ -44,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDuplicateObject() { TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + Scene scene = new SceneHelpers().SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); @@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupePart1.PhysActor, Is.Not.Null); Assert.That(dupePart2.PhysActor, Is.Not.Null); */ + +// TestHelpers.DisableLogging(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 19542ffffe..c750cc5d10 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -38,7 +38,8 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; -using System.Threading; +using System.IO; +using System.Text; namespace OpenSim.Region.Framework.Scenes.Tests { diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index ced06de1ad..5030d4bf7f 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -27,6 +27,8 @@ using System; using System.Diagnostics; +using System.IO; +using System.Text; using NUnit.Framework; using OpenMetaverse; @@ -34,6 +36,37 @@ namespace OpenSim.Tests.Common { public class TestHelpers { + private static Stream EnableLoggingConfigStream + = new MemoryStream( + Encoding.UTF8.GetBytes( +@" + + + + + + + + + + + + + + + +")); + + private static Stream DisableLoggingConfigStream + = new MemoryStream( + Encoding.UTF8.GetBytes( + // ""))); + //""))); + //""))); + //""))); + //""))); + "")); + public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) { try @@ -58,6 +91,19 @@ namespace OpenSim.Tests.Common Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); } + public static void EnableLogging() + { + log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream); + } + + /// + /// Disable logging whilst running the tests. + /// + public static void DisableLogging() + { + log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); + } + /// /// Parse tail section into full UUID. /// diff --git a/bin/OpenSim.Framework.Communications.Tests.dll.config b/bin/OpenSim.Framework.Communications.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Framework.Communications.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Framework.Serialization.Tests.dll.config b/bin/OpenSim.Framework.Serialization.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Framework.Serialization.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Framework.Servers.Tests.dll.config b/bin/OpenSim.Framework.Servers.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Framework.Servers.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Framework.Tests.dll.config b/bin/OpenSim.Framework.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Framework.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config b/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config b/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.CoreModules.Tests.dll.config b/bin/OpenSim.Region.CoreModules.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.CoreModules.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.Framework.Tests.dll.config b/bin/OpenSim.Region.Framework.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.Framework.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.OptionalModules.Tests.dll.config b/bin/OpenSim.Region.OptionalModules.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.OptionalModules.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Region.ScriptEngine.Tests.dll.config b/bin/OpenSim.Region.ScriptEngine.Tests.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Region.ScriptEngine.Tests.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/OpenSim.Tests.Torture.dll.config b/bin/OpenSim.Tests.Torture.dll.config deleted file mode 100644 index a3f681d89e..0000000000 --- a/bin/OpenSim.Tests.Torture.dll.config +++ /dev/null @@ -1,33 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -