aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-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
11 files changed, 163 insertions, 58 deletions
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