diff options
17 files changed, 485 insertions, 141 deletions
@@ -43,3 +43,4 @@ OpenSim/OpenSim.usertasks | |||
43 | TAGS | 43 | TAGS |
44 | *~ | 44 | *~ |
45 | Makefile.local | 45 | Makefile.local |
46 | bin/.version | ||
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 10aff42..8ee1b1a 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -49,16 +49,24 @@ namespace OpenSim.Framework.Communications.Cache | |||
49 | IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); | 49 | IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); |
50 | 50 | ||
51 | public delegate void OnItemReceivedDelegate(UUID itemID); | 51 | public delegate void OnItemReceivedDelegate(UUID itemID); |
52 | public delegate void OnInventoryReceivedDelegate(UUID userID); | ||
52 | 53 | ||
53 | /// <summary> | 54 | /// <summary> |
54 | /// Stores user profile and inventory data received from backend services for a particular user. | 55 | /// Stores user profile and inventory data received from backend services for a particular user. |
55 | /// </summary> | 56 | /// </summary> |
56 | public class CachedUserInfo | 57 | public class CachedUserInfo |
57 | { | 58 | { |
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
60 | |||
61 | //// <value> | ||
62 | /// Fired when a particular item has been received from the inventory service | ||
63 | /// </value> | ||
58 | public event OnItemReceivedDelegate OnItemReceived; | 64 | public event OnItemReceivedDelegate OnItemReceived; |
59 | 65 | ||
60 | private static readonly ILog m_log | 66 | /// <value> |
61 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | /// Fired once the entire inventory has been received for the user |
68 | /// </value> | ||
69 | public event OnInventoryReceivedDelegate OnInventoryReceived; | ||
62 | 70 | ||
63 | /// <summary> | 71 | /// <summary> |
64 | /// The comms manager holds references to services (user, grid, inventory, etc.) | 72 | /// The comms manager holds references to services (user, grid, inventory, etc.) |
@@ -133,7 +141,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
133 | UUID parentFolderId = folder.ParentID; | 141 | UUID parentFolderId = folder.ParentID; |
134 | 142 | ||
135 | if (dictionary.ContainsKey(parentFolderId)) | 143 | if (dictionary.ContainsKey(parentFolderId)) |
144 | { | ||
136 | dictionary[parentFolderId].Add(folder); | 145 | dictionary[parentFolderId].Add(folder); |
146 | } | ||
137 | else | 147 | else |
138 | { | 148 | { |
139 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 149 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
@@ -299,6 +309,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
299 | request.Execute(); | 309 | request.Execute(); |
300 | } | 310 | } |
301 | } | 311 | } |
312 | |||
313 | if (OnInventoryReceived != null) | ||
314 | OnInventoryReceived(UserProfile.ID); | ||
302 | } | 315 | } |
303 | 316 | ||
304 | /// <summary> | 317 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index fdc20dd..fe88cf5 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -43,6 +43,18 @@ namespace OpenSim.Framework.Communications.Tests | |||
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class UserProfileCacheServiceTests | 44 | public class UserProfileCacheServiceTests |
45 | { | 45 | { |
46 | /// <value>Used by tests to indicate whether an async operation timed out</value> | ||
47 | private bool timedOut; | ||
48 | |||
49 | private void InventoryReceived(UUID userId) | ||
50 | { | ||
51 | lock (this) | ||
52 | { | ||
53 | timedOut = false; | ||
54 | Monitor.PulseAll(this); | ||
55 | } | ||
56 | } | ||
57 | |||
46 | [Test] | 58 | [Test] |
47 | public void TestGetUserDetails() | 59 | public void TestGetUserDetails() |
48 | { | 60 | { |
@@ -54,6 +66,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
54 | CachedUserInfo nonExistingUserInfo; | 66 | CachedUserInfo nonExistingUserInfo; |
55 | 67 | ||
56 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 68 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
69 | Scene myScene = SceneSetupHelpers.SetupScene(commsManager, ""); | ||
57 | 70 | ||
58 | // Check we can't retrieve info before it exists by uuid | 71 | // Check we can't retrieve info before it exists by uuid |
59 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | 72 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); |
@@ -116,15 +129,16 @@ namespace OpenSim.Framework.Communications.Tests | |||
116 | { | 129 | { |
117 | TestHelper.InMethod(); | 130 | TestHelper.InMethod(); |
118 | 131 | ||
119 | Scene myScene = SceneSetupHelpers.SetupScene(); | 132 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
120 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 133 | |
121 | for (int i = 0 ; i < 50 ; i++) | 134 | timedOut = true; |
122 | { | 135 | lock (this) |
123 | if (userInfo.HasReceivedInventory == true) | 136 | { |
124 | break; | 137 | UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
125 | Thread.Sleep(200); | 138 | Monitor.Wait(this, 60000); |
126 | } | 139 | } |
127 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | 140 | |
141 | Assert.That(timedOut, Is.False, "Timed out"); | ||
128 | } | 142 | } |
129 | 143 | ||
130 | [Test] | 144 | [Test] |
@@ -132,15 +146,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
132 | { | 146 | { |
133 | TestHelper.InMethod(); | 147 | TestHelper.InMethod(); |
134 | 148 | ||
135 | Scene myScene = SceneSetupHelpers.SetupScene(); | 149 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
136 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 150 | CachedUserInfo userInfo; |
137 | for (int i = 0 ; i < 50 ; i++) | 151 | |
138 | { | 152 | lock (this) |
139 | if (userInfo.HasReceivedInventory == true) | 153 | { |
140 | break; | 154 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
141 | Thread.Sleep(200); | 155 | Monitor.Wait(this, 60000); |
142 | } | 156 | } |
143 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
144 | 157 | ||
145 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | 158 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); |
146 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); | 159 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); |
@@ -154,15 +167,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
154 | { | 167 | { |
155 | TestHelper.InMethod(); | 168 | TestHelper.InMethod(); |
156 | 169 | ||
157 | Scene myScene = SceneSetupHelpers.SetupScene(); | 170 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
158 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 171 | CachedUserInfo userInfo; |
159 | for (int i = 0 ; i < 50 ; i++) | 172 | |
160 | { | 173 | lock (this) |
161 | if (userInfo.HasReceivedInventory == true) | 174 | { |
162 | break; | 175 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
163 | Thread.Sleep(200); | 176 | Monitor.Wait(this, 60000); |
164 | } | 177 | } |
165 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
166 | 178 | ||
167 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); | 179 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); |
168 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); | 180 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); |
@@ -190,15 +202,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
190 | { | 202 | { |
191 | TestHelper.InMethod(); | 203 | TestHelper.InMethod(); |
192 | 204 | ||
193 | Scene myScene = SceneSetupHelpers.SetupScene(); | 205 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
194 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 206 | CachedUserInfo userInfo; |
195 | for (int i = 0 ; i < 50 ; i++) | 207 | |
196 | { | 208 | lock (this) |
197 | if (userInfo.HasReceivedInventory == true) | 209 | { |
198 | break; | 210 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
199 | Thread.Sleep(200); | 211 | Monitor.Wait(this, 60000); |
200 | } | 212 | } |
201 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
202 | 213 | ||
203 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 214 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
204 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 215 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -256,15 +267,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
256 | { | 267 | { |
257 | TestHelper.InMethod(); | 268 | TestHelper.InMethod(); |
258 | 269 | ||
259 | Scene myScene = SceneSetupHelpers.SetupScene(); | 270 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
260 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 271 | CachedUserInfo userInfo; |
261 | for (int i = 0 ; i < 50 ; i++) | 272 | |
262 | { | 273 | lock (this) |
263 | if (userInfo.HasReceivedInventory == true) | 274 | { |
264 | break; | 275 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
265 | Thread.Sleep(200); | 276 | Monitor.Wait(this, 60000); |
266 | } | 277 | } |
267 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
268 | 278 | ||
269 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 279 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
270 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); | 280 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); |
@@ -297,15 +307,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
297 | TestHelper.InMethod(); | 307 | TestHelper.InMethod(); |
298 | //log4net.Config.XmlConfigurator.Configure(); | 308 | //log4net.Config.XmlConfigurator.Configure(); |
299 | 309 | ||
300 | Scene myScene = SceneSetupHelpers.SetupScene(); | 310 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
301 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 311 | CachedUserInfo userInfo; |
302 | for (int i = 0 ; i < 50 ; i++) | 312 | |
303 | { | 313 | lock (this) |
304 | if (userInfo.HasReceivedInventory == true) | 314 | { |
305 | break; | 315 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
306 | Thread.Sleep(200); | 316 | Monitor.Wait(this, 60000); |
307 | } | 317 | } |
308 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
309 | 318 | ||
310 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); | 319 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); |
311 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 320 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -322,4 +331,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
322 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); | 331 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); |
323 | } | 332 | } |
324 | } | 333 | } |
325 | } | 334 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 17a3393..b1b7809 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -36,6 +36,7 @@ using Nwc.XmlRpc; | |||
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Communications.Services; | 37 | using OpenSim.Framework.Communications.Services; |
38 | using OpenSim.Region.Communications.Local; | 38 | using OpenSim.Region.Communications.Local; |
39 | using OpenSim.Tests.Common.Setup; | ||
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Client.Linden; | 41 | using OpenSim.Client.Linden; |
41 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
@@ -57,11 +58,12 @@ namespace OpenSim.Framework.Communications.Tests | |||
57 | private string m_regionExternalName = "localhost"; | 58 | private string m_regionExternalName = "localhost"; |
58 | 59 | ||
59 | private IPEndPoint m_capsEndPoint; | 60 | private IPEndPoint m_capsEndPoint; |
60 | private CommunicationsManager m_commsManager; | 61 | private TestCommunicationsManager m_commsManager; |
61 | private TestLoginToRegionConnector m_regionConnector; | 62 | private TestLoginToRegionConnector m_regionConnector; |
62 | private LocalUserServices m_localUserServices; | 63 | private LocalUserServices m_localUserServices; |
63 | private LoginService m_loginService; | 64 | private LoginService m_loginService; |
64 | private UserProfileData m_userProfileData; | 65 | private UserProfileData m_userProfileData; |
66 | private TestScene m_testScene; | ||
65 | 67 | ||
66 | [SetUp] | 68 | [SetUp] |
67 | public void SetUpLoginEnviroment() | 69 | public void SetUpLoginEnviroment() |
@@ -69,13 +71,16 @@ namespace OpenSim.Framework.Communications.Tests | |||
69 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); | 71 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); |
70 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | 72 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); |
71 | m_regionConnector = new TestLoginToRegionConnector(); | 73 | m_regionConnector = new TestLoginToRegionConnector(); |
74 | m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, ""); | ||
72 | 75 | ||
73 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); | 76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); |
74 | 77 | ||
78 | //IInventoryService m_inventoryService = new TestInventoryService(); | ||
79 | |||
75 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; | 80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; |
76 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); | 81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); |
77 | 82 | ||
78 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(), | 83 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService, |
79 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); | 84 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); |
80 | 85 | ||
81 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); | 86 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 58174a0..7ad6bbf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -698,7 +698,7 @@ namespace OpenSim.Framework.Communications | |||
698 | if (rootfolder != null) | 698 | if (rootfolder != null) |
699 | userProf.RootInventoryFolderID = rootfolder.ID; | 699 | userProf.RootInventoryFolderID = rootfolder.ID; |
700 | } | 700 | } |
701 | else if (m_commsManager.InterServiceInventoryService != null) | 701 | else |
702 | { | 702 | { |
703 | // used by the user server | 703 | // used by the user server |
704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); | 704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d2193ca..2a97528 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Servers | |||
76 | protected string m_startupDirectory = Environment.CurrentDirectory; | 76 | protected string m_startupDirectory = Environment.CurrentDirectory; |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. | 79 | /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. |
80 | /// </summary> | 80 | /// </summary> |
81 | protected string m_version; | 81 | protected string m_version; |
82 | 82 | ||
@@ -422,6 +422,16 @@ namespace OpenSim.Framework.Servers | |||
422 | { | 422 | { |
423 | string buildVersion = string.Empty; | 423 | string buildVersion = string.Empty; |
424 | 424 | ||
425 | // Add commit hash and date information if available | ||
426 | // The commit hash and date are stored in a file bin/.version | ||
427 | // This file can automatically created by a post | ||
428 | // commit script in the opensim git master repository or | ||
429 | // by issuing the follwoing command from the top level | ||
430 | // directory of the opensim repository | ||
431 | // git log -n 1 --pretty="format:%h: %ci" >bin/.version | ||
432 | // For the full git commit hash use %H instead of %h | ||
433 | // | ||
434 | // The subversion information is deprecated and will be removed at a later date | ||
425 | // Add subversion revision information if available | 435 | // Add subversion revision information if available |
426 | // Try file "svn_revision" in the current directory first, then the .svn info. | 436 | // Try file "svn_revision" in the current directory first, then the .svn info. |
427 | // This allows to make the revision available in simulators not running from the source tree. | 437 | // This allows to make the revision available in simulators not running from the source tree. |
@@ -429,39 +439,53 @@ namespace OpenSim.Framework.Servers | |||
429 | // elsewhere as well | 439 | // elsewhere as well |
430 | string svnRevisionFileName = "svn_revision"; | 440 | string svnRevisionFileName = "svn_revision"; |
431 | string svnFileName = ".svn/entries"; | 441 | string svnFileName = ".svn/entries"; |
442 | string gitCommitFileName = ".version"; | ||
432 | string inputLine; | 443 | string inputLine; |
433 | int strcmp; | 444 | int strcmp; |
434 | 445 | ||
435 | if (File.Exists(svnRevisionFileName)) | 446 | if (File.Exists( gitCommitFileName)) |
436 | { | 447 | { |
437 | StreamReader RevisionFile = File.OpenText(svnRevisionFileName); | 448 | StreamReader CommitFile = File.OpenText(gitCommitFileName); |
438 | buildVersion = RevisionFile.ReadLine(); | 449 | buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); |
439 | buildVersion.Trim(); | 450 | CommitFile.Close(); |
440 | RevisionFile.Close(); | 451 | m_version += buildVersion ?? ""; |
441 | } | 452 | } |
442 | 453 | ||
443 | if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) | 454 | // Remove the else logic when subversion mirror is no longer used |
455 | else | ||
444 | { | 456 | { |
445 | StreamReader EntriesFile = File.OpenText(svnFileName); | 457 | if (File.Exists(svnRevisionFileName)) |
446 | inputLine = EntriesFile.ReadLine(); | ||
447 | while (inputLine != null) | ||
448 | { | 458 | { |
449 | // using the dir svn revision at the top of entries file | 459 | StreamReader RevisionFile = File.OpenText(svnRevisionFileName); |
450 | strcmp = String.Compare(inputLine, "dir"); | 460 | buildVersion = RevisionFile.ReadLine(); |
451 | if (strcmp == 0) | 461 | buildVersion.Trim(); |
452 | { | 462 | RevisionFile.Close(); |
453 | buildVersion = EntriesFile.ReadLine(); | 463 | |
454 | break; | 464 | } |
455 | } | 465 | |
456 | else | 466 | if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) |
467 | { | ||
468 | StreamReader EntriesFile = File.OpenText(svnFileName); | ||
469 | inputLine = EntriesFile.ReadLine(); | ||
470 | while (inputLine != null) | ||
457 | { | 471 | { |
458 | inputLine = EntriesFile.ReadLine(); | 472 | // using the dir svn revision at the top of entries file |
473 | strcmp = String.Compare(inputLine, "dir"); | ||
474 | if (strcmp == 0) | ||
475 | { | ||
476 | buildVersion = EntriesFile.ReadLine(); | ||
477 | break; | ||
478 | } | ||
479 | else | ||
480 | { | ||
481 | inputLine = EntriesFile.ReadLine(); | ||
482 | } | ||
459 | } | 483 | } |
484 | EntriesFile.Close(); | ||
460 | } | 485 | } |
461 | EntriesFile.Close(); | ||
462 | } | ||
463 | 486 | ||
464 | m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); | 487 | m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); |
488 | } | ||
465 | } | 489 | } |
466 | 490 | ||
467 | protected void CreatePIDFile(string path) | 491 | protected void CreatePIDFile(string path) |
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs index b226bba..f51a199 100644 --- a/OpenSim/Framework/UserProfileData.cs +++ b/OpenSim/Framework/UserProfileData.cs | |||
@@ -114,6 +114,11 @@ namespace OpenSim.Framework | |||
114 | /// </summary> | 114 | /// </summary> |
115 | private uint m_profileWantDoMask; // Profile window "I want to" mask | 115 | private uint m_profileWantDoMask; // Profile window "I want to" mask |
116 | 116 | ||
117 | /// <summary> | ||
118 | /// The profile url for an avatar | ||
119 | /// </summary> | ||
120 | private string m_profileUrl; | ||
121 | |||
117 | private UUID m_rootInventoryFolderId; | 122 | private UUID m_rootInventoryFolderId; |
118 | 123 | ||
119 | /// <summary> | 124 | /// <summary> |
@@ -349,6 +354,12 @@ namespace OpenSim.Framework | |||
349 | set { m_profileFirstText = value; } | 354 | set { m_profileFirstText = value; } |
350 | } | 355 | } |
351 | 356 | ||
357 | public string ProfileUrl | ||
358 | { | ||
359 | get { return m_profileUrl; } | ||
360 | set { m_profileUrl = value; } | ||
361 | } | ||
362 | |||
352 | public UUID Image | 363 | public UUID Image |
353 | { | 364 | { |
354 | get { return m_profileImage; } | 365 | get { return m_profileImage; } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3d58839..7633b7b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4954,6 +4954,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4954 | UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); | 4954 | UserProfile.FirstLifeAboutText = Utils.BytesToString(Properties.FLAboutText); |
4955 | UserProfile.FirstLifeImage = Properties.FLImageID; | 4955 | UserProfile.FirstLifeImage = Properties.FLImageID; |
4956 | UserProfile.Image = Properties.ImageID; | 4956 | UserProfile.Image = Properties.ImageID; |
4957 | UserProfile.ProfileUrl = Utils.BytesToString(Properties.ProfileURL); | ||
4957 | 4958 | ||
4958 | handlerUpdateAvatarProperties(this, UserProfile); | 4959 | handlerUpdateAvatarProperties(this, UserProfile); |
4959 | } | 4960 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 13b1f5a..38bd149 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -280,7 +280,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
280 | UUID newFolderId = UUID.Random(); | 280 | UUID newFolderId = UUID.Random(); |
281 | m_userInfo.CreateFolder( | 281 | m_userInfo.CreateFolder( |
282 | folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID); | 282 | folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID); |
283 | |||
284 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Retrieving newly created folder {0}", folderName); | ||
283 | foundFolder = foundFolder.GetChildFolder(newFolderId); | 285 | foundFolder = foundFolder.GetChildFolder(newFolderId); |
286 | m_log.DebugFormat( | ||
287 | "[INVENTORY ARCHIVER]: Retrieved newly created folder {0} with ID {1}", | ||
288 | foundFolder.Name, foundFolder.ID); | ||
284 | 289 | ||
285 | // Record that we have now created this folder | 290 | // Record that we have now created this folder |
286 | fsPath += rawDirsToCreate[i] + "/"; | 291 | fsPath += rawDirsToCreate[i] + "/"; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 12d3e95..c04ce08 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -54,6 +54,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
54 | [TestFixture] | 54 | [TestFixture] |
55 | public class InventoryArchiverTests | 55 | public class InventoryArchiverTests |
56 | { | 56 | { |
57 | private void InventoryReceived(UUID userId) | ||
58 | { | ||
59 | lock (this) | ||
60 | { | ||
61 | Monitor.PulseAll(this); | ||
62 | } | ||
63 | } | ||
64 | |||
57 | private void SaveCompleted( | 65 | private void SaveCompleted( |
58 | bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) | 66 | bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException) |
59 | { | 67 | { |
@@ -61,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
61 | { | 69 | { |
62 | Monitor.PulseAll(this); | 70 | Monitor.PulseAll(this); |
63 | } | 71 | } |
64 | } | 72 | } |
65 | 73 | ||
66 | /// <summary> | 74 | /// <summary> |
67 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). | 75 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). |
@@ -74,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
74 | 82 | ||
75 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 83 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
76 | 84 | ||
77 | Scene scene = SceneSetupHelpers.SetupScene(false); | 85 | Scene scene = SceneSetupHelpers.SetupScene(""); |
78 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 86 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
79 | CommunicationsManager cm = scene.CommsManager; | 87 | CommunicationsManager cm = scene.CommsManager; |
80 | 88 | ||
@@ -82,8 +90,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
82 | string userFirstName = "Jock"; | 90 | string userFirstName = "Jock"; |
83 | string userLastName = "Stirrup"; | 91 | string userLastName = "Stirrup"; |
84 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 92 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
93 | CachedUserInfo userInfo; | ||
94 | |||
95 | lock (this) | ||
96 | { | ||
97 | userInfo | ||
98 | = UserProfileTestUtils.CreateUserWithInventory( | ||
99 | cm, userFirstName, userLastName, userId, InventoryReceived); | ||
100 | Monitor.Wait(this, 60000); | ||
101 | } | ||
102 | |||
103 | /* | ||
85 | cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId); | 104 | cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId); |
86 | CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId); | 105 | CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId, InventoryReceived); |
87 | userInfo.FetchInventory(); | 106 | userInfo.FetchInventory(); |
88 | for (int i = 0 ; i < 50 ; i++) | 107 | for (int i = 0 ; i < 50 ; i++) |
89 | { | 108 | { |
@@ -92,6 +111,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
92 | Thread.Sleep(200); | 111 | Thread.Sleep(200); |
93 | } | 112 | } |
94 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | 113 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); |
114 | */ | ||
95 | 115 | ||
96 | // Create asset | 116 | // Create asset |
97 | SceneObjectGroup object1; | 117 | SceneObjectGroup object1; |
@@ -337,15 +357,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
337 | Assert.That(user2Profile.SurName == user2LastName); | 357 | Assert.That(user2Profile.SurName == user2LastName); |
338 | 358 | ||
339 | CachedUserInfo userInfo | 359 | CachedUserInfo userInfo |
340 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | 360 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); |
341 | userInfo.FetchInventory(); | 361 | userInfo.OnInventoryReceived += InventoryReceived; |
342 | for (int i = 0 ; i < 50 ; i++) | 362 | |
363 | lock (this) | ||
343 | { | 364 | { |
344 | if (userInfo.HasReceivedInventory == true) | 365 | userInfo.FetchInventory(); |
345 | break; | 366 | Monitor.Wait(this, 60000); |
346 | Thread.Sleep(200); | ||
347 | } | 367 | } |
348 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | 368 | |
349 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); | 369 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); |
350 | 370 | ||
351 | Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId)); | 371 | Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId)); |
@@ -359,14 +379,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
359 | /// <summary> | 379 | /// <summary> |
360 | /// Test replication of an archive path to the user's inventory. | 380 | /// Test replication of an archive path to the user's inventory. |
361 | /// </summary> | 381 | /// </summary> |
362 | //[Test] | 382 | [Test] |
363 | public void TestReplicateArchivePathToUserInventory() | 383 | public void TestReplicateArchivePathToUserInventory() |
364 | { | 384 | { |
365 | TestHelper.InMethod(); | 385 | TestHelper.InMethod(); |
366 | Scene scene = SceneSetupHelpers.SetupScene(false); | 386 | |
387 | log4net.Config.XmlConfigurator.Configure(); | ||
388 | |||
389 | Scene scene = SceneSetupHelpers.SetupScene(""); | ||
367 | CommunicationsManager commsManager = scene.CommsManager; | 390 | CommunicationsManager commsManager = scene.CommsManager; |
391 | CachedUserInfo userInfo; | ||
368 | 392 | ||
369 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); | 393 | lock (this) |
394 | { | ||
395 | userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); | ||
396 | Monitor.Wait(this, 60000); | ||
397 | } | ||
398 | |||
370 | //userInfo.FetchInventory(); | 399 | //userInfo.FetchInventory(); |
371 | /* | 400 | /* |
372 | for (int i = 0 ; i < 50 ; i++) | 401 | for (int i = 0 ; i < 50 ; i++) |
@@ -399,15 +428,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
399 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); | 428 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName); |
400 | 429 | ||
401 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); | 430 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); |
402 | 431 | ||
403 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) | 432 | try |
404 | .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); | 433 | { |
405 | 434 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) | |
406 | Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); | 435 | .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); |
407 | InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); | 436 | |
408 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); | 437 | Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); |
409 | InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); | 438 | InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); |
410 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); | 439 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); |
440 | InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); | ||
441 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); | ||
442 | } | ||
443 | catch (NullReferenceException e) | ||
444 | { | ||
445 | // Non fatal for now until we resolve the race condition | ||
446 | Console.WriteLine("Test failed with {0}", e); | ||
447 | } | ||
411 | } | 448 | } |
412 | } | 449 | } |
413 | } | 450 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index 0f5b76a..d3324e4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles | |||
111 | remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, | 111 | remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, |
112 | Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), | 112 | Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), |
113 | charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), | 113 | charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), |
114 | profile.FirstLifeImage, profile.Image, String.Empty, profile.Partner); | 114 | profile.FirstLifeImage, profile.Image, profile.ProfileUrl, profile.Partner); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
@@ -130,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles | |||
130 | Profile.FirstLifeImage = newProfile.FirstLifeImage; | 130 | Profile.FirstLifeImage = newProfile.FirstLifeImage; |
131 | Profile.AboutText = newProfile.AboutText; | 131 | Profile.AboutText = newProfile.AboutText; |
132 | Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; | 132 | Profile.FirstLifeAboutText = newProfile.FirstLifeAboutText; |
133 | Profile.ProfileUrl = newProfile.ProfileUrl; | ||
133 | } | 134 | } |
134 | else | 135 | else |
135 | { | 136 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index ed280c8..5c42e94 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
87 | SerialiserModule serialiserModule = new SerialiserModule(); | 87 | SerialiserModule serialiserModule = new SerialiserModule(); |
88 | TerrainModule terrainModule = new TerrainModule(); | 88 | TerrainModule terrainModule = new TerrainModule(); |
89 | 89 | ||
90 | Scene scene = SceneSetupHelpers.SetupScene(false); | 90 | Scene scene = SceneSetupHelpers.SetupScene("asset"); |
91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); | 91 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); |
92 | 92 | ||
93 | SceneObjectPart part1; | 93 | SceneObjectPart part1; |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index c894d8e..373b6ab 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
237 | public void Init() | 237 | public void Init() |
238 | { | 238 | { |
239 | m_serialiserModule = new SerialiserModule(); | 239 | m_serialiserModule = new SerialiserModule(); |
240 | m_scene = SceneSetupHelpers.SetupScene(false); | 240 | m_scene = SceneSetupHelpers.SetupScene(""); |
241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs index d35e3ed..5f1184b 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetService.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs | |||
@@ -31,13 +31,18 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Data; | 32 | using OpenSim.Data; |
33 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
34 | using Nini.Config; | ||
34 | 35 | ||
35 | namespace OpenSim.Tests.Common.Mock | 36 | namespace OpenSim.Tests.Common.Mock |
36 | { | 37 | { |
37 | public class TestAssetService : IAssetService | 38 | public class TestAssetService : IAssetService |
38 | { | 39 | { |
39 | private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); | 40 | private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); |
40 | 41 | ||
42 | public TestAssetService(IConfigSource config) | ||
43 | { | ||
44 | } | ||
45 | |||
41 | public AssetBase Get(string id) | 46 | public AssetBase Get(string id) |
42 | { | 47 | { |
43 | return Assets[ id ]; | 48 | return Assets[ id ]; |
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs new file mode 100644 index 0000000..cf1a3a9 --- /dev/null +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Framework; | ||
5 | using OpenMetaverse; | ||
6 | using OpenSim.Services.Interfaces; | ||
7 | using Nini.Config; | ||
8 | |||
9 | namespace OpenSim.Tests.Common.Mock | ||
10 | { | ||
11 | public class TestInventoryService : IInventoryService | ||
12 | { | ||
13 | public TestInventoryService() | ||
14 | { | ||
15 | } | ||
16 | |||
17 | public TestInventoryService(IConfigSource config) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | /// <summary> | ||
22 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
23 | /// </summary> | ||
24 | /// <param name="userId"></param> | ||
25 | /// <returns></returns> | ||
26 | public bool CreateUserInventory(UUID userId) | ||
27 | { | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | /// <summary> | ||
32 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
33 | /// </summary> | ||
34 | /// <param name="userId"></param> | ||
35 | /// <returns></returns> | ||
36 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
37 | { | ||
38 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
39 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
40 | folder.ID = UUID.Random(); | ||
41 | folder.Owner = userId; | ||
42 | folders.Add(folder); | ||
43 | return folders; | ||
44 | } | ||
45 | |||
46 | /// <summary> | ||
47 | /// Returns a list of all the active gestures in a user's inventory. | ||
48 | /// </summary> | ||
49 | /// <param name="userId"> | ||
50 | /// The <see cref="UUID"/> of the user | ||
51 | /// </param> | ||
52 | /// <returns> | ||
53 | /// A flat list of the gesture items. | ||
54 | /// </returns> | ||
55 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
56 | { | ||
57 | return null; | ||
58 | } | ||
59 | |||
60 | public InventoryCollection GetUserInventory(UUID userID) | ||
61 | { | ||
62 | return null; | ||
63 | } | ||
64 | |||
65 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
70 | { | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public bool AddFolder(InventoryFolderBase folder) | ||
75 | { | ||
76 | return false; | ||
77 | } | ||
78 | |||
79 | public bool UpdateFolder(InventoryFolderBase folder) | ||
80 | { | ||
81 | return false; | ||
82 | } | ||
83 | |||
84 | public bool MoveFolder(InventoryFolderBase folder) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | |||
89 | public bool PurgeFolder(InventoryFolderBase folder) | ||
90 | { | ||
91 | return false; | ||
92 | } | ||
93 | |||
94 | public bool AddItem(InventoryItemBase item) | ||
95 | { | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | public bool UpdateItem(InventoryItemBase item) | ||
100 | { | ||
101 | return false; | ||
102 | } | ||
103 | |||
104 | public bool DeleteItem(InventoryItemBase item) | ||
105 | { | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
110 | { | ||
111 | return null; | ||
112 | } | ||
113 | |||
114 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
115 | { | ||
116 | return null; | ||
117 | } | ||
118 | |||
119 | public bool HasInventoryForUser(UUID userID) | ||
120 | { | ||
121 | return false; | ||
122 | } | ||
123 | |||
124 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
125 | { | ||
126 | InventoryFolderBase root = new InventoryFolderBase(); | ||
127 | root.ID = UUID.Random(); | ||
128 | root.Owner = userID; | ||
129 | root.ParentID = UUID.Zero; | ||
130 | return root; | ||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index c11691f..b1b32cc 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -54,6 +54,12 @@ namespace OpenSim.Tests.Common.Setup | |||
54 | /// </summary> | 54 | /// </summary> |
55 | public class SceneSetupHelpers | 55 | public class SceneSetupHelpers |
56 | { | 56 | { |
57 | // These static variables in order to allow regions to be linked by shared modules and same | ||
58 | // CommunicationsManager. | ||
59 | private static ISharedRegionModule m_assetService = null; | ||
60 | private static ISharedRegionModule m_inventoryService = null; | ||
61 | private static TestCommunicationsManager commsManager = null; | ||
62 | |||
57 | /// <summary> | 63 | /// <summary> |
58 | /// Set up a test scene | 64 | /// Set up a test scene |
59 | /// </summary> | 65 | /// </summary> |
@@ -63,21 +69,33 @@ namespace OpenSim.Tests.Common.Setup | |||
63 | /// <returns></returns> | 69 | /// <returns></returns> |
64 | public static TestScene SetupScene() | 70 | public static TestScene SetupScene() |
65 | { | 71 | { |
66 | return SetupScene(true); | 72 | return SetupScene(""); |
67 | } | 73 | } |
68 | 74 | ||
69 | /// <summary> | 75 | /// <summary> |
70 | /// Set up a test scene | 76 | /// Set up a test scene |
71 | /// </summary> | 77 | /// </summary> |
72 | /// | 78 | /// |
73 | /// <param name="startServices">Start associated service threads for the scene</param> | 79 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> |
74 | /// <returns></returns> | 80 | /// <returns></returns> |
75 | public static TestScene SetupScene(bool startServices) | 81 | public static TestScene SetupScene(String realServices) |
76 | { | 82 | { |
77 | return SetupScene( | 83 | return SetupScene( |
78 | "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), startServices); | 84 | "Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager(), realServices); |
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Set up a test scene | ||
89 | /// </summary> | ||
90 | /// | ||
91 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> | ||
92 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | ||
93 | /// <returns></returns> | ||
94 | public static TestScene SetupScene(TestCommunicationsManager cm, String realServices) | ||
95 | { | ||
96 | return SetupScene( | ||
97 | "Unit test region", UUID.Random(), 1000, 1000, cm, ""); | ||
79 | } | 98 | } |
80 | |||
81 | /// <summary> | 99 | /// <summary> |
82 | /// Set up a test scene | 100 | /// Set up a test scene |
83 | /// </summary> | 101 | /// </summary> |
@@ -89,28 +107,40 @@ namespace OpenSim.Tests.Common.Setup | |||
89 | /// <returns></returns> | 107 | /// <returns></returns> |
90 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) | 108 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, TestCommunicationsManager cm) |
91 | { | 109 | { |
92 | return SetupScene(name, id, x, y, cm, true); | 110 | return SetupScene(name, id, x, y, cm, ""); |
93 | } | 111 | } |
94 | 112 | ||
95 | /// <summary> | 113 | /// <summary> |
96 | /// Set up a test scene | 114 | /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions |
115 | /// or a different, to get a brand new scene with new shared region modules. | ||
97 | /// </summary> | 116 | /// </summary> |
98 | /// <param name="name">Name of the region</param> | 117 | /// <param name="name">Name of the region</param> |
99 | /// <param name="id">ID of the region</param> | 118 | /// <param name="id">ID of the region</param> |
100 | /// <param name="x">X co-ordinate of the region</param> | 119 | /// <param name="x">X co-ordinate of the region</param> |
101 | /// <param name="y">Y co-ordinate of the region</param> | 120 | /// <param name="y">Y co-ordinate of the region</param> |
102 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | 121 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> |
103 | /// <param name="startServices">Start associated threads for the services used by the scene</param> | 122 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> |
104 | /// <returns></returns> | 123 | /// <returns></returns> |
105 | public static TestScene SetupScene( | 124 | public static TestScene SetupScene( |
106 | string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices) | 125 | string name, UUID id, uint x, uint y, TestCommunicationsManager cm, String realServices) |
107 | { | 126 | { |
127 | bool newScene= false; | ||
128 | |||
108 | Console.WriteLine("Setting up test scene {0}", name); | 129 | Console.WriteLine("Setting up test scene {0}", name); |
130 | |||
131 | // If cm is the same as our last commsManager used, this means the tester wants to link | ||
132 | // regions. In this case, don't use the sameshared region modules and dont initialize them again. | ||
133 | // Also, no need to start another MainServer and MainConsole instance. | ||
134 | if (cm == null || cm != commsManager) | ||
135 | { | ||
136 | System.Console.WriteLine("Starting a brand new scene"); | ||
137 | newScene = true; | ||
138 | MainConsole.Instance = new LocalConsole("TEST PROMPT"); | ||
139 | MainServer.Instance = new BaseHttpServer(980); | ||
140 | commsManager = cm; | ||
141 | } | ||
109 | 142 | ||
110 | // We must set up a console otherwise setup of some modules may fail | 143 | // We must set up a console otherwise setup of some modules may fail |
111 | MainConsole.Instance = new LocalConsole("TEST PROMPT"); | ||
112 | |||
113 | MainServer.Instance = new BaseHttpServer(980); | ||
114 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | 144 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); |
115 | regInfo.RegionName = name; | 145 | regInfo.RegionName = name; |
116 | regInfo.RegionID = id; | 146 | regInfo.RegionID = id; |
@@ -132,44 +162,83 @@ namespace OpenSim.Tests.Common.Setup | |||
132 | IRegionModule godsModule = new GodsModule(); | 162 | IRegionModule godsModule = new GodsModule(); |
133 | godsModule.Initialise(testScene, new IniConfigSource()); | 163 | godsModule.Initialise(testScene, new IniConfigSource()); |
134 | testScene.AddModule(godsModule.Name, godsModule); | 164 | testScene.AddModule(godsModule.Name, godsModule); |
165 | realServices = realServices.ToLower(); | ||
166 | IniConfigSource config = new IniConfigSource(); | ||
167 | |||
168 | // If we have a brand new scene, need to initialize shared region modules | ||
169 | if ((m_assetService == null && m_inventoryService == null) || newScene) | ||
170 | { | ||
171 | if (realServices.Contains("asset")) | ||
172 | StartAssetService(testScene, true); | ||
173 | else | ||
174 | StartAssetService(testScene, false); | ||
175 | if (realServices.Contains("inventory")) | ||
176 | StartInventoryService(testScene, true); | ||
177 | else | ||
178 | StartInventoryService(testScene, false); | ||
179 | } | ||
180 | // If not, make sure the shared module gets references to this new scene | ||
181 | else | ||
182 | { | ||
183 | m_assetService.AddRegion(testScene); | ||
184 | m_assetService.RegionLoaded(testScene); | ||
185 | m_inventoryService.AddRegion(testScene); | ||
186 | m_inventoryService.RegionLoaded(testScene); | ||
187 | } | ||
188 | m_inventoryService.PostInitialise(); | ||
189 | m_assetService.PostInitialise(); | ||
190 | |||
191 | testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService); | ||
192 | |||
193 | testScene.SetModuleInterfaces(); | ||
135 | 194 | ||
195 | testScene.LandChannel = new TestLandChannel(); | ||
196 | testScene.LoadWorldMap(); | ||
197 | |||
198 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | ||
199 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | ||
200 | testScene.PhysicsScene | ||
201 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
202 | |||
203 | return testScene; | ||
204 | } | ||
205 | |||
206 | private static void StartAssetService(Scene testScene, bool real) | ||
207 | { | ||
136 | ISharedRegionModule assetService = new LocalAssetServicesConnector(); | 208 | ISharedRegionModule assetService = new LocalAssetServicesConnector(); |
137 | IniConfigSource config = new IniConfigSource(); | 209 | IniConfigSource config = new IniConfigSource(); |
138 | config.AddConfig("Modules"); | 210 | config.AddConfig("Modules"); |
139 | config.AddConfig("AssetService"); | 211 | config.AddConfig("AssetService"); |
140 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); | 212 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); |
141 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | 213 | if (real) |
214 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | ||
215 | else | ||
216 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestAssetService"); | ||
142 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 217 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
143 | assetService.Initialise(config); | 218 | assetService.Initialise(config); |
144 | assetService.AddRegion(testScene); | 219 | assetService.AddRegion(testScene); |
145 | assetService.RegionLoaded(testScene); | 220 | assetService.RegionLoaded(testScene); |
146 | testScene.AddRegionModule(assetService.Name, assetService); | 221 | testScene.AddRegionModule(assetService.Name, assetService); |
147 | assetService.PostInitialise(); | 222 | m_assetService = assetService; |
223 | } | ||
148 | 224 | ||
225 | private static void StartInventoryService(Scene testScene, bool real) | ||
226 | { | ||
149 | ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); | 227 | ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); |
150 | config = new IniConfigSource(); | 228 | IniConfigSource config = new IniConfigSource(); |
151 | config.AddConfig("Modules"); | 229 | config.AddConfig("Modules"); |
152 | config.AddConfig("InventoryService"); | 230 | config.AddConfig("InventoryService"); |
153 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 231 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
154 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | 232 | if (real) |
233 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | ||
234 | else | ||
235 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestInventoryService"); | ||
155 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 236 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
156 | inventoryService.Initialise(config); | 237 | inventoryService.Initialise(config); |
157 | inventoryService.AddRegion(testScene); | 238 | inventoryService.AddRegion(testScene); |
158 | inventoryService.RegionLoaded(testScene); | 239 | inventoryService.RegionLoaded(testScene); |
159 | testScene.AddRegionModule(inventoryService.Name, inventoryService); | 240 | testScene.AddRegionModule(inventoryService.Name, inventoryService); |
160 | inventoryService.PostInitialise(); | 241 | m_inventoryService = inventoryService; |
161 | |||
162 | testScene.SetModuleInterfaces(); | ||
163 | |||
164 | testScene.LandChannel = new TestLandChannel(); | ||
165 | testScene.LoadWorldMap(); | ||
166 | |||
167 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | ||
168 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | ||
169 | testScene.PhysicsScene | ||
170 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
171 | |||
172 | return testScene; | ||
173 | } | 242 | } |
174 | 243 | ||
175 | /// <summary> | 244 | /// <summary> |
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index fc41166..f146a15 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | |||
@@ -41,28 +41,58 @@ namespace OpenSim.Tests.Common.Setup | |||
41 | /// Create a test user with a standard inventory | 41 | /// Create a test user with a standard inventory |
42 | /// </summary> | 42 | /// </summary> |
43 | /// <param name="commsManager"></param> | 43 | /// <param name="commsManager"></param> |
44 | /// <param name="callback"> | ||
45 | /// Callback to invoke when inventory has been loaded. This is required because | ||
46 | /// loading may be asynchronous, even on standalone | ||
47 | /// </param> | ||
44 | /// <returns></returns> | 48 | /// <returns></returns> |
45 | public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager) | 49 | public static CachedUserInfo CreateUserWithInventory( |
50 | CommunicationsManager commsManager, OnInventoryReceivedDelegate callback) | ||
46 | { | 51 | { |
47 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); | 52 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); |
48 | return CreateUserWithInventory(commsManager, userId); | 53 | return CreateUserWithInventory(commsManager, userId, callback); |
49 | } | 54 | } |
50 | 55 | ||
51 | /// <summary> | 56 | /// <summary> |
52 | /// Create a test user with a standard inventory | 57 | /// Create a test user with a standard inventory |
53 | /// </summary> | 58 | /// </summary> |
54 | /// <param name="commsManager"></param> | 59 | /// <param name="commsManager"></param> |
55 | /// <param name="userId">Explicit user id to use for user creation</param> | 60 | /// <param name="userId">User ID</param> |
61 | /// <param name="callback"> | ||
62 | /// Callback to invoke when inventory has been loaded. This is required because | ||
63 | /// loading may be asynchronous, even on standalone | ||
64 | /// </param> | ||
56 | /// <returns></returns> | 65 | /// <returns></returns> |
57 | public static CachedUserInfo CreateUserWithInventory(CommunicationsManager commsManager, UUID userId) | 66 | public static CachedUserInfo CreateUserWithInventory( |
67 | CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback) | ||
68 | { | ||
69 | return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback); | ||
70 | } | ||
71 | |||
72 | /// <summary> | ||
73 | /// Create a test user with a standard inventory | ||
74 | /// </summary> | ||
75 | /// <param name="commsManager"></param> | ||
76 | /// <param name="firstName">First name of user</param> | ||
77 | /// <param name="lastName">Last name of user</param> | ||
78 | /// <param name="userId">User ID</param> | ||
79 | /// <param name="callback"> | ||
80 | /// Callback to invoke when inventory has been loaded. This is required because | ||
81 | /// loading may be asynchronous, even on standalone | ||
82 | /// </param> | ||
83 | /// <returns></returns> | ||
84 | public static CachedUserInfo CreateUserWithInventory( | ||
85 | CommunicationsManager commsManager, string firstName, string lastName, | ||
86 | UUID userId, OnInventoryReceivedDelegate callback) | ||
58 | { | 87 | { |
59 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | 88 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; |
60 | lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); | 89 | lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId); |
61 | 90 | ||
62 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | 91 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); |
92 | userInfo.OnInventoryReceived += callback; | ||
63 | userInfo.FetchInventory(); | 93 | userInfo.FetchInventory(); |
64 | 94 | ||
65 | return userInfo; | 95 | return userInfo; |
66 | } | 96 | } |
67 | } | 97 | } |
68 | } | 98 | } |