From 76b21860e9f727391849c9b38c620b9bc16e4312 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 8 Sep 2009 16:12:15 +0100
Subject: refactor iar name generation slightly change the format of item
archive names
---
.../Archiver/InventoryArchiveWriteRequest.cs | 67 +++++++++++++++++++---
.../Archiver/Tests/InventoryArchiverTests.cs | 31 ++++------
2 files changed, 71 insertions(+), 27 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index dee4a5d..b178772 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
{
- string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID);
+ string filename = path + CreateArchiveItemName(inventoryItem);
// Record the creator of this item for user record purposes (which might go away soon)
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
@@ -162,12 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (saveThisFolderItself)
{
- path +=
- string.Format(
- "{0}{1}{2}/",
- inventoryFolder.Name,
- ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
- inventoryFolder.ID);
+ path += CreateArchiveFolderName(inventoryFolder);
// We need to make sure that we record empty folders
m_archiveWriter.WriteDir(path);
@@ -356,5 +351,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
}
+
+ ///
+ /// Create the archive name for a particular folder.
+ ///
+ ///
+ /// These names are prepended with an inventory folder's UUID so that more than one folder can have the
+ /// same name
+ ///
+ ///
+ ///
+ public static string CreateArchiveFolderName(InventoryFolderBase folder)
+ {
+ return CreateArchiveFolderName(folder.Name, folder.ID);
+ }
+
+ ///
+ /// Create the archive name for a particular item.
+ ///
+ ///
+ /// These names are prepended with an inventory item's UUID so that more than one item can have the
+ /// same name
+ ///
+ ///
+ ///
+ public static string CreateArchiveItemName(InventoryItemBase item)
+ {
+ return CreateArchiveItemName(item.Name, item.ID);
+ }
+
+ ///
+ /// Create an archive folder name given its constituent components
+ ///
+ ///
+ ///
+ ///
+ public static string CreateArchiveFolderName(string name, UUID id)
+ {
+ return string.Format(
+ "{0}{1}{2}/",
+ name,
+ ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
+ id);
+ }
+
+ ///
+ /// Create an archive item name given its constituent components
+ ///
+ ///
+ ///
+ ///
+ public static string CreateArchiveItemName(string name, UUID id)
+ {
+ return string.Format(
+ "{0}{1}{2}.xml",
+ name,
+ ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR,
+ id);
+ }
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d579a81..5461ea2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -153,19 +153,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
//bool gotControlFile = false;
bool gotObject1File = false;
//bool gotObject2File = false;
+ string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
string expectedObject1FilePath = string.Format(
- "{0}{1}/{2}_{3}.xml",
+ "{0}{1}{2}",
ArchiveConstants.INVENTORY_PATH,
- string.Format(
- "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objsFolder.ID),
- item1.Name,
- item1Id);
-
-// string expectedObject2FileName = string.Format(
-// "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
-// part2.Name,
-// Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
-// part2.UUID);
+ InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
+ expectedObject1FileName);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
@@ -187,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
//
// if (fileName.StartsWith(part1.Name))
// {
- Assert.That(filePath, Is.EqualTo(expectedObject1FilePath));
+ Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
gotObject1File = true;
// }
// else if (fileName.StartsWith(part2.Name))
@@ -385,16 +378,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string folder2Name = "b";
string itemName = "c.lsl";
- string folder1ArchiveName
- = string.Format(
- "{0}{1}{2}", folder1Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
- string folder2ArchiveName
- = string.Format(
- "{0}{1}{2}", folder2Name, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random());
+ string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
+ string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
+ string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
+
string itemArchivePath
= string.Format(
- "{0}{1}/{2}/{3}",
- ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemName);
+ "{0}{1}{2}{3}",
+ ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
//Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
--
cgit v1.1
From 46d64da8308089c63c324ec4aea1a90611f66cbd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 8 Sep 2009 16:14:52 +0100
Subject: minor: remove warning
---
OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 9da869c..f513d68 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -588,10 +588,9 @@ namespace OpenSim.Region.CoreModules.World.Land
RegionConnections connectiondata, ScenePresence rootPresence)
{
RegionData[] rdata = connectiondata.ConnectedRegions.ToArray();
- List clients = new List();
+ //List clients = new List();
Dictionary updates = new Dictionary();
-
// Root Region entry
RegionCourseLocationStruct rootupdatedata = new RegionCourseLocationStruct();
rootupdatedata.Locations = new List();
--
cgit v1.1
From 36a40e0295e7c9a60ad4a5047eca9d20df94397f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 8 Sep 2009 16:29:31 +0100
Subject: refactor: change method argument name
---
.../Archiver/InventoryArchiveReadRequest.cs | 46 +++++++++++-----------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index ff583e5..3250ddf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
///
- ///
+ /// The item archive path to replicate
/// Is the path we're dealing with a directory?
/// The root folder for the inventory load
///
@@ -218,49 +218,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
/// The last user inventory folder created or found for the archive path
public InventoryFolderBase ReplicateArchivePathToUserInventory(
- string fsPath,
+ string archivePath,
bool isDir,
InventoryFolderBase rootDestFolder,
Dictionary foldersCreated,
List nodesLoaded)
{
- fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
+ archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Remove the file portion if we aren't already dealing with a directory path
if (!isDir)
- fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1);
+ archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1);
- string originalFsPath = fsPath;
+ string originalArchivePath = archivePath;
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
+ m_log.DebugFormat(
+ "[INVENTORY ARCHIVER]: Loading to folder {0 {1}}", rootDestFolder.Name, rootDestFolder.ID);
InventoryFolderBase destFolder = null;
// XXX: Nasty way of dealing with a path that has no directory component
- if (fsPath.Length > 0)
+ if (archivePath.Length > 0)
{
- while (null == destFolder && fsPath.Length > 0)
+ while (null == destFolder && archivePath.Length > 0)
{
- if (foldersCreated.ContainsKey(fsPath))
+ if (foldersCreated.ContainsKey(archivePath))
{
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath);
- destFolder = foldersCreated[fsPath];
+ m_log.DebugFormat(
+ "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
+ destFolder = foldersCreated[archivePath];
}
else
{
// Don't include the last slash
- int penultimateSlashIndex = fsPath.LastIndexOf("/", fsPath.Length - 2);
+ int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
if (penultimateSlashIndex >= 0)
{
- fsPath = fsPath.Remove(penultimateSlashIndex + 1);
+ archivePath = archivePath.Remove(penultimateSlashIndex + 1);
}
else
{
m_log.DebugFormat(
- "[INVENTORY ARCHIVER]: Found no previously created fs path for {0}",
- originalFsPath);
- fsPath = string.Empty;
+ "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
+ originalArchivePath);
+ archivePath = string.Empty;
destFolder = rootDestFolder;
}
}
@@ -271,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
destFolder = rootDestFolder;
}
- string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length);
+ string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
string[] rawDirsToCreate
- = fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
+ = archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
int i = 0;
while (i < rawDirsToCreate.Length)
{
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]);
+ m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]);
int identicalNameIdentifierIndex
= rawDirsToCreate[i].LastIndexOf(
@@ -305,9 +307,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// foundFolder.Name, foundFolder.ID);
// Record that we have now created this folder
- fsPath += rawDirsToCreate[i] + "/";
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath);
- foldersCreated[fsPath] = destFolder;
+ archivePath += rawDirsToCreate[i] + "/";
+ m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath);
+ foldersCreated[archivePath] = destFolder;
if (0 == i)
nodesLoaded.Add(destFolder);
--
cgit v1.1
From b7256f256733f1c7667edc95ec500694bbe35dab Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 8 Sep 2009 17:42:07 +0100
Subject: extend load iar test to loading into a deeply nested directory
correct bug associated with this
---
OpenSim/Framework/InventoryFolderBase.cs | 8 ++
.../Archiver/InventoryArchiveReadRequest.cs | 2 +-
.../Inventory/Archiver/InventoryArchiveUtils.cs | 4 +-
.../Archiver/Tests/InventoryArchiverTests.cs | 31 +++++--
.../Tests/Common/Setup/UserInventoryTestUtils.cs | 97 ++++++++++++++++++++++
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 2 +-
6 files changed, 133 insertions(+), 11 deletions(-)
create mode 100644 OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index 0edb2c6..3eef6f6 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -84,6 +84,14 @@ namespace OpenSim.Framework
Owner = owner;
}
+ public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
+ {
+ ID = id;
+ Name = name;
+ Owner = owner;
+ ParentID = parent;
+ }
+
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
{
ID = id;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 3250ddf..50c0f93 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -233,7 +233,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
string originalArchivePath = archivePath;
m_log.DebugFormat(
- "[INVENTORY ARCHIVER]: Loading to folder {0 {1}}", rootDestFolder.Name, rootDestFolder.ID);
+ "[INVENTORY ARCHIVER]: Loading to folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
InventoryFolderBase destFolder = null;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 2eeb637..5ebf2fa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -106,8 +106,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (path == PATH_DELIMITER)
return startFolder;
- InventoryFolderBase foundFolder = null;
-
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
@@ -116,7 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (folder.Name == components[0])
{
if (components.Length > 1)
- return FindFolderByPath(inventoryService, foundFolder, components[1]);
+ return FindFolderByPath(inventoryService, folder, components[1]);
else
return folder;
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 5461ea2..384a1f2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
- // TODO: Test presence of more files and contents of files.
+ // TODO: Test presence of more files and contents of files.
}
///
@@ -257,24 +257,43 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
CachedUserInfo userInfo
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
- InventoryItemBase foundItem
+ InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
- Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item");
+ Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
Assert.That(
- foundItem.CreatorId, Is.EqualTo(item1.CreatorId),
+ foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
"Loaded item non-uuid creator doesn't match original");
Assert.That(
- foundItem.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
+ foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid),
"Loaded item uuid creator doesn't match original");
- Assert.That(foundItem.Owner, Is.EqualTo(userUuid),
+ Assert.That(foundItem1.Owner, Is.EqualTo(userUuid),
"Loaded item owner doesn't match inventory reciever");
+
+ // Now try loading to a root child folder
+ UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xA");
+ archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
+ archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", archiveReadStream);
+
+ InventoryItemBase foundItem2
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xA/" + itemName);
+ Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
+
+ // Now try loading to a more deeply nested folder
+ UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC");
+ archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
+ archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", archiveReadStream);
+
+ InventoryItemBase foundItem3
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, "xB/xC/" + itemName);
+ Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
}
///
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// no account exists with the creator name
///
+ /// Disabled since temporary profiles have not yet been implemented.
//[Test]
public void TestLoadIarV0_1TempProfiles()
{
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
new file mode 100644
index 0000000..3528072
--- /dev/null
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Services.Interfaces;
+
+namespace OpenSim.Tests.Common
+{
+ ///
+ /// Utility functions for carrying out user inventory related tests.
+ ///
+ public static class UserInventoryTestUtils
+ {
+ public static readonly string PATH_DELIMITER = "/";
+
+ ///
+ /// Create inventory folders starting from the user's root folder.
+ ///
+ ///
+ /// Ignores any existing folders with the same name
+ ///
+ ///
+ ///
+ ///
+ /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
+ ///
+ ///
+ /// The folder created. If the path contains multiple folders then the last one created is returned.
+ /// Will return null if the root folder could not be found.
+ ///
+ public static InventoryFolderBase CreateInventoryFolder(
+ IInventoryService inventoryService, UUID userId, string path)
+ {
+ InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
+
+ if (null == rootFolder)
+ return null;
+
+ return CreateInventoryFolder(inventoryService, rootFolder, path);
+ }
+
+ ///
+ /// Create inventory folders starting from a given parent folder
+ ///
+ ///
+ /// Ignores any existing folders with the same name
+ ///
+ ///
+ ///
+ ///
+ /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
+ ///
+ ///
+ /// The folder created. If the path contains multiple folders then the last one created is returned.
+ ///
+ public static InventoryFolderBase CreateInventoryFolder(
+ IInventoryService inventoryService, InventoryFolderBase parentFolder, string path)
+ {
+ string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
+
+ InventoryFolderBase newFolder
+ = new InventoryFolderBase(UUID.Random(), components[0], parentFolder.Owner, parentFolder.ID);
+ inventoryService.AddFolder(newFolder);
+
+ if (components.Length > 1)
+ return CreateInventoryFolder(inventoryService, newFolder, components[1]);
+ else
+ return newFolder;
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index f146a15..4ad9926 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Tests.Common.Setup
///
/// Utility functions for carrying out user profile related tests.
///
- public class UserProfileTestUtils
+ public static class UserProfileTestUtils
{
///
/// Create a test user with a standard inventory
--
cgit v1.1
From 5c606d023306fa92bc2a770860c73f76592f7d46 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 8 Sep 2009 21:31:09 +0100
Subject: Thank you, mcortez, for a patch to fix errors in FlotsamCache and
expand functionality, adding console commands.
---
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 158 +++++++++++++++++----
1 file changed, 130 insertions(+), 28 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 53b8ebc..c520356 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -129,18 +129,18 @@ namespace Flotsam.RegionModules.AssetCache
if (name == Name)
{
m_Enabled = true;
- m_log.InfoFormat("[ASSET CACHE]: {0} enabled", this.Name);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} enabled", this.Name);
IConfig assetConfig = source.Configs["AssetCache"];
if (assetConfig == null)
{
- m_log.Warn("[ASSET CACHE]: AssetCache missing from OpenSim.ini, using defaults.");
- m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
+ m_log.Warn("[FLOTSAM ASSET CACHE]: AssetCache missing from OpenSim.ini, using defaults.");
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
return;
}
m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
- m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", true);
m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
@@ -188,6 +188,8 @@ namespace Flotsam.RegionModules.AssetCache
}
m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", 30000);
+
+
}
}
}
@@ -203,7 +205,14 @@ namespace Flotsam.RegionModules.AssetCache
public void AddRegion(Scene scene)
{
if (m_Enabled)
+ {
scene.RegisterModuleInterface(this);
+
+ //scene.AddCommand(this, "flotsamcache", "", "Display a list of console commands for the Flotsam Asset Cache", HandleConsoleCommand);
+ scene.AddCommand(this, "flotsamcache counts", "flotsamcache counts", "Display the number of cached assets", HandleConsoleCommand);
+ scene.AddCommand(this, "flotsamcache clearmem", "flotsamcache clearmem", "Remove all assets cached in memory", HandleConsoleCommand);
+ scene.AddCommand(this, "flotsamcache clearfile", "flotsamcache clearfile", "Remove all assets cached on disk", HandleConsoleCommand);
+ }
}
public void RemoveRegion(Scene scene)
@@ -365,16 +374,16 @@ namespace Flotsam.RegionModules.AssetCache
{
m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0;
- m_log.InfoFormat("[ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit");
- m_log.InfoFormat("[ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Get :: {0} :: {1}", id, asset == null ? "Miss" : "Hit");
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File Hit Rate {0}% for {1} requests", m_HitRateFile.ToString("0.00"), m_Requests);
if (m_MemoryCacheEnabled)
{
m_HitRateMemory = (double)m_MemoryHits / m_Requests * 100.0;
- m_log.InfoFormat("[ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory Hit Rate {0}% for {1} requests", m_HitRateMemory.ToString("0.00"), m_Requests);
}
- m_log.InfoFormat("[ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} unnessesary requests due to requests for assets that are currently downloading.", m_RequestsForInprogress);
}
@@ -384,7 +393,7 @@ namespace Flotsam.RegionModules.AssetCache
public void Expire(string id)
{
if (m_LogLevel >= 2)
- m_log.DebugFormat("[ASSET CACHE]: Expiring Asset {0}.", id);
+ m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Expiring Asset {0}.", id);
try
{
@@ -406,7 +415,7 @@ namespace Flotsam.RegionModules.AssetCache
public void Clear()
{
if (m_LogLevel >= 2)
- m_log.Debug("[ASSET CACHE]: Clearing Cache.");
+ m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing Cache.");
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
{
@@ -420,29 +429,42 @@ namespace Flotsam.RegionModules.AssetCache
private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
{
if (m_LogLevel >= 2)
- m_log.DebugFormat("[ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString());
+ m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString());
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
{
- foreach (string file in Directory.GetFiles(dir))
- {
- if (DateTime.Now - File.GetLastAccessTime(file) > m_FileExpiration)
- {
- File.Delete(file);
- }
- }
+ CleanExpiredFiles(dir);
+ }
+ }
- int dirSize = Directory.GetFiles(dir).Length;
- if (dirSize == 0)
- {
- Directory.Delete(dir);
- }
- else if (dirSize >= m_CacheWarnAt)
+ ///
+ /// Recurses through specified directory checking for expired asset files and deletes them. Also removes empty directories.
+ ///
+ ///
+ private void CleanExpiredFiles(string dir)
+ {
+ foreach (string file in Directory.GetFiles(dir))
+ {
+ if (DateTime.Now - File.GetLastAccessTime(file) > m_FileExpiration)
{
- m_log.WarnFormat("[ASSET CACHE]: Cache folder exceeded CacheWarnAt limit {0} {1}. Suggest increasing tiers, tier length, or reducing cache expiration", dir, dirSize);
+ File.Delete(file);
}
-
}
+
+ foreach (string subdir in Directory.GetDirectories(dir))
+ {
+ CleanExpiredFiles(subdir);
+ }
+
+ int dirSize = Directory.GetFiles(dir).Length + Directory.GetDirectories(dir).Length;
+ if (dirSize == 0)
+ {
+ Directory.Delete(dir);
+ }
+ else if (dirSize >= m_CacheWarnAt)
+ {
+ m_log.WarnFormat("[FLOTSAM ASSET CACHE]: Cache folder exceeded CacheWarnAt limit {0} {1}. Suggest increasing tiers, tier length, or reducing cache expiration", dir, dirSize);
+ }
}
private string GetFileName(string id)
@@ -486,7 +508,7 @@ namespace Flotsam.RegionModules.AssetCache
File.Move(tempname, filename);
if (m_LogLevel >= 2)
- m_log.DebugFormat("[ASSET CACHE]: Cache Stored :: {0}", asset.ID);
+ m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID);
}
catch (Exception e)
{
@@ -522,8 +544,88 @@ namespace Flotsam.RegionModules.AssetCache
string[] text = e.ToString().Split(new char[] { '\n' });
foreach (string t in text)
{
- m_log.ErrorFormat("[ASSET CACHE]: {0} ", t);
+ m_log.ErrorFormat("[FLOTSAM ASSET CACHE]: {0} ", t);
+ }
+ }
+
+ private int GetFileCacheCount(string dir)
+ {
+ int count = Directory.GetFiles(dir).Length;
+
+ foreach (string subdir in Directory.GetDirectories(dir))
+ {
+ count += GetFileCacheCount(subdir);
}
+
+ return count;
}
+
+ #region Console Commands
+ private void HandleConsoleCommand(string module, string[] cmdparams)
+ {
+ if (cmdparams.Length == 2)
+ {
+ string cmd = cmdparams[1];
+ switch (cmd)
+ {
+ case "count":
+ case "counts":
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] Memory Cache : {0}", m_MemoryCache.Count);
+
+ int fileCount = GetFileCacheCount(m_CacheDirectory);
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] File Cache : {0}", fileCount);
+
+ break;
+
+ case "clearmem":
+ m_MemoryCache.Clear();
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] Memory Cache Cleared, there are now {0} items in the memory cache", m_MemoryCache.Count);
+ break;
+
+ case "clearfile":
+ foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
+ {
+ try
+ {
+ Directory.Delete(dir, true);
+ }
+ catch (Exception e)
+ {
+ LogException(e);
+ }
+ }
+
+ foreach (string file in Directory.GetFiles(m_CacheDirectory))
+ {
+ try
+ {
+ File.Delete(file);
+ }
+ catch (Exception e)
+ {
+ LogException(e);
+ }
+ }
+
+ break;
+
+ default:
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] Unknown command {0}", cmd);
+ break;
+ }
+ }
+ else if (cmdparams.Length == 1)
+ {
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache counts - Display the number of cached assets");
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearmem - Remove all assets cached in memory");
+ m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk");
+
+ }
+
+
+ }
+
+ #endregion
+
}
}
--
cgit v1.1
From d8a787bd89eb05d417a5abc37ffebe8ed73db6c5 Mon Sep 17 00:00:00 2001
From: dr scofield (aka dirk husemann)
Date: Tue, 8 Sep 2009 17:53:28 +0200
Subject: fix: unicode notecards not surviving script treatment (fixes #4119
--- perhaps).
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 8 ++++----
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f261c16..017a6f6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9477,8 +9477,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- System.Text.ASCIIEncoding enc =
- new System.Text.ASCIIEncoding();
+ System.Text.UTF8Encoding enc =
+ new System.Text.UTF8Encoding();
string data = enc.GetString(a.Data);
//m_log.Debug(data);
NotecardCache.Cache(id, data);
@@ -9539,8 +9539,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- System.Text.ASCIIEncoding enc =
- new System.Text.ASCIIEncoding();
+ System.Text.UTF8Encoding enc =
+ new System.Text.UTF8Encoding();
string data = enc.GetString(a.Data);
//m_log.Debug(data);
NotecardCache.Cache(id, data);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index bca019b..726b37a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
+ textLength.ToString() + "\n" + notecardData + "}\n";
- asset.Data = Encoding.ASCII.GetBytes(notecardData);
+ asset.Data = Encoding.UTF8.GetBytes(notecardData);
World.AssetService.Store(asset);
// Create Task Entry
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetBase a = World.AssetService.Get(assetID.ToString());
if (a != null)
{
- System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+ System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string data = enc.GetString(a.Data);
NotecardCache.Cache(assetID, data);
}
@@ -1575,7 +1575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetBase a = World.AssetService.Get(assetID.ToString());
if (a != null)
{
- System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+ System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string data = enc.GetString(a.Data);
NotecardCache.Cache(assetID, data);
}
@@ -1632,7 +1632,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetBase a = World.AssetService.Get(assetID.ToString());
if (a != null)
{
- System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+ System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
string data = enc.GetString(a.Data);
NotecardCache.Cache(assetID, data);
}
--
cgit v1.1
From 7796033f0dec17fa89388478b145495788b27611 Mon Sep 17 00:00:00 2001
From: dr scofield (aka dirk husemann)
Date: Wed, 9 Sep 2009 08:20:36 +0200
Subject: additional log files to ignore, also ignoring TestResult.xml
---
.gitignore | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 9d2d692..b6b5582 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,13 +38,21 @@ bin/config-include/CenomeCache.ini
bin/config-include/FlotsamCache.ini
bin/config-include/GridCommon.ini
bin/config-include/StandaloneCommon.ini
+bin/OpenSim.Grid.AssetInventoryServer.log
+bin/OpenSim.Grid.AssetServer.log
+bin/OpenSim.Grid.GridServer.log
+bin/OpenSim.Grid.InventoryServer.log
+bin/OpenSim.Grid.MessagingServer.log
+bin/OpenSim.Grid.UserServer.log
+bin/OpenSim.log
+bin/crashes/
Examples/*.dll
OpenSim.build
OpenSim.sln
OpenSim.suo
Prebuild/Prebuild.build
Prebuild/Prebuild.sln
-bin/OpenSim.log
+TestResult.xml
cov/*
OpenSim/OpenSim.userprefs
OpenSim/OpenSim.usertasks
@@ -53,3 +61,4 @@ TAGS
Makefile.local
bin/.version
compile.bat
+
--
cgit v1.1
From 62358014ed59136cfd1d452f08171a0bc32612cf Mon Sep 17 00:00:00 2001
From: dr scofield (aka dirk husemann)
Date: Wed, 9 Sep 2009 08:28:13 +0200
Subject: reformatting.
---
.../Shared/Api/Implementation/LSL_Api.cs | 35 +++++++++++-----------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 017a6f6..02befda 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9524,29 +9524,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (NotecardCache.IsCached(assetID))
{
- AsyncCommands.
- DataserverPlugin.DataserverReply(assetID.ToString(),
- NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
+ AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(),
+ NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
ConditionalScriptSleep(100);
return tid.ToString();
}
WithNotecard(assetID, delegate (UUID id, AssetBase a)
- {
- if (a == null || a.Type != 7)
- {
- ShoutError("Notecard '" + name + "' could not be found.");
- return;
- }
-
- System.Text.UTF8Encoding enc =
- new System.Text.UTF8Encoding();
- string data = enc.GetString(a.Data);
- //m_log.Debug(data);
- NotecardCache.Cache(id, data);
- AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(),
- NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
- });
+ {
+ if (a == null || a.Type != 7)
+ {
+ ShoutError("Notecard '" + name + "' could not be found.");
+ return;
+ }
+
+ System.Text.UTF8Encoding enc =
+ new System.Text.UTF8Encoding();
+ string data = enc.GetString(a.Data);
+ //m_log.Debug(data);
+ NotecardCache.Cache(id, data);
+ AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(),
+ NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
+ });
ConditionalScriptSleep(100);
return tid.ToString();
--
cgit v1.1
From 0683cf6e0d541571d04d6511dc0ecabb17dd1e1e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 9 Sep 2009 18:03:49 +0100
Subject: Add test to check behaviour if an iar is loaded where no user profile
exists for the creators Disable generation of temporary profiles for now,
instead record loading user as creator
---
.../Framework/Communications/Osp/OspResolver.cs | 7 +-
.../Archiver/InventoryArchiveReadRequest.cs | 2 +
.../Archiver/Tests/InventoryArchiverTests.cs | 79 +++++++++++++++++++++-
OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 22 ++----
4 files changed, 90 insertions(+), 20 deletions(-)
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs
index 502fee3..e98317a 100644
--- a/OpenSim/Framework/Communications/Osp/OspResolver.cs
+++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs
@@ -153,7 +153,9 @@ namespace OpenSim.Framework.Communications.Osp
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (userInfo != null)
return userInfo.UserProfile.ID;
-
+
+ // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
+ /*
UserProfileData tempUserProfile = new UserProfileData();
tempUserProfile.FirstName = firstName;
tempUserProfile.SurName = lastName;
@@ -164,6 +166,9 @@ namespace OpenSim.Framework.Communications.Osp
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID;
+ */
+
+ return UUID.Zero;
}
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 50c0f93..2a1c82e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -177,6 +177,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
if (UUID.Zero != ospResolvedId)
item.CreatorIdAsUuid = ospResolvedId;
+ else
+ item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
item.Owner = m_userInfo.UserProfile.ID;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 384a1f2..9c5f8f3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestSaveIarV0_1()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
@@ -202,12 +202,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// an account exists with the creator name.
///
+ ///
+ /// This test also does some deeper probing of loading into nested inventory structures
[Test]
public void TestLoadIarV0_1ExistingUsers()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
@@ -291,6 +293,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
///
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
+ /// embedded creators do not exist in the system
+ ///
+ ///
+ /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
+ /// (as tested in the a later commented out test)
+ [Test]
+ public void TestLoadIarV0_1AbsentUsers()
+ {
+ TestHelper.InMethod();
+
+ log4net.Config.XmlConfigurator.Configure();
+
+ string userFirstName = "Charlie";
+ string userLastName = "Chan";
+ UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
+ string userItemCreatorFirstName = "Bat";
+ string userItemCreatorLastName = "Man";
+ //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
+
+ string itemName = "b.lsl";
+ string archiveItemName
+ = string.Format("{0}{1}{2}", itemName, "_", UUID.Random());
+
+ MemoryStream archiveWriteStream = new MemoryStream();
+ TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
+
+ InventoryItemBase item1 = new InventoryItemBase();
+ item1.Name = itemName;
+ item1.AssetID = UUID.Random();
+ item1.GroupID = UUID.Random();
+ item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
+ //item1.CreatorId = userUuid.ToString();
+ //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
+ item1.Owner = UUID.Zero;
+
+ string item1FileName
+ = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
+ tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
+ tar.Close();
+
+ MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
+ SerialiserModule serialiserModule = new SerialiserModule();
+ InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
+
+ // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
+ Scene scene = SceneSetupHelpers.SetupScene("inventory");
+ IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
+
+ SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
+ userAdminService.AddUser(
+ userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
+
+ archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream);
+
+ CachedUserInfo userInfo
+ = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
+
+ InventoryItemBase foundItem1
+ = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName);
+
+ Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
+// Assert.That(
+// foundItem1.CreatorId, Is.EqualTo(userUuid),
+// "Loaded item non-uuid creator doesn't match that of the loading user");
+ Assert.That(
+ foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
+ "Loaded item uuid creator doesn't match that of the loading user");
+ }
+
+ ///
+ /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// no account exists with the creator name
///
/// Disabled since temporary profiles have not yet been implemented.
@@ -376,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
CommunicationsManager commsManager = scene.CommsManager;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index fea288e..94223d8 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3488,7 +3488,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (geom == localGround)
{
- localHeightfield = TerrainHeightFieldHeights[geom];
+ //localHeightfield = TerrainHeightFieldHeights[geom];
proceed = true;
}
else
@@ -3510,7 +3510,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// memory corruption
if (TerrainHeightFieldHeights.ContainsKey(g))
{
- float[] removingHeightField = TerrainHeightFieldHeights[g];
+ //float[] removingHeightField = TerrainHeightFieldHeights[g];
TerrainHeightFieldHeights.Remove(g);
if (RegionTerrain.ContainsKey(g))
@@ -3519,27 +3519,17 @@ namespace OpenSim.Region.Physics.OdePlugin
}
d.GeomDestroy(g);
- removingHeightField = new float[0];
-
-
-
- }
-
+ //removingHeightField = new float[0];
+ }
}
-
}
else
{
m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
-
}
-
- }
-
+ }
}
- }
-
-
+ }
public override void SetWaterLevel(float baseheight)
{
--
cgit v1.1
From bb1f64fe51331204e8ab891345feea81b805107b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 9 Sep 2009 18:09:23 +0100
Subject: minor: suppress mono warning 0162 generated when comparing const
RegionSize against a literal number
---
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d43a7e2..ecf0d80 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1297,6 +1297,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString() + " Regenerating");
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
+ #pragma warning disable 0162
if ((int)Constants.RegionSize != 256)
{
Heightmap = new TerrainChannel();
--
cgit v1.1
From 5bf288745d63f057fc5a715e0f67dc3eba0e6dba Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Wed, 9 Sep 2009 11:02:31 -0700
Subject: De-hardcode default home locations on create user (standalone).
---
OpenSim/Region/Application/OpenSim.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 38874f9..e6ddb5b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -1042,6 +1042,14 @@ namespace OpenSim
uint regX = 1000;
uint regY = 1000;
+ IConfig standalone;
+ if ((standalone = m_config.Source.Configs["StandAlone"]) != null)
+ {
+ regX = (uint)standalone.GetInt("default_location_x", (int)regX);
+ regY = (uint)standalone.GetInt("default_location_y", (int)regY);
+ }
+
+
if (cmdparams.Length < 3)
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
else firstName = cmdparams[2];
--
cgit v1.1