aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs85
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs5
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs203
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs8
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs2
19 files changed, 380 insertions, 71 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 30253c3..a39e68d 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -247,6 +247,8 @@ namespace OpenSim.Data.MySQL
247 247
248 public void RemoveObject(UUID obj, UUID regionUUID) 248 public void RemoveObject(UUID obj, UUID regionUUID)
249 { 249 {
250// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
251
250 List<UUID> uuids = new List<UUID>(); 252 List<UUID> uuids = new List<UUID>();
251 253
252 // Formerly, this used to check the region UUID. 254 // Formerly, this used to check the region UUID.
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 241cac0..916148b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -111,11 +111,11 @@ namespace OpenSim.Region.Framework.Scenes
111 111
112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e) 112 private void InventoryRunDeleteTimer(object sender, ElapsedEventArgs e)
113 { 113 {
114 m_log.Debug("[SCENE]: Starting send to inventory loop"); 114 m_log.Debug("[ASYNC DELETER]: Starting send to inventory loop");
115 115
116 while (InventoryDeQueueAndDelete()) 116 while (InventoryDeQueueAndDelete())
117 { 117 {
118 //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); 118 //m_log.Debug("[ASYNC DELETER]: Sent item successfully to inventory, continuing...");
119 } 119 }
120 } 120 }
121 121
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 x = m_inventoryDeletes.Dequeue(); 137 x = m_inventoryDeletes.Dequeue();
138 138
139 m_log.DebugFormat( 139 m_log.DebugFormat(
140 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 140 "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left);
141 141
142 try 142 try
143 { 143 {
@@ -152,7 +152,8 @@ namespace OpenSim.Region.Framework.Scenes
152 } 152 }
153 catch (Exception e) 153 catch (Exception e)
154 { 154 {
155 m_log.DebugFormat("Exception background sending object: " + e); 155 m_log.ErrorFormat(
156 "[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
156 } 157 }
157 158
158 return true; 159 return true;
@@ -164,12 +165,16 @@ namespace OpenSim.Region.Framework.Scenes
164 // We can't put the object group details in here since the root part may have disappeared (which is where these sit). 165 // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
165 // FIXME: This needs to be fixed. 166 // FIXME: This needs to be fixed.
166 m_log.ErrorFormat( 167 m_log.ErrorFormat(
167 "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}", 168 "[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}",
168 (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString()); 169 (x != null ? x.remoteClient.Name : "unavailable"),
170 (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"),
171 e.Message,
172 e.StackTrace);
169 } 173 }
170 174
171 m_log.Debug("[SCENE]: No objects left in inventory send queue."); 175 m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
176
172 return false; 177 return false;
173 } 178 }
174 } 179 }
175} 180} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/EntityBase.cs b/OpenSim/Region/Framework/Scenes/EntityBase.cs
index e183f9d..6fd38e5 100644
--- a/OpenSim/Region/Framework/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityBase.cs
@@ -69,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
69 public bool IsDeleted 69 public bool IsDeleted
70 { 70 {
71 get { return m_isDeleted; } 71 get { return m_isDeleted; }
72 set { m_isDeleted = value; }
72 } 73 }
73 protected bool m_isDeleted; 74 protected bool m_isDeleted;
74 75
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 7bcc4db..c434e4f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes
684 } 684 }
685 } 685 }
686 686
687 public void TriggerOnBackup(IRegionDataStore dstore) 687 public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
688 { 688 {
689 OnBackupDelegate handlerOnAttach = OnBackup; 689 OnBackupDelegate handlerOnAttach = OnBackup;
690 if (handlerOnAttach != null) 690 if (handlerOnAttach != null)
@@ -693,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes
693 { 693 {
694 try 694 try
695 { 695 {
696 d(dstore, false); 696 d(dstore, forced);
697 } 697 }
698 catch (Exception e) 698 catch (Exception e)
699 { 699 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4e871d9..c49386a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1720,7 +1720,7 @@ namespace OpenSim.Region.Framework.Scenes
1720 public virtual void DeRezObject(IClientAPI remoteClient, uint localID, 1720 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1721 UUID groupID, DeRezAction action, UUID destinationID) 1721 UUID groupID, DeRezAction action, UUID destinationID)
1722 { 1722 {
1723 DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); 1723 DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
1724 } 1724 }
1725 1725
1726 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1726 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
@@ -1757,11 +1757,6 @@ namespace OpenSim.Region.Framework.Scenes
1757 deleteIDs.Add(localID); 1757 deleteIDs.Add(localID);
1758 deleteGroups.Add(grp); 1758 deleteGroups.Add(grp);
1759 1759
1760 // Force a database backup/update on this SceneObjectGroup
1761 // So that we know the database is upto date,
1762 // for when deleting the object from it
1763 ForceSceneObjectBackup(grp);
1764
1765 if (remoteClient == null) 1760 if (remoteClient == null)
1766 { 1761 {
1767 // Autoreturn has a null client. Nothing else does. So 1762 // Autoreturn has a null client. Nothing else does. So
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 49f29ad..82e7d76 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1528,18 +1528,22 @@ namespace OpenSim.Region.Framework.Scenes
1528 /// </summary> 1528 /// </summary>
1529 private void BackupWaitCallback(object o) 1529 private void BackupWaitCallback(object o)
1530 { 1530 {
1531 Backup(); 1531 Backup(false);
1532 } 1532 }
1533 1533
1534 /// <summary> 1534 /// <summary>
1535 /// Backup the scene. This acts as the main method of the backup thread. 1535 /// Backup the scene. This acts as the main method of the backup thread.
1536 /// </summary> 1536 /// </summary>
1537 /// <param name="forced">
1538 /// If true, then any changes that have not yet been persisted are persisted. If false,
1539 /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
1540 /// it's much more efficient to backup multiple changes at once rather than every single one).
1537 /// <returns></returns> 1541 /// <returns></returns>
1538 public void Backup() 1542 public void Backup(bool forced)
1539 { 1543 {
1540 lock (m_returns) 1544 lock (m_returns)
1541 { 1545 {
1542 EventManager.TriggerOnBackup(m_storageManager.DataStore); 1546 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
1543 m_backingup = false; 1547 m_backingup = false;
1544 1548
1545 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1549 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -2088,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2088// rootPart.PhysActor = null; 2092// rootPart.PhysActor = null;
2089// } 2093// }
2090 2094
2091 if (UnlinkSceneObject(group.UUID, false)) 2095 if (UnlinkSceneObject(group, false))
2092 { 2096 {
2093 EventManager.TriggerObjectBeingRemovedFromScene(group); 2097 EventManager.TriggerObjectBeingRemovedFromScene(group);
2094 EventManager.TriggerParcelPrimCountTainted(); 2098 EventManager.TriggerParcelPrimCountTainted();
@@ -2103,18 +2107,25 @@ namespace OpenSim.Region.Framework.Scenes
2103 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the 2107 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
2104 /// object itself is not destroyed. 2108 /// object itself is not destroyed.
2105 /// </summary> 2109 /// </summary>
2106 /// <param name="uuid">Id of object.</param> 2110 /// <param name="so">The scene object.</param>
2111 /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param>
2107 /// <returns>true if the object was in the scene, false if it was not</returns> 2112 /// <returns>true if the object was in the scene, false if it was not</returns>
2108 /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> 2113 public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
2109 public bool UnlinkSceneObject(UUID uuid, bool softDelete)
2110 { 2114 {
2111 if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) 2115 if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
2112 { 2116 {
2113 if (!softDelete) 2117 if (!softDelete)
2114 { 2118 {
2115 m_storageManager.DataStore.RemoveObject(uuid, 2119 // Force a database update so that the scene object group ID is accurate. It's possible that the
2116 m_regInfo.RegionID); 2120 // group has recently been delinked from another group but that this change has not been persisted
2121 // to the DB.
2122 ForceSceneObjectBackup(so);
2123 so.DetachFromBackup();
2124 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
2117 } 2125 }
2126
2127 // We need to keep track of this state in case this group is still queued for further backup.
2128 so.IsDeleted = true;
2118 2129
2119 return true; 2130 return true;
2120 } 2131 }
@@ -2145,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
2145 } 2156 }
2146 catch (Exception) 2157 catch (Exception)
2147 { 2158 {
2148 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2159 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
2149 } 2160 }
2150 return; 2161 return;
2151 } 2162 }
@@ -2162,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes
2162 } 2173 }
2163 catch (Exception) 2174 catch (Exception)
2164 { 2175 {
2165 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); 2176 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
2166 } 2177 }
2167 return; 2178 return;
2168 } 2179 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3b84734..86ba2aa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
300 300
301 public void BackupCurrentScene() 301 public void BackupCurrentScene()
302 { 302 {
303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 303 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); });
304 } 304 }
305 305
306 public bool TrySetCurrentScene(string regionName) 306 public bool TrySetCurrentScene(string regionName)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 64a6dd5..09e3e0e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1226,16 +1226,16 @@ namespace OpenSim.Region.Framework.Scenes
1226 } 1226 }
1227 1227
1228 /// <summary> 1228 /// <summary>
1229 /// Delete this group from its scene and tell all the scene presences about that deletion. 1229 /// Delete this group from its scene.
1230 /// </summary> 1230 /// </summary>
1231 /// <param name="silent">Broadcast deletions to all clients.</param> 1231 ///
1232 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1233 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1234 /// must be handled by the caller.
1235 ///
1236 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1232 public void DeleteGroup(bool silent) 1237 public void DeleteGroup(bool silent)
1233 { 1238 {
1234 // We need to keep track of this state in case this group is still queued for backup.
1235 m_isDeleted = true;
1236
1237 DetachFromBackup();
1238
1239 lock (m_parts) 1239 lock (m_parts)
1240 { 1240 {
1241 foreach (SceneObjectPart part in m_parts.Values) 1241 foreach (SceneObjectPart part in m_parts.Values)
@@ -1381,14 +1381,21 @@ namespace OpenSim.Region.Framework.Scenes
1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) 1381 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
1382 { 1382 {
1383 if (!m_isBackedUp) 1383 if (!m_isBackedUp)
1384 {
1385// m_log.DebugFormat(
1386// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
1384 return; 1387 return;
1385 1388 }
1386 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1387 // any exception propogate upwards.
1388 1389
1389 if (IsDeleted || UUID == UUID.Zero) 1390 if (IsDeleted || UUID == UUID.Zero)
1391 {
1392// m_log.DebugFormat(
1393// "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID);
1390 return; 1394 return;
1395 }
1391 1396
1397 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1398 // any exception propogate upwards.
1392 try 1399 try
1393 { 1400 {
1394 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart 1401 if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1421,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1421 if (HasGroupChanged) 1428 if (HasGroupChanged)
1422 { 1429 {
1423 // don't backup while it's selected or you're asking for changes mid stream. 1430 // don't backup while it's selected or you're asking for changes mid stream.
1424 if ((isTimeToPersist()) || (forcedBackup)) 1431 if (isTimeToPersist() || forcedBackup)
1425 { 1432 {
1426 m_log.DebugFormat( 1433 m_log.DebugFormat(
1427 "[SCENE]: Storing {0}, {1} in {2}", 1434 "[SCENE]: Storing {0}, {1} in {2}",
@@ -1444,19 +1451,19 @@ namespace OpenSim.Region.Framework.Scenes
1444 1451
1445 backup_group = null; 1452 backup_group = null;
1446 } 1453 }
1447 // else 1454// else
1448 // { 1455// {
1449 // m_log.DebugFormat( 1456// m_log.DebugFormat(
1450 // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", 1457// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}",
1451 // Name, UUID, IsSelected); 1458// Name, UUID, IsSelected);
1452 // } 1459// }
1453 } 1460 }
1454 } 1461 }
1455 catch (Exception e) 1462 catch (Exception e)
1456 { 1463 {
1457 m_log.ErrorFormat( 1464 m_log.ErrorFormat(
1458 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}\n\t{4}", 1465 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}",
1459 Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); 1466 Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1460 } 1467 }
1461 } 1468 }
1462 1469
@@ -2246,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
2246 } 2253 }
2247 } 2254 }
2248 2255
2249 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 2256 m_scene.UnlinkSceneObject(objectGroup, true);
2250 objectGroup.m_isDeleted = true; 2257 objectGroup.m_isDeleted = true;
2251 2258
2252 lock (objectGroup.m_parts) 2259 lock (objectGroup.m_parts)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index e140cd5..3a0dd00 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -28,20 +28,21 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33 34using OpenSim.Tests.Common;
34using NUnit.Framework;
35 35
36namespace OpenSim.Region.Framework.Scenes.Tests 36namespace OpenSim.Region.Framework.Scenes.Tests
37{ 37{
38 [TestFixture] 38 [TestFixture]
39 public class BorderTests 39 public class BorderTests
40 { 40 {
41
42 [Test] 41 [Test]
43 public void TestCross() 42 public void TestCross()
44 { 43 {
44 TestHelper.InMethod();
45
45 List<Border> testborders = new List<Border>(); 46 List<Border> testborders = new List<Border>();
46 47
47 Border NorthBorder = new Border(); 48 Border NorthBorder = new Border();
@@ -75,8 +76,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
75 position = new Vector3(200,280,21); 76 position = new Vector3(200,280,21);
76 Assert.That(NorthBorder.TestCross(position)); 77 Assert.That(NorthBorder.TestCross(position));
77 78
78
79
80 // Test automatic border crossing 79 // Test automatic border crossing
81 // by setting the border crossing aabb to be the whole region 80 // by setting the border crossing aabb to be the whole region
82 position = new Vector3(25,25,21); // safely within one 256m region 81 position = new Vector3(25,25,21); // safely within one 256m region
@@ -95,12 +94,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
95 94
96 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region 95 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region
97 Assert.That(WestBorder.TestCross(position)); 96 Assert.That(WestBorder.TestCross(position));
98
99 } 97 }
100 98
101 [Test] 99 [Test]
102 public void TestCrossSquare512() 100 public void TestCrossSquare512()
103 { 101 {
102 TestHelper.InMethod();
103
104 List<Border> testborders = new List<Border>(); 104 List<Border> testborders = new List<Border>();
105 105
106 Border NorthBorder = new Border(); 106 Border NorthBorder = new Border();
@@ -174,12 +174,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 Assert.That(!b.TestCross(position)); 174 Assert.That(!b.TestCross(position));
175 175
176 } 176 }
177
178 } 177 }
179 178
180 [Test] 179 [Test]
181 public void TestCrossRectangle512x256() 180 public void TestCrossRectangle512x256()
182 { 181 {
182 TestHelper.InMethod();
183
183 List<Border> testborders = new List<Border>(); 184 List<Border> testborders = new List<Border>();
184 185
185 Border NorthBorder = new Border(); 186 Border NorthBorder = new Border();
@@ -258,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
258 [Test] 259 [Test]
259 public void TestCrossOdd512x512w256hole() 260 public void TestCrossOdd512x512w256hole()
260 { 261 {
262 TestHelper.InMethod();
263
261 List<Border> testborders = new List<Border>(); 264 List<Border> testborders = new List<Border>();
262 // 512____ 265 // 512____
263 // | | 266 // | |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index 3e2a2af..b3c3e22 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
53 public void T010_AddObjects() 53 public void T010_AddObjects()
54 { 54 {
55 TestHelper.InMethod(); 55 TestHelper.InMethod();
56 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
57 56
58 random = new Random(); 57 random = new Random();
59 SceneObjectGroup found; 58 SceneObjectGroup found;
@@ -89,7 +88,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 public void T011_ThreadAddRemoveTest() 88 public void T011_ThreadAddRemoveTest()
90 { 89 {
91 TestHelper.InMethod(); 90 TestHelper.InMethod();
92 // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
93 91
94 // This test adds and removes with mutiple threads, attempting to break the 92 // This test adds and removes with mutiple threads, attempting to break the
95 // uuid and localid dictionary coherence. 93 // uuid and localid dictionary coherence.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0b7608d..62761fb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -26,13 +26,13 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 32using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
@@ -260,5 +260,86 @@ namespace OpenSim.Region.Framework.Scenes.Tests
260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), 260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
261 "Badness 3"); 261 "Badness 3");
262 } 262 }
263
264 /// <summary>
265 /// Test that a new scene object which is already linked is correctly persisted to the persistence layer.
266 /// </summary>
267 [Test]
268 public void TestNewSceneObjectLinkPersistence()
269 {
270 TestHelper.InMethod();
271 //log4net.Config.XmlConfigurator.Configure();
272
273 TestScene scene = SceneSetupHelpers.SetupScene();
274
275 string rootPartName = "rootpart";
276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
277 string linkPartName = "linkpart";
278 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
279
280 SceneObjectPart rootPart
281 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
282 { Name = rootPartName, UUID = rootPartUuid };
283 SceneObjectPart linkPart
284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
285 { Name = linkPartName, UUID = linkPartUuid };
286
287 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
288 sog.AddPart(linkPart);
289 scene.AddNewSceneObject(sog, true);
290
291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
292 // scene backup thread.
293 scene.Backup(true);
294
295 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
296
297 Assert.That(storedObjects.Count, Is.EqualTo(1));
298 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
299 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
300 Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid));
301 }
302
303 /// <summary>
304 /// Test that a delink of a previously linked object is correctly persisted to the database
305 /// </summary>
306 [Test]
307 public void TestDelinkPersistence()
308 {
309 TestHelper.InMethod();
310 log4net.Config.XmlConfigurator.Configure();
311
312 TestScene scene = SceneSetupHelpers.SetupScene();
313
314 string rootPartName = "rootpart";
315 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
316 string linkPartName = "linkpart";
317 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
318
319 SceneObjectPart rootPart
320 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
321 { Name = rootPartName, UUID = rootPartUuid };
322 SceneObjectPart linkPart
323 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
324 { Name = linkPartName, UUID = linkPartUuid };
325
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true);
329
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
331 // scene backup thread.
332 scene.Backup(true);
333
334 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
336 scene.DeleteSceneObject(groupToDelete, false);
337
338 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
339
340 Assert.That(storedObjects.Count, Is.EqualTo(1));
341 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
342 Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
343 }
263 } 344 }
264} 345} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index e39a362..ab5968c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -173,6 +173,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
173 173
174 Assert.That(neighbours.Count, Is.EqualTo(2)); 174 Assert.That(neighbours.Count, Is.EqualTo(2));
175 } 175 }
176
176 public void fixNullPresence() 177 public void fixNullPresence()
177 { 178 {
178 string firstName = "testfirstname"; 179 string firstName = "testfirstname";
@@ -389,8 +390,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
389 390
390 public static string GetRandomCapsObjectPath() 391 public static string GetRandomCapsObjectPath()
391 { 392 {
392 TestHelper.InMethod();
393
394 UUID caps = UUID.Random(); 393 UUID caps = UUID.Random();
395 string capsPath = caps.ToString(); 394 string capsPath = caps.ToString();
396 capsPath = capsPath.Remove(capsPath.Length - 4, 4); 395 capsPath = capsPath.Remove(capsPath.Length - 4, 4);
@@ -429,4 +428,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
429 return name.ToString(); 428 return name.ToString();
430 } 429 }
431 } 430 }
432} 431} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
index e5fcb54..fd59138 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
@@ -300,7 +300,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
300 } 300 }
301 } 301 }
302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup."); 302 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup.");
303 scene.Backup(); 303 scene.Backup(true);
304 } 304 }
305 305
306 /// <summary> 306 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 672109b..122ad40 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -133,7 +133,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
133 m_firstEmptyCompileQueue = false; 133 m_firstEmptyCompileQueue = false;
134 m_oarFileLoading = false; 134 m_oarFileLoading = false;
135 135
136 m_scene.Backup(); 136 m_scene.Backup(false);
137 137
138 c.From = "RegionReady"; 138 c.From = "RegionReady";
139 if (m_lastOarLoadedOk) 139 if (m_lastOarLoadedOk)
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
new file mode 100644
index 0000000..2a055cc
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -0,0 +1,203 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Collections.Generic;
30using log4net;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Data.Null
37{
38 /// <summary>
39 /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
40 /// tests can check correct persistence.
41 /// </summary>
42 public class NullDataStore : IRegionDataStore
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 protected Dictionary<UUID, RegionSettings> m_regionSettings = new Dictionary<UUID, RegionSettings>();
47 protected Dictionary<UUID, SceneObjectPart> m_sceneObjectParts = new Dictionary<UUID, SceneObjectPart>();
48 protected Dictionary<UUID, ICollection<TaskInventoryItem>> m_primItems
49 = new Dictionary<UUID, ICollection<TaskInventoryItem>>();
50 protected Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
51 protected Dictionary<UUID, LandData> m_landData = new Dictionary<UUID, LandData>();
52
53 public void Initialise(string dbfile)
54 {
55 return;
56 }
57
58 public void Dispose()
59 {
60 }
61
62 public void StoreRegionSettings(RegionSettings rs)
63 {
64 m_regionSettings[rs.RegionUUID] = rs;
65 }
66
67 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
68 {
69 //This connector doesn't support the windlight module yet
70 //Return default LL windlight settings
71 return new RegionLightShareData();
72 }
73
74 public void StoreRegionWindlightSettings(RegionLightShareData wl)
75 {
76 //This connector doesn't support the windlight module yet
77 }
78
79 public RegionSettings LoadRegionSettings(UUID regionUUID)
80 {
81 RegionSettings rs = null;
82 m_regionSettings.TryGetValue(regionUUID, out rs);
83 return rs;
84 }
85
86 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
87 {
88 // We can't simply store groups here because on delinking, OpenSim will not update the original group
89 // directly. Rather, the newly delinked parts will be updated to be in their own scene object group
90 // Therefore, we need to store parts rather than groups.
91 foreach (SceneObjectPart prim in obj.Children.Values)
92 {
93 m_log.DebugFormat(
94 "[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",
95 prim.Name, prim.UUID, obj.Name, obj.UUID, regionUUID);
96
97 m_sceneObjectParts[prim.UUID] = prim;
98 }
99 }
100
101 public void RemoveObject(UUID obj, UUID regionUUID)
102 {
103 // All parts belonging to the object with the uuid are removed.
104 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_sceneObjectParts.Values);
105 foreach (SceneObjectPart part in parts)
106 {
107 if (part.ParentGroup.UUID == obj)
108 {
109 m_log.DebugFormat(
110 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
111 part.Name, part.UUID, obj, regionUUID);
112 m_sceneObjectParts.Remove(part.UUID);
113 }
114 }
115 }
116
117 // see IRegionDatastore
118 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
119 {
120 m_primItems[primID] = items;
121 }
122
123 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
124 {
125 Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
126
127 // Create all of the SOGs from the root prims first
128 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
129 {
130 if (prim.IsRoot)
131 {
132 m_log.DebugFormat(
133 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
134 objects[prim.UUID] = new SceneObjectGroup(prim);
135 }
136 }
137
138 // Add all of the children objects to the SOGs
139 foreach (SceneObjectPart prim in m_sceneObjectParts.Values)
140 {
141 SceneObjectGroup sog;
142 if (prim.UUID != prim.ParentUUID)
143 {
144 if (objects.TryGetValue(prim.ParentUUID, out sog))
145 {
146 int originalLinkNum = prim.LinkNum;
147
148 sog.AddPart(prim);
149
150 // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum.
151 // We override that here
152 if (originalLinkNum != 0)
153 prim.LinkNum = originalLinkNum;
154 }
155 else
156 {
157 m_log.WarnFormat(
158 "[MOCK REGION DATA PLUGIN]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.",
159 prim.Name, prim.UUID, regionUUID, prim.ParentUUID);
160 }
161 }
162 }
163
164 // TODO: Load items. This is assymetric - we store items as a separate method but don't retrieve them that
165 // way!
166
167 return new List<SceneObjectGroup>(objects.Values);
168 }
169
170 public void StoreTerrain(double[,] ter, UUID regionID)
171 {
172 m_terrains[regionID] = ter;
173 }
174
175 public double[,] LoadTerrain(UUID regionID)
176 {
177 if (m_terrains.ContainsKey(regionID))
178 return m_terrains[regionID];
179 else
180 return null;
181 }
182
183 public void RemoveLandObject(UUID globalID)
184 {
185 if (m_landData.ContainsKey(globalID))
186 m_landData.Remove(globalID);
187 }
188
189 public void StoreLandObject(ILandObject land)
190 {
191 m_landData[land.LandData.GlobalID] = land.LandData;
192 }
193
194 public List<LandData> LoadLandObjects(UUID regionUUID)
195 {
196 return new List<LandData>(m_landData.Values);
197 }
198
199 public void Shutdown()
200 {
201 }
202 }
203} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index b70b47d..b47ad5d 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common.Mock
42 /// </summary> 42 /// </summary>
43 public class TestInventoryDataPlugin : IInventoryDataPlugin 43 public class TestInventoryDataPlugin : IInventoryDataPlugin
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 /// <value> 47 /// <value>
48 /// Inventory folders 48 /// Inventory folders
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 01f2c14..615e519 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -29,7 +29,6 @@ using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31using OpenSim.Framework.Communications;
32
33using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
34using OpenSim.Region.Framework; 33using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
@@ -49,6 +48,11 @@ namespace OpenSim.Tests.Common.Mock
49 } 48 }
50 49
51 /// <summary> 50 /// <summary>
51 /// Allow retrieval for test check purposes
52 /// </summary>
53 public StorageManager StorageManager { get { return m_storageManager; } }
54
55 /// <summary>
52 /// Temporarily override session authentication for tests (namely teleport). 56 /// Temporarily override session authentication for tests (namely teleport).
53 /// </summary> 57 /// </summary>
54 /// 58 ///
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index d9ded2d..9318a27 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -157,7 +157,7 @@ namespace OpenSim.Tests.Common.Setup
157 AgentCircuitManager acm = new AgentCircuitManager(); 157 AgentCircuitManager acm = new AgentCircuitManager();
158 SceneCommunicationService scs = new SceneCommunicationService(); 158 SceneCommunicationService scs = new SceneCommunicationService();
159 159
160 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); 160 StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", "");
161 IConfigSource configSource = new IniConfigSource(); 161 IConfigSource configSource = new IniConfigSource();
162 162
163 TestScene testScene = new TestScene( 163 TestScene testScene = new TestScene(
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index c57363a..915af7e 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); 52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53 53
54 item.Folder = objsFolder.ID; 54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(userId, item); 55 scene.AddInventoryItem(item);
56 56
57 return item; 57 return item;
58 } 58 }