aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-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.cs42
-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.cs83
-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, 379 insertions, 65 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 d4e2736..3fae5e6 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes
688 } 688 }
689 } 689 }
690 690
691 public void TriggerOnBackup(IRegionDataStore dstore) 691 public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
692 { 692 {
693 OnBackupDelegate handlerOnAttach = OnBackup; 693 OnBackupDelegate handlerOnAttach = OnBackup;
694 if (handlerOnAttach != null) 694 if (handlerOnAttach != null)
@@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
697 { 697 {
698 try 698 try
699 { 699 {
700 d(dstore, false); 700 d(dstore, forced);
701 } 701 }
702 catch (Exception e) 702 catch (Exception e)
703 { 703 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 5ee8955..ccbd880 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1719,7 +1719,7 @@ namespace OpenSim.Region.Framework.Scenes
1719 public virtual void DeRezObject(IClientAPI remoteClient, uint localID, 1719 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1720 UUID groupID, DeRezAction action, UUID destinationID) 1720 UUID groupID, DeRezAction action, UUID destinationID)
1721 { 1721 {
1722 DeRezObjects(remoteClient, new List<uint>() { localID} , groupID, action, destinationID); 1722 DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
1723 } 1723 }
1724 1724
1725 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1725 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
@@ -1764,11 +1764,6 @@ namespace OpenSim.Region.Framework.Scenes
1764 deleteIDs.Add(localID); 1764 deleteIDs.Add(localID);
1765 deleteGroups.Add(grp); 1765 deleteGroups.Add(grp);
1766 1766
1767 // Force a database backup/update on this SceneObjectGroup
1768 // So that we know the database is upto date,
1769 // for when deleting the object from it
1770 ForceSceneObjectBackup(grp);
1771
1772 if (remoteClient == null) 1767 if (remoteClient == null)
1773 { 1768 {
1774 // Autoreturn has a null client. Nothing else does. So 1769 // 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 94a9dab..6b71426 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1562,18 +1562,22 @@ namespace OpenSim.Region.Framework.Scenes
1562 /// </summary> 1562 /// </summary>
1563 private void BackupWaitCallback(object o) 1563 private void BackupWaitCallback(object o)
1564 { 1564 {
1565 Backup(); 1565 Backup(false);
1566 } 1566 }
1567 1567
1568 /// <summary> 1568 /// <summary>
1569 /// Backup the scene. This acts as the main method of the backup thread. 1569 /// Backup the scene. This acts as the main method of the backup thread.
1570 /// </summary> 1570 /// </summary>
1571 /// <param name="forced">
1572 /// If true, then any changes that have not yet been persisted are persisted. If false,
1573 /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
1574 /// it's much more efficient to backup multiple changes at once rather than every single one).
1571 /// <returns></returns> 1575 /// <returns></returns>
1572 public void Backup() 1576 public void Backup(bool forced)
1573 { 1577 {
1574 lock (m_returns) 1578 lock (m_returns)
1575 { 1579 {
1576 EventManager.TriggerOnBackup(m_storageManager.DataStore); 1580 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
1577 m_backingup = false; 1581 m_backingup = false;
1578 1582
1579 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1583 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -2155,7 +2159,7 @@ namespace OpenSim.Region.Framework.Scenes
2155// rootPart.PhysActor = null; 2159// rootPart.PhysActor = null;
2156// } 2160// }
2157 2161
2158 if (UnlinkSceneObject(group.UUID, false)) 2162 if (UnlinkSceneObject(group, false))
2159 { 2163 {
2160 EventManager.TriggerObjectBeingRemovedFromScene(group); 2164 EventManager.TriggerObjectBeingRemovedFromScene(group);
2161 EventManager.TriggerParcelPrimCountTainted(); 2165 EventManager.TriggerParcelPrimCountTainted();
@@ -2170,18 +2174,25 @@ namespace OpenSim.Region.Framework.Scenes
2170 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the 2174 /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the
2171 /// object itself is not destroyed. 2175 /// object itself is not destroyed.
2172 /// </summary> 2176 /// </summary>
2173 /// <param name="uuid">Id of object.</param> 2177 /// <param name="so">The scene object.</param>
2178 /// <param name="softDelete">If true, only deletes from scene, but keeps the object in the database.</param>
2174 /// <returns>true if the object was in the scene, false if it was not</returns> 2179 /// <returns>true if the object was in the scene, false if it was not</returns>
2175 /// <param name="softDelete">If true, only deletes from scene, but keeps object in database.</param> 2180 public bool UnlinkSceneObject(SceneObjectGroup so, bool softDelete)
2176 public bool UnlinkSceneObject(UUID uuid, bool softDelete)
2177 { 2181 {
2178 if (m_sceneGraph.DeleteSceneObject(uuid, softDelete)) 2182 if (m_sceneGraph.DeleteSceneObject(so.UUID, softDelete))
2179 { 2183 {
2180 if (!softDelete) 2184 if (!softDelete)
2181 { 2185 {
2182 m_storageManager.DataStore.RemoveObject(uuid, 2186 // Force a database update so that the scene object group ID is accurate. It's possible that the
2183 m_regInfo.RegionID); 2187 // group has recently been delinked from another group but that this change has not been persisted
2188 // to the DB.
2189 ForceSceneObjectBackup(so);
2190 so.DetachFromBackup();
2191 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
2184 } 2192 }
2193
2194 // We need to keep track of this state in case this group is still queued for further backup.
2195 so.IsDeleted = true;
2185 2196
2186 return true; 2197 return true;
2187 } 2198 }
@@ -2212,7 +2223,7 @@ namespace OpenSim.Region.Framework.Scenes
2212 } 2223 }
2213 catch (Exception) 2224 catch (Exception)
2214 { 2225 {
2215 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border."); 2226 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
2216 } 2227 }
2217 return; 2228 return;
2218 } 2229 }
@@ -2229,7 +2240,7 @@ namespace OpenSim.Region.Framework.Scenes
2229 } 2240 }
2230 catch (Exception) 2241 catch (Exception)
2231 { 2242 {
2232 m_log.Warn("[DATABASE]: exception when trying to return the prim that crossed the border."); 2243 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
2233 } 2244 }
2234 return; 2245 return;
2235 } 2246 }
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 5a586d4..470fdd7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1556,9 +1556,14 @@ namespace OpenSim.Region.Framework.Scenes
1556 } 1556 }
1557 1557
1558 /// <summary> 1558 /// <summary>
1559 /// Delete this group from its scene and tell all the scene presences about that deletion. 1559 /// Delete this group from its scene.
1560 /// </summary> 1560 /// </summary>
1561 /// <param name="silent">Broadcast deletions to all clients.</param> 1561 ///
1562 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1563 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1564 /// must be handled by the caller.
1565 ///
1566 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1562 public void DeleteGroup(bool silent) 1567 public void DeleteGroup(bool silent)
1563 { 1568 {
1564 // We need to keep track of this state in case this group is still queued for backup. 1569 // We need to keep track of this state in case this group is still queued for backup.
@@ -1729,14 +1734,21 @@ namespace OpenSim.Region.Framework.Scenes
1729 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) 1734 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
1730 { 1735 {
1731 if (!m_isBackedUp) 1736 if (!m_isBackedUp)
1737 {
1738// m_log.DebugFormat(
1739// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
1732 return; 1740 return;
1733 1741 }
1734 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1735 // any exception propogate upwards.
1736 1742
1737 if (IsDeleted || UUID == UUID.Zero) 1743 if (IsDeleted || UUID == UUID.Zero)
1744 {
1745// m_log.DebugFormat(
1746// "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID);
1738 return; 1747 return;
1748 }
1739 1749
1750 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1751 // any exception propogate upwards.
1740 try 1752 try
1741 { 1753 {
1742 if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart 1754 if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1772,7 +1784,7 @@ namespace OpenSim.Region.Framework.Scenes
1772 if (HasGroupChanged) 1784 if (HasGroupChanged)
1773 { 1785 {
1774 // don't backup while it's selected or you're asking for changes mid stream. 1786 // don't backup while it's selected or you're asking for changes mid stream.
1775 if ((isTimeToPersist()) || (forcedBackup)) 1787 if (isTimeToPersist() || forcedBackup)
1776 { 1788 {
1777 // m_log.DebugFormat( 1789 // m_log.DebugFormat(
1778 // "[SCENE]: Storing {0}, {1} in {2}", 1790 // "[SCENE]: Storing {0}, {1} in {2}",
@@ -1795,19 +1807,19 @@ namespace OpenSim.Region.Framework.Scenes
1795 1807
1796 backup_group = null; 1808 backup_group = null;
1797 } 1809 }
1798 // else 1810// else
1799 // { 1811// {
1800 // m_log.DebugFormat( 1812// m_log.DebugFormat(
1801 // "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}", 1813// "[SCENE]: Did not update persistence of object {0} {1}, selected = {2}",
1802 // Name, UUID, IsSelected); 1814// Name, UUID, IsSelected);
1803 // } 1815// }
1804 } 1816 }
1805 } 1817 }
1806 catch (Exception e) 1818 catch (Exception e)
1807 { 1819 {
1808 m_log.ErrorFormat( 1820 m_log.ErrorFormat(
1809 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}\n\t{4}", 1821 "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}",
1810 Name, UUID, m_scene.RegionInfo.RegionName, e, e.StackTrace); 1822 Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace);
1811 } 1823 }
1812 } 1824 }
1813 1825
@@ -2672,7 +2684,7 @@ namespace OpenSim.Region.Framework.Scenes
2672 part.ClearUndoState(); 2684 part.ClearUndoState();
2673 } 2685 }
2674 2686
2675 m_scene.UnlinkSceneObject(objectGroup.UUID, true); 2687 m_scene.UnlinkSceneObject(objectGroup, true);
2676 objectGroup.m_isDeleted = true; 2688 objectGroup.m_isDeleted = true;
2677 2689
2678 objectGroup.lockPartsForWrite(true); 2690 objectGroup.lockPartsForWrite(true);
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..e3ef263 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}
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 }