aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs205
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs28
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs13
4 files changed, 138 insertions, 110 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d339543..c81f295 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -76,125 +76,118 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
76 // Commenting for now! The mock inventory service needs more beef, at least for 76 // Commenting for now! The mock inventory service needs more beef, at least for
77 // GetFolderForType 77 // GetFolderForType
78 // REFACTORING PROBLEM. This needs to be rewritten. 78 // REFACTORING PROBLEM. This needs to be rewritten.
79 //[Test]
80 public void TestSaveIarV0_1()
81 {
82 TestHelper.InMethod();
83 log4net.Config.XmlConfigurator.Configure();
79 84
80// [Test] 85 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
81// public void TestSaveIarV0_1()
82// {
83// TestHelper.InMethod();
84// //log4net.Config.XmlConfigurator.Configure();
85 86
86// InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 87 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
88 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
87 89
88// Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 90 // Create user
89// SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 91 string userFirstName = "Jock";
90// CommunicationsManager cm = scene.CommsManager; 92 string userLastName = "Stirrup";
91 93 string userPassword = "troll";
92// // Create user 94 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
93// string userFirstName = "Jock"; 95 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
94// string userLastName = "Stirrup";
95// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
96
97// lock (this)
98// {
99// UserProfileTestUtils.CreateUserWithInventory(
100// cm, userFirstName, userLastName, userId, InventoryReceived);
101// Monitor.Wait(this, 60000);
102// }
103 96
104// // Create asset 97 // Create asset
105// SceneObjectGroup object1; 98 SceneObjectGroup object1;
106// SceneObjectPart part1; 99 SceneObjectPart part1;
107// { 100 {
108// string partName = "My Little Dog Object"; 101 string partName = "My Little Dog Object";
109// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); 102 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
110// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 103 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
111// Vector3 groupPosition = new Vector3(10, 20, 30); 104 Vector3 groupPosition = new Vector3(10, 20, 30);
112// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 105 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
113// Vector3 offsetPosition = new Vector3(5, 10, 15); 106 Vector3 offsetPosition = new Vector3(5, 10, 15);
114 107
115// part1 108 part1
116// = new SceneObjectPart( 109 = new SceneObjectPart(
117// ownerId, shape, groupPosition, rotationOffset, offsetPosition); 110 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
118// part1.Name = partName; 111 part1.Name = partName;
119 112
120// object1 = new SceneObjectGroup(part1); 113 object1 = new SceneObjectGroup(part1);
121// scene.AddNewSceneObject(object1, false); 114 scene.AddNewSceneObject(object1, false);
122// } 115 }
123
124// UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
125// AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
126// scene.AssetService.Store(asset1);
127
128// // Create item
129// UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
130// InventoryItemBase item1 = new InventoryItemBase();
131// item1.Name = "My Little Dog";
132// item1.AssetID = asset1.FullID;
133// item1.ID = item1Id;
134// InventoryFolderBase objsFolder
135// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
136// item1.Folder = objsFolder.ID;
137// scene.AddInventoryItem(userId, item1);
138
139// MemoryStream archiveWriteStream = new MemoryStream();
140// archiverModule.OnInventoryArchiveSaved += SaveCompleted;
141
142// mre.Reset();
143// archiverModule.ArchiveInventory(
144// Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream);
145// mre.WaitOne(60000, false);
146
147// byte[] archive = archiveWriteStream.ToArray();
148// MemoryStream archiveReadStream = new MemoryStream(archive);
149// TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
150
151// //bool gotControlFile = false;
152// bool gotObject1File = false;
153// //bool gotObject2File = false;
154// string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
155// string expectedObject1FilePath = string.Format(
156// "{0}{1}{2}",
157// ArchiveConstants.INVENTORY_PATH,
158// InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
159// expectedObject1FileName);
160 116
161// string filePath; 117 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
162// TarArchiveReader.TarEntryType tarEntryType; 118 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
119 scene.AssetService.Store(asset1);
120
121 // Create item
122 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
123 InventoryItemBase item1 = new InventoryItemBase();
124 item1.Name = "My Little Dog";
125 item1.AssetID = asset1.FullID;
126 item1.ID = item1Id;
127 InventoryFolderBase objsFolder
128 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
129 item1.Folder = objsFolder.ID;
130 scene.AddInventoryItem(userId, item1);
131
132 MemoryStream archiveWriteStream = new MemoryStream();
133 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
134
135 mre.Reset();
136 archiverModule.ArchiveInventory(
137 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
138 mre.WaitOne(60000, false);
139
140 byte[] archive = archiveWriteStream.ToArray();
141 MemoryStream archiveReadStream = new MemoryStream(archive);
142 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
143
144 //bool gotControlFile = false;
145 bool gotObject1File = false;
146 //bool gotObject2File = false;
147 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
148 string expectedObject1FilePath = string.Format(
149 "{0}{1}{2}",
150 ArchiveConstants.INVENTORY_PATH,
151 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
152 expectedObject1FileName);
153
154 string filePath;
155 TarArchiveReader.TarEntryType tarEntryType;
163 156
164// Console.WriteLine("Reading archive"); 157// Console.WriteLine("Reading archive");
165 158
166// while (tar.ReadEntry(out filePath, out tarEntryType) != null) 159 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
167// { 160 {
168// Console.WriteLine("Got {0}", filePath); 161 Console.WriteLine("Got {0}", filePath);
169 162
170//// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 163// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
171//// {
172//// gotControlFile = true;
173//// }
174
175// if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
176// { 164// {
177//// string fileName = filePath.Remove(0, "Objects/".Length); 165// gotControlFile = true;
178////
179//// if (fileName.StartsWith(part1.Name))
180//// {
181// Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
182// gotObject1File = true;
183//// }
184//// else if (fileName.StartsWith(part2.Name))
185//// {
186//// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
187//// gotObject2File = true;
188//// }
189// } 166// }
190// } 167
168 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
169 {
170// string fileName = filePath.Remove(0, "Objects/".Length);
171//
172// if (fileName.StartsWith(part1.Name))
173// {
174 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
175 gotObject1File = true;
176// }
177// else if (fileName.StartsWith(part2.Name))
178// {
179// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
180// gotObject2File = true;
181// }
182 }
183 }
191 184
192//// Assert.That(gotControlFile, Is.True, "No control file in archive"); 185// Assert.That(gotControlFile, Is.True, "No control file in archive");
193// Assert.That(gotObject1File, Is.True, "No item1 file in archive"); 186 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
194//// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 187// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
195 188
196// // TODO: Test presence of more files and contents of files. 189 // TODO: Test presence of more files and contents of files.
197// } 190 }
198 191
199 /// <summary> 192 /// <summary>
200 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 193 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index c363a91..ee17fbf 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
376 /// <param name="mod"></param> 376 /// <param name="mod"></param>
377 public void RegisterModuleInterface<M>(M mod) 377 public void RegisterModuleInterface<M>(M mod)
378 { 378 {
379 m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
380
379 List<Object> l = null; 381 List<Object> l = null;
380 if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) 382 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
381 { 383 {
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 91cf323..2756324 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.CoreModules.Agent.Capabilities; 42using OpenSim.Region.CoreModules.Agent.Capabilities;
43using OpenSim.Region.CoreModules.Avatar.Gods; 43using OpenSim.Region.CoreModules.Avatar.Gods;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
47using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
@@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
58 // These static variables in order to allow regions to be linked by shared modules and same 59 // These static variables in order to allow regions to be linked by shared modules and same
59 // CommunicationsManager. 60 // CommunicationsManager.
60 private static ISharedRegionModule m_assetService = null; 61 private static ISharedRegionModule m_assetService = null;
62// private static ISharedRegionModule m_authenticationService = null;
61 private static ISharedRegionModule m_inventoryService = null; 63 private static ISharedRegionModule m_inventoryService = null;
62 private static ISharedRegionModule m_gridService = null; 64 private static ISharedRegionModule m_gridService = null;
63 private static ISharedRegionModule m_userAccountService = null; 65 private static ISharedRegionModule m_userAccountService = null;
@@ -177,6 +179,9 @@ namespace OpenSim.Tests.Common.Setup
177 StartAssetService(testScene, true); 179 StartAssetService(testScene, true);
178 else 180 else
179 StartAssetService(testScene, false); 181 StartAssetService(testScene, false);
182
183 // For now, always started a 'real' authenication service
184 StartAuthenticationService(testScene, true);
180 185
181 if (realServices.Contains("inventory")) 186 if (realServices.Contains("inventory"))
182 StartInventoryService(testScene, true); 187 StartInventoryService(testScene, true);
@@ -236,13 +241,34 @@ namespace OpenSim.Tests.Common.Setup
236 else 241 else
237 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); 242 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
238 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 243 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
239 assetService.Initialise(config); 244 assetService.Initialise(config);
240 assetService.AddRegion(testScene); 245 assetService.AddRegion(testScene);
241 assetService.RegionLoaded(testScene); 246 assetService.RegionLoaded(testScene);
242 testScene.AddRegionModule(assetService.Name, assetService); 247 testScene.AddRegionModule(assetService.Name, assetService);
243 m_assetService = assetService; 248 m_assetService = assetService;
244 } 249 }
245 250
251 private static void StartAuthenticationService(Scene testScene, bool real)
252 {
253 ISharedRegionModule service = new LocalAuthenticationServicesConnector();
254 IConfigSource config = new IniConfigSource();
255 config.AddConfig("Modules");
256 config.AddConfig("AuthenticationService");
257 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
258 if (real)
259 config.Configs["AuthenticationService"].Set(
260 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
261 else
262 config.Configs["AuthenticationService"].Set(
263 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService");
264 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
265 service.Initialise(config);
266 service.AddRegion(testScene);
267 service.RegionLoaded(testScene);
268 testScene.AddRegionModule(service.Name, service);
269 //m_authenticationService = service;
270 }
271
246 private static void StartInventoryService(Scene testScene, bool real) 272 private static void StartInventoryService(Scene testScene, bool real)
247 { 273 {
248 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 274 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index a6b9520..e6a7818 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -117,12 +117,19 @@ namespace OpenSim.Tests.Common.Setup
117 117
118 public static UserAccount CreateUserWithInventory(Scene scene) 118 public static UserAccount CreateUserWithInventory(Scene scene)
119 { 119 {
120 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); 120 return CreateUserWithInventory(
121 UserAccount ua = new UserAccount(userId) { FirstName = "Bill", LastName = "Bailey" }; 121 scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
122 }
123
124 public static UserAccount CreateUserWithInventory(
125 Scene scene, string firstName, string lastName, UUID userId, string pw)
126 {
127 UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
122 scene.UserAccountService.StoreUserAccount(ua); 128 scene.UserAccountService.StoreUserAccount(ua);
123 scene.InventoryService.CreateUserInventory(ua.PrincipalID); 129 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
130 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
124 131
125 return ua; 132 return ua;
126 } 133 }
127 } 134 }
128} \ No newline at end of file 135} \ No newline at end of file