diff options
author | Justin Clark-Casey (justincc) | 2011-03-23 23:28:10 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-03-23 23:28:23 +0000 |
commit | eaa37d15f26adda05cbcc44404b586551d86e983 (patch) | |
tree | 55ffae93137042b27e40223eb1214b5f2d66555e /OpenSim | |
parent | extend TestAddOwnerObject() to add a second object (diff) | |
download | opensim-SC-eaa37d15f26adda05cbcc44404b586551d86e983.zip opensim-SC-eaa37d15f26adda05cbcc44404b586551d86e983.tar.gz opensim-SC-eaa37d15f26adda05cbcc44404b586551d86e983.tar.bz2 opensim-SC-eaa37d15f26adda05cbcc44404b586551d86e983.tar.xz |
factor out common test setup code in PCM tests
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 110 |
1 files changed, 53 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index a0e7e4c..45e579e 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -44,6 +44,26 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
44 | [TestFixture] | 44 | [TestFixture] |
45 | public class PrimCountModuleTests | 45 | public class PrimCountModuleTests |
46 | { | 46 | { |
47 | protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); | ||
48 | protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); | ||
49 | protected TestScene m_scene; | ||
50 | protected PrimCountModule m_pcm; | ||
51 | protected ILandObject m_lo; | ||
52 | |||
53 | [SetUp] | ||
54 | public void SetUp() | ||
55 | { | ||
56 | m_pcm = new PrimCountModule(); | ||
57 | LandManagementModule lmm = new LandManagementModule(); | ||
58 | m_scene = SceneSetupHelpers.SetupScene(); | ||
59 | SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); | ||
60 | |||
61 | m_lo = new LandObject(m_userId, false, m_scene); | ||
62 | m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
63 | lmm.AddLandObject(m_lo); | ||
64 | //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); | ||
65 | } | ||
66 | |||
47 | /// <summary> | 67 | /// <summary> |
48 | /// Test count after a parcel owner owned object is added. | 68 | /// Test count after a parcel owner owned object is added. |
49 | /// </summary> | 69 | /// </summary> |
@@ -51,47 +71,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
51 | public void TestAddOwnerObject() | 71 | public void TestAddOwnerObject() |
52 | { | 72 | { |
53 | TestHelper.InMethod(); | 73 | TestHelper.InMethod(); |
54 | // log4net.Config.XmlConfigurator.Configure(); | 74 | // log4net.Config.XmlConfigurator.Configure(); |
55 | |||
56 | PrimCountModule pcm = new PrimCountModule(); | ||
57 | LandManagementModule lmm = new LandManagementModule(); | ||
58 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
59 | SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); | ||
60 | |||
61 | UUID userId = new UUID("00000000-0000-0000-0000-100000000000"); | ||
62 | UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); | ||
63 | ILandObject lo = new LandObject(userId, false, scene); | ||
64 | lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
65 | lmm.AddLandObject(lo); | ||
66 | //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); | ||
67 | 75 | ||
68 | Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 76 | Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
69 | Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 77 | Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
70 | Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 78 | Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
71 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0)); | 79 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); |
72 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); | 80 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); |
73 | Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 81 | Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
74 | 82 | ||
75 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01); | 83 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); |
76 | scene.AddNewSceneObject(sog, false); | 84 | m_scene.AddNewSceneObject(sog, false); |
77 | 85 | ||
78 | Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); | 86 | Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); |
79 | Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 87 | Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
80 | Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 88 | Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
81 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); | 89 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); |
82 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); | 90 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); |
83 | Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); | 91 | Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); |
84 | 92 | ||
85 | // Add a second object and retest | 93 | // Add a second object and retest |
86 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10); | 94 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); |
87 | scene.AddNewSceneObject(sog2, false); | 95 | m_scene.AddNewSceneObject(sog2, false); |
88 | 96 | ||
89 | Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5)); | 97 | Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); |
90 | Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 98 | Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
91 | Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 99 | Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
92 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5)); | 100 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); |
93 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); | 101 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); |
94 | Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5)); | 102 | Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); |
95 | } | 103 | } |
96 | 104 | ||
97 | /// <summary> | 105 | /// <summary> |
@@ -103,29 +111,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests | |||
103 | TestHelper.InMethod(); | 111 | TestHelper.InMethod(); |
104 | // log4net.Config.XmlConfigurator.Configure(); | 112 | // log4net.Config.XmlConfigurator.Configure(); |
105 | 113 | ||
106 | PrimCountModule pcm = new PrimCountModule(); | 114 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); |
107 | LandManagementModule lmm = new LandManagementModule(); | 115 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); |
108 | Scene scene = SceneSetupHelpers.SetupScene(); | 116 | m_scene.AddNewSceneObject(sogToDelete, false); |
109 | SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); | 117 | m_scene.DeleteSceneObject(sogToDelete, false); |
110 | |||
111 | UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); | ||
112 | UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); | ||
113 | ILandObject lo = new LandObject(userId, false, scene); | ||
114 | lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
115 | lmm.AddLandObject(lo); | ||
116 | //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); | ||
117 | |||
118 | scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false); | ||
119 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10); | ||
120 | scene.AddNewSceneObject(sogToDelete, false); | ||
121 | scene.DeleteSceneObject(sogToDelete, false); | ||
122 | 118 | ||
123 | Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); | 119 | Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); |
124 | Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 120 | Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
125 | Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); | 121 | Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); |
126 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); | 122 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); |
127 | Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); | 123 | Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); |
128 | Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); | 124 | Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); |
129 | } | 125 | } |
130 | } | 126 | } |
131 | } \ No newline at end of file | 127 | } \ No newline at end of file |