diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/OspResolver.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 24 |
2 files changed, 30 insertions, 9 deletions
diff --git a/OpenSim/Framework/Communications/OspResolver.cs b/OpenSim/Framework/Communications/OspResolver.cs index 708bb84..f246692 100644 --- a/OpenSim/Framework/Communications/OspResolver.cs +++ b/OpenSim/Framework/Communications/OspResolver.cs | |||
@@ -47,7 +47,18 @@ namespace OpenSim.Framework.Communications | |||
47 | public const string OSPA_NAME_VALUE_SEPARATOR = " "; | 47 | public const string OSPA_NAME_VALUE_SEPARATOR = " "; |
48 | public const string OSPA_TUPLE_SEPARATOR = "|"; | 48 | public const string OSPA_TUPLE_SEPARATOR = "|"; |
49 | public static readonly char[] OSPA_TUPLE_SEPARATOR_ARRAY = OSPA_TUPLE_SEPARATOR.ToCharArray(); | 49 | public static readonly char[] OSPA_TUPLE_SEPARATOR_ARRAY = OSPA_TUPLE_SEPARATOR.ToCharArray(); |
50 | public const string OSPA_KEY_VALUE_PAIR_SEPARATOR = "="; | 50 | public const string OSPA_PAIR_SEPARATOR = "="; |
51 | |||
52 | /// <summary> | ||
53 | /// Make an OSPA given an avatar name | ||
54 | /// </summary> | ||
55 | /// <param name="name"></param> | ||
56 | /// <returns></returns> | ||
57 | public static string MakeOspa(string firstName, string lastName) | ||
58 | { | ||
59 | return | ||
60 | OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; | ||
61 | } | ||
51 | 62 | ||
52 | /// <summary> | 63 | /// <summary> |
53 | /// Resolve an osp string into the most suitable internal OpenSim identifier. | 64 | /// Resolve an osp string into the most suitable internal OpenSim identifier. |
@@ -73,7 +84,7 @@ namespace OpenSim.Framework.Communications | |||
73 | 84 | ||
74 | foreach (string tuple in ospaTuples) | 85 | foreach (string tuple in ospaTuples) |
75 | { | 86 | { |
76 | int tupleSeparatorIndex = tuple.IndexOf(OSPA_TUPLE_SEPARATOR); | 87 | int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR); |
77 | 88 | ||
78 | if (tupleSeparatorIndex < 0) | 89 | if (tupleSeparatorIndex < 0) |
79 | { | 90 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 5ae1cbd..bdca84e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -198,16 +198,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
198 | [Test] | 198 | [Test] |
199 | public void TestLoadIarV0p1() | 199 | public void TestLoadIarV0p1() |
200 | { | 200 | { |
201 | Console.WriteLine("Started TestLoadIarV0p1()"); | 201 | Console.WriteLine("Started {0}", MethodBase.GetCurrentMethod()); |
202 | 202 | ||
203 | log4net.Config.XmlConfigurator.Configure(); | 203 | log4net.Config.XmlConfigurator.Configure(); |
204 | 204 | ||
205 | string userFirstName = "Mr"; | 205 | string userFirstName = "Mr"; |
206 | string userLastName = "Tiddles"; | 206 | string userLastName = "Tiddles"; |
207 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); | 207 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555"); |
208 | string user2FirstName = "Lord"; | ||
209 | string user2LastName = "Lucan"; | ||
210 | UUID user2Uuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | ||
211 | |||
208 | string itemName = "b.lsl"; | 212 | string itemName = "b.lsl"; |
209 | string archiveItemName | 213 | string archiveItemName |
210 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); | 214 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); |
211 | 215 | ||
212 | MemoryStream archiveWriteStream = new MemoryStream(); | 216 | MemoryStream archiveWriteStream = new MemoryStream(); |
213 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 217 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
@@ -216,9 +220,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
216 | item1.Name = itemName; | 220 | item1.Name = itemName; |
217 | item1.AssetID = UUID.Random(); | 221 | item1.AssetID = UUID.Random(); |
218 | item1.GroupID = UUID.Random(); | 222 | item1.GroupID = UUID.Random(); |
219 | item1.CreatorId = userUuid.ToString(); | 223 | item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName); |
224 | //item1.CreatorId = userUuid.ToString(); | ||
220 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | 225 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; |
221 | item1.Owner = UUID.Parse(item1.CreatorId); | 226 | item1.Owner = UUID.Zero; |
222 | 227 | ||
223 | string item1FileName | 228 | string item1FileName |
224 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | 229 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); |
@@ -231,9 +236,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
231 | 236 | ||
232 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 237 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
233 | Scene scene = SceneSetupHelpers.SetupScene(); | 238 | Scene scene = SceneSetupHelpers.SetupScene(); |
239 | IUserAdminService userAdminService = scene.CommsManager.UserAdminService; | ||
240 | |||
234 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 241 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
235 | scene.CommsManager.UserAdminService.AddUser( | 242 | userAdminService.AddUser( |
236 | userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); | 243 | userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); |
244 | userAdminService.AddUser( | ||
245 | user2FirstName, user2LastName, "hampshire", String.Empty, 1000, 1000, user2Uuid); | ||
246 | |||
237 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); | 247 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); |
238 | 248 | ||
239 | CachedUserInfo userInfo | 249 | CachedUserInfo userInfo |
@@ -241,10 +251,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
241 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); | 251 | InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); |
242 | 252 | ||
243 | // Currently, creator and ownership both revert to the loader | 253 | // Currently, creator and ownership both revert to the loader |
244 | Assert.That(foundItem.CreatorId, Is.EqualTo(userUuid.ToString())); | 254 | Assert.That(foundItem.CreatorId, Is.EqualTo(user2Uuid.ToString())); |
245 | Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); | 255 | Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); |
246 | 256 | ||
247 | Console.WriteLine("Finished TestLoadIarV0p1()"); | 257 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); |
248 | } | 258 | } |
249 | 259 | ||
250 | /// <summary> | 260 | /// <summary> |