aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-03-05 02:34:44 +0000
committerJustin Clark-Casey (justincc)2011-03-05 02:34:44 +0000
commit2e46027c14fb7a7084e3909cd8b57db5565cce7d (patch)
tree2254d6a0f13144734adff6bd70d35402c4776066 /OpenSim/Region/CoreModules/Avatar
parentFold ClearMediaEntry() back into SetMediaEntry() (diff)
downloadopensim-SC_OLD-2e46027c14fb7a7084e3909cd8b57db5565cce7d.zip
opensim-SC_OLD-2e46027c14fb7a7084e3909cd8b57db5565cce7d.tar.gz
opensim-SC_OLD-2e46027c14fb7a7084e3909cd8b57db5565cce7d.tar.bz2
opensim-SC_OLD-2e46027c14fb7a7084e3909cd8b57db5565cce7d.tar.xz
Construct test load iar only once and reuse for each test, rather than recreating it every time
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 76d0b85..8a84c7a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -53,9 +53,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
53 public class InventoryArchiverTests 53 public class InventoryArchiverTests
54 { 54 {
55 protected ManualResetEvent mre = new ManualResetEvent(false); 55 protected ManualResetEvent mre = new ManualResetEvent(false);
56 56
57 /// <summary>
58 /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
59 /// </summary>
60 protected byte[] m_iarStreamBytes;
61
57 /// <summary> 62 /// <summary>
58 /// Stream of data representing a common IAR that can be reused in load tests. 63 /// Stream of data representing a common IAR for load tests.
59 /// </summary> 64 /// </summary>
60 protected MemoryStream m_iarStream; 65 protected MemoryStream m_iarStream;
61 66
@@ -79,12 +84,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
79 } 84 }
80 85
81 [SetUp] 86 [SetUp]
82 public void Init() 87 public void SetUp()
83 { 88 {
84 ConstructDefaultIarForTestLoad(); 89 m_iarStream = new MemoryStream(m_iarStreamBytes);
85 } 90 }
86 91
87 protected void ConstructDefaultIarForTestLoad() 92 [TestFixtureSetUp]
93 public void FixtureSetup()
94 {
95 ConstructDefaultIarBytesForTestLoad();
96 }
97
98 protected void ConstructDefaultIarBytesForTestLoad()
88 { 99 {
89 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); 100 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
90 101
@@ -107,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
107 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 118 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
108 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService)); 119 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
109 tar.Close(); 120 tar.Close();
110 m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); 121 m_iarStreamBytes = archiveWriteStream.ToArray();
111 } 122 }
112 123
113 /// <summary> 124 /// <summary>
@@ -392,8 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
392 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); 403 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
393 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); 404 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
394 405
395 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); 406 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
396
397 InventoryItemBase foundItem1 407 InventoryItemBase foundItem1
398 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); 408 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
399 409