aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.nant/local.include35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs41
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs19
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs8
5 files changed, 73 insertions, 48 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 58d1ad1..8c72c80 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -38,51 +38,50 @@
38 the assembly here as an exec, and you add the fail clause later. 38 the assembly here as an exec, and you add the fail clause later.
39 This lets all the unit tests run and tells you if they fail at the 39 This lets all the unit tests run and tells you if they fail at the
40 end, instead of stopping short --> 40 end, instead of stopping short -->
41 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.tests"> 41 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.tests">
42 <arg value="./bin/OpenSim.Framework.Tests.dll" /> 42 <arg value="./bin/OpenSim.Framework.Tests.dll" />
43 </exec> 43 </exec>
44 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
44 45
45 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.communications.tests"> 46 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.communications.tests">
46 <arg value="./bin/OpenSim.Framework.Communications.Tests.dll" /> 47 <arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
47 </exec> 48 </exec>
49 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
48 50
49 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.servers.tests"> 51 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
50 <arg value="./bin/OpenSim.Framework.Servers.Tests.dll" /> 52 <arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
51 </exec> 53 </exec>
54 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
52 55
53 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests"> 56 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
54 <arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> 57 <arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
55 </exec> 58 </exec>
59 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
56 60
57 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.scriptengine.tests"> 61 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.scriptengine.tests">
58 <arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> 62 <arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
59 </exec> 63 </exec>
64 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
60 65
61 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.coremodules.tests"> 66 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.coremodules.tests">
62 <arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" /> 67 <arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
63 </exec> 68 </exec>
69 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
64 70
65 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests"> 71 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
66 <arg value="./bin/OpenSim.Region.Framework.Tests.dll" /> 72 <arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
67 </exec> 73 </exec>
74 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
68 75
69 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.sqlite.tests"> 76 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.sqlite.tests">
70 <arg value="./bin/OpenSim.Data.SQLite.Tests.dll" /> 77 <arg value="./bin/OpenSim.Data.SQLite.Tests.dll" />
71 </exec> 78 </exec>
79 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
72 80
73 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.mysql.tests"> 81 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.mysql.tests">
74 <arg value="./bin/OpenSim.Data.MySQL.Tests.dll" /> 82 <arg value="./bin/OpenSim.Data.MySQL.Tests.dll" />
75 </exec> 83 </exec>
76
77 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
78 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
79 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.sqlite.tests)==0}" />
80 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" /> 84 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
81 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
82 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
83 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
84 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
85 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
86 85
87</target> 86</target>
88 87
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index f73a7e3..18728c6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -60,6 +60,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
60 protected UuidGatherer m_assetGatherer; 60 protected UuidGatherer m_assetGatherer;
61 61
62 /// <value> 62 /// <value>
63 /// ID of this request
64 /// </value>
65 protected Guid m_id;
66
67 /// <value>
63 /// Used to collect the uuids of the assets that we need to save into the archive 68 /// Used to collect the uuids of the assets that we need to save into the archive
64 /// </value> 69 /// </value>
65 protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>(); 70 protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>();
@@ -78,8 +83,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
78 /// Constructor 83 /// Constructor
79 /// </summary> 84 /// </summary>
80 public InventoryArchiveWriteRequest( 85 public InventoryArchiveWriteRequest(
81 InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath) 86 Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath)
82 : this( 87 : this(
88 id,
83 module, 89 module,
84 userInfo, 90 userInfo,
85 invPath, 91 invPath,
@@ -91,8 +97,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 /// Constructor 97 /// Constructor
92 /// </summary> 98 /// </summary>
93 public InventoryArchiveWriteRequest( 99 public InventoryArchiveWriteRequest(
94 InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream) 100 Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream)
95 { 101 {
102 m_id = id;
96 m_module = module; 103 m_module = module;
97 m_userInfo = userInfo; 104 m_userInfo = userInfo;
98 m_invPath = invPath; 105 m_invPath = invPath;
@@ -116,7 +123,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
116 succeeded = false; 123 succeeded = false;
117 } 124 }
118 125
119 m_module.TriggerInventoryArchiveSaved(succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 126 m_module.TriggerInventoryArchiveSaved(
127 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
120 } 128 }
121 129
122 protected void SaveInvItem(InventoryItemBase inventoryItem, string path) 130 protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
@@ -199,7 +207,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
199 InventoryFolderImpl inventoryFolder = null; 207 InventoryFolderImpl inventoryFolder = null;
200 InventoryItemBase inventoryItem = null; 208 InventoryItemBase inventoryItem = null;
201 209
202 /*
203 if (!m_userInfo.HasReceivedInventory) 210 if (!m_userInfo.HasReceivedInventory)
204 { 211 {
205 // If the region server has access to the user admin service (by which users are created), 212 // If the region server has access to the user admin service (by which users are created),
@@ -221,7 +228,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 m_userInfo.FetchInventory(); 228 m_userInfo.FetchInventory();
222 } 229 }
223 } 230 }
224 */
225 231
226 bool foundStar = false; 232 bool foundStar = false;
227 233
@@ -274,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
274 // We couldn't find the path indicated 280 // We couldn't find the path indicated
275 m_saveStream.Close(); 281 m_saveStream.Close();
276 m_module.TriggerInventoryArchiveSaved( 282 m_module.TriggerInventoryArchiveSaved(
277 false, m_userInfo, m_invPath, m_saveStream, 283 m_id, false, m_userInfo, m_invPath, m_saveStream,
278 new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath))); 284 new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath)));
279 return; 285 return;
280 } 286 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index c495e02..55d7997 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -57,7 +57,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
57 /// <summary> 57 /// <summary>
58 /// The file to load and save inventory if no filename has been specified 58 /// The file to load and save inventory if no filename has been specified
59 /// </summary> 59 /// </summary>
60 protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz"; 60 protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory_iar.tar.gz";
61
62 /// <value>
63 /// Pending save completions initiated from the console
64 /// </value>
65 protected List<Guid> m_pendingConsoleSaves = new List<Guid>();
61 66
62 /// <value> 67 /// <value>
63 /// All scenes that this module knows about 68 /// All scenes that this module knows about
@@ -106,32 +111,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
106 /// Trigger the inventory archive saved event. 111 /// Trigger the inventory archive saved event.
107 /// </summary> 112 /// </summary>
108 protected internal void TriggerInventoryArchiveSaved( 113 protected internal void TriggerInventoryArchiveSaved(
109 bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) 114 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
115 Exception reportedException)
110 { 116 {
111 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; 117 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
112 if (handlerInventoryArchiveSaved != null) 118 if (handlerInventoryArchiveSaved != null)
113 handlerInventoryArchiveSaved(succeeded, userInfo, invPath, saveStream, reportedException); 119 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException);
114 } 120 }
115 121
116 public void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream) 122 public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream)
117 { 123 {
118 if (m_scenes.Count > 0) 124 if (m_scenes.Count > 0)
119 { 125 {
120 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 126 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
121 127
122 if (userInfo != null) 128 if (userInfo != null)
123 new InventoryArchiveWriteRequest(this, userInfo, invPath, saveStream).Execute(); 129 new InventoryArchiveWriteRequest(id, this, userInfo, invPath, saveStream).Execute();
124 } 130 }
125 } 131 }
126 132
127 public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath) 133 public void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string savePath)
128 { 134 {
129 if (m_scenes.Count > 0) 135 if (m_scenes.Count > 0)
130 { 136 {
131 CachedUserInfo userInfo = GetUserInfo(firstName, lastName); 137 CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
132 138
133 if (userInfo != null) 139 if (userInfo != null)
134 new InventoryArchiveWriteRequest(this, userInfo, invPath, savePath).Execute(); 140 new InventoryArchiveWriteRequest(id, this, userInfo, invPath, savePath).Execute();
135 } 141 }
136 } 142 }
137 143
@@ -215,13 +221,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
215 m_log.InfoFormat( 221 m_log.InfoFormat(
216 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", 222 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
217 savePath, invPath, firstName, lastName); 223 savePath, invPath, firstName, lastName);
218 224
219 ArchiveInventory(firstName, lastName, invPath, savePath); 225 Guid id = Guid.NewGuid();
220 } 226 ArchiveInventory(id, firstName, lastName, invPath, savePath);
227
228 lock (m_pendingConsoleSaves)
229 m_pendingConsoleSaves.Add(id);
230 }
221 231
222 private void SaveInvConsoleCommandCompleted( 232 private void SaveInvConsoleCommandCompleted(
223 bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) 233 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
234 Exception reportedException)
224 { 235 {
236 lock (m_pendingConsoleSaves)
237 {
238 if (m_pendingConsoleSaves.Contains(id))
239 m_pendingConsoleSaves.Remove(id);
240 else
241 return;
242 }
243
225 if (succeeded) 244 if (succeeded)
226 { 245 {
227 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name); 246 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 066c5d3..a151c9d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,6 +55,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 [TestFixture] 55 [TestFixture]
56 public class InventoryArchiverTests 56 public class InventoryArchiverTests
57 { 57 {
58 protected ManualResetEvent mre = new ManualResetEvent(false);
59
58 private void InventoryReceived(UUID userId) 60 private void InventoryReceived(UUID userId)
59 { 61 {
60 lock (this) 62 lock (this)
@@ -64,12 +66,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
64 } 66 }
65 67
66 private void SaveCompleted( 68 private void SaveCompleted(
67 bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) 69 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream,
70 Exception reportedException)
68 { 71 {
69 lock (this) 72 mre.Set();
70 {
71 Monitor.PulseAll(this);
72 }
73 } 73 }
74 74
75 /// <summary> 75 /// <summary>
@@ -152,11 +152,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
152 MemoryStream archiveWriteStream = new MemoryStream(); 152 MemoryStream archiveWriteStream = new MemoryStream();
153 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 153 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
154 154
155 lock (this) 155 mre.Reset();
156 { 156 archiverModule.ArchiveInventory(
157 archiverModule.ArchiveInventory(userFirstName, userLastName, "Objects", archiveWriteStream); 157 Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream);
158 Monitor.Wait(this, 60000); 158 mre.WaitOne();
159 }
160 159
161 byte[] archive = archiveWriteStream.ToArray(); 160 byte[] archive = archiveWriteStream.ToArray();
162 MemoryStream archiveReadStream = new MemoryStream(archive); 161 MemoryStream archiveReadStream = new MemoryStream(archive);
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index df6650f..457b5b8 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -34,13 +34,14 @@ namespace OpenSim.Region.Framework.Interfaces
34 /// <summary> 34 /// <summary>
35 /// Used for the OnInventoryArchiveSaved event. 35 /// Used for the OnInventoryArchiveSaved event.
36 /// </summary> 36 /// </summary>
37 /// <param name="id">Request id</param>
37 /// <param name="succeeded">true if the save succeeded, false otherwise</param> 38 /// <param name="succeeded">true if the save succeeded, false otherwise</param>
38 /// <param name="userInfo">The user for whom the save was conducted</param> 39 /// <param name="userInfo">The user for whom the save was conducted</param>
39 /// <param name="invPath">The inventory path saved</param> 40 /// <param name="invPath">The inventory path saved</param>
40 /// <param name="savePath">The stream to which the archive was saved</param> 41 /// <param name="savePath">The stream to which the archive was saved</param>
41 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> 42 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
42 public delegate void InventoryArchiveSaved( 43 public delegate void InventoryArchiveSaved(
43 bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException); 44 Guid id, bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException);
44 45
45 public interface IInventoryArchiverModule 46 public interface IInventoryArchiverModule
46 { 47 {
@@ -61,10 +62,11 @@ namespace OpenSim.Region.Framework.Interfaces
61 /// <summary> 62 /// <summary>
62 /// Archive a user's inventory folder to the given stream 63 /// Archive a user's inventory folder to the given stream
63 /// </summary> 64 /// </summary>
65 /// <param name="id">ID representing this request. This will later be returned in the save event</param>
64 /// <param name="firstName"></param> 66 /// <param name="firstName"></param>
65 /// <param name="lastName"></param> 67 /// <param name="lastName"></param>
66 /// <param name="invPath">The inventory path from which the inventory should be saved.</param> 68 /// <param name="invPath">The inventory path from which the inventory should be saved.</param>
67 /// <param name="saveStream">The stream to which the inventory archive will be saved</param> 69 /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
68 void ArchiveInventory(string firstName, string lastName, string invPath, Stream saveStream); 70 void ArchiveInventory(Guid id, string firstName, string lastName, string invPath, Stream saveStream);
69 } 71 }
70} 72}