diff options
author | Justin Clark-Casey (justincc) | 2012-04-30 18:44:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-04-30 18:44:22 +0100 |
commit | b678ea18b238ef1ab816445f48bd1c838f9978fc (patch) | |
tree | 6b9b15ec325b4845c28128797563240893a56576 /OpenSim | |
parent | Add TBG Renfold to contributors (diff) | |
download | opensim-SC_OLD-b678ea18b238ef1ab816445f48bd1c838f9978fc.zip opensim-SC_OLD-b678ea18b238ef1ab816445f48bd1c838f9978fc.tar.gz opensim-SC_OLD-b678ea18b238ef1ab816445f48bd1c838f9978fc.tar.bz2 opensim-SC_OLD-b678ea18b238ef1ab816445f48bd1c838f9978fc.tar.xz |
Create TestHelpers.EnableLogging() and DisableLogging() to turn logging on and off within tests.
This makes *.Tests.dll.config files no longer needed, hence deleted.
Diffstat (limited to 'OpenSim')
4 files changed, 55 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index ab6311b..4a21dc9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | using NUnit.Framework; | 32 | using NUnit.Framework; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
@@ -68,11 +69,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
68 | Vector3 position = new Vector3(200,200,21); | 69 | Vector3 position = new Vector3(200,200,21); |
69 | 70 | ||
70 | foreach (Border b in testborders) | 71 | foreach (Border b in testborders) |
71 | { | ||
72 | Assert.That(!b.TestCross(position)); | 72 | Assert.That(!b.TestCross(position)); |
73 | 73 | ||
74 | } | ||
75 | |||
76 | position = new Vector3(200,280,21); | 74 | position = new Vector3(200,280,21); |
77 | Assert.That(NorthBorder.TestCross(position)); | 75 | Assert.That(NorthBorder.TestCross(position)); |
78 | 76 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 1c33a5f..d23c965 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -44,6 +46,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
44 | public void TestDuplicateObject() | 46 | public void TestDuplicateObject() |
45 | { | 47 | { |
46 | TestHelpers.InMethod(); | 48 | TestHelpers.InMethod(); |
49 | // TestHelpers.EnableLogging(); | ||
50 | |||
47 | Scene scene = new SceneHelpers().SetupScene(); | 51 | Scene scene = new SceneHelpers().SetupScene(); |
48 | 52 | ||
49 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); | 53 | UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); |
@@ -82,6 +86,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
82 | Assert.That(dupePart1.PhysActor, Is.Not.Null); | 86 | Assert.That(dupePart1.PhysActor, Is.Not.Null); |
83 | Assert.That(dupePart2.PhysActor, Is.Not.Null); | 87 | Assert.That(dupePart2.PhysActor, Is.Not.Null); |
84 | */ | 88 | */ |
89 | |||
90 | // TestHelpers.DisableLogging(); | ||
85 | } | 91 | } |
86 | } | 92 | } |
87 | } \ No newline at end of file | 93 | } \ 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 19542ff..c750cc5 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; | |||
38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
39 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
40 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
41 | using System.Threading; | 41 | using System.IO; |
42 | using System.Text; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.Framework.Scenes.Tests | 44 | namespace OpenSim.Region.Framework.Scenes.Tests |
44 | { | 45 | { |
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index ced06de..5030d4b 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Diagnostics; | 29 | using System.Diagnostics; |
30 | using System.IO; | ||
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | 34 | ||
@@ -34,6 +36,37 @@ namespace OpenSim.Tests.Common | |||
34 | { | 36 | { |
35 | public class TestHelpers | 37 | public class TestHelpers |
36 | { | 38 | { |
39 | private static Stream EnableLoggingConfigStream | ||
40 | = new MemoryStream( | ||
41 | Encoding.UTF8.GetBytes( | ||
42 | @"<log4net> | ||
43 | <!-- A1 is set to be a ConsoleAppender --> | ||
44 | <appender name=""A1"" type=""log4net.Appender.ConsoleAppender""> | ||
45 | |||
46 | <!-- A1 uses PatternLayout --> | ||
47 | <layout type=""log4net.Layout.PatternLayout""> | ||
48 | <!-- Print the date in ISO 8601 format --> | ||
49 | <conversionPattern value=""%date [%thread] %-5level %logger %ndc - %message%newline"" /> | ||
50 | </layout> | ||
51 | </appender> | ||
52 | |||
53 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | ||
54 | <root> | ||
55 | <level value=""DEBUG"" /> | ||
56 | <appender-ref ref=""A1"" /> | ||
57 | </root> | ||
58 | </log4net>")); | ||
59 | |||
60 | private static Stream DisableLoggingConfigStream | ||
61 | = new MemoryStream( | ||
62 | Encoding.UTF8.GetBytes( | ||
63 | // "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"))); | ||
64 | //"<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>"))); | ||
65 | //"<configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>"))); | ||
66 | //"<configuration><log4net><root></root></log4net></configuration>"))); | ||
67 | //"<configuration><log4net><root/></log4net></configuration>"))); | ||
68 | "<log4net><root/></log4net>")); | ||
69 | |||
37 | public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) | 70 | public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) |
38 | { | 71 | { |
39 | try | 72 | try |
@@ -58,6 +91,19 @@ namespace OpenSim.Tests.Common | |||
58 | Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); | 91 | Console.WriteLine("===> In Test Method : {0} <===", stackTrace.GetFrame(1).GetMethod().Name); |
59 | } | 92 | } |
60 | 93 | ||
94 | public static void EnableLogging() | ||
95 | { | ||
96 | log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream); | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Disable logging whilst running the tests. | ||
101 | /// </summary> | ||
102 | public static void DisableLogging() | ||
103 | { | ||
104 | log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream); | ||
105 | } | ||
106 | |||
61 | /// <summary> | 107 | /// <summary> |
62 | /// Parse tail section into full UUID. | 108 | /// Parse tail section into full UUID. |
63 | /// </summary> | 109 | /// </summary> |