Merge branch 'master' into careminster-presence-refactor
commit
891214c65b
|
@ -100,11 +100,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
|
||||||
List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
|
List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
|
||||||
|
|
||||||
InventoryFolderBase rootDestinationFolder
|
List<InventoryFolderBase> folderCandidates
|
||||||
= InventoryArchiveUtils.FindFolderByPath(
|
= InventoryArchiveUtils.FindFolderByPath(
|
||||||
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
|
||||||
|
|
||||||
if (null == rootDestinationFolder)
|
if (folderCandidates.Count == 0)
|
||||||
{
|
{
|
||||||
// Possibly provide an option later on to automatically create this folder if it does not exist
|
// Possibly provide an option later on to automatically create this folder if it does not exist
|
||||||
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
|
||||||
|
@ -112,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
return loadedNodes;
|
return loadedNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InventoryFolderBase rootDestinationFolder = folderCandidates[0];
|
||||||
archive = new TarArchiveReader(m_loadStream);
|
archive = new TarArchiveReader(m_loadStream);
|
||||||
|
|
||||||
// In order to load identically named folders, we need to keep track of the folders that we have already
|
// In order to load identically named folders, we need to keep track of the folders that we have already
|
||||||
|
@ -188,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
/// Replicate the inventory paths in the archive to the user's inventory as necessary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="archivePath">The item archive path to replicate</param>
|
/// <param name="iarPath">The item archive path to replicate</param>
|
||||||
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
/// <param name="rootDestinationFolder">The root folder for the inventory load</param>
|
||||||
/// <param name="resolvedFolders">
|
/// <param name="resolvedFolders">
|
||||||
/// The folders that we have resolved so far for a given archive path.
|
/// The folders that we have resolved so far for a given archive path.
|
||||||
|
@ -199,24 +200,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
/// <returns>The last user inventory folder created or found for the archive path</returns>
|
||||||
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
public InventoryFolderBase ReplicateArchivePathToUserInventory(
|
||||||
string archivePath,
|
string iarPath,
|
||||||
InventoryFolderBase rootDestFolder,
|
InventoryFolderBase rootDestFolder,
|
||||||
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||||
List<InventoryNodeBase> loadedNodes)
|
List<InventoryNodeBase> loadedNodes)
|
||||||
{
|
{
|
||||||
string originalArchivePath = archivePath;
|
string iarPathExisting = iarPath;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
|
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
|
||||||
|
|
||||||
InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref archivePath, resolvedFolders);
|
InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
|
"[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
|
||||||
// originalArchivePath, archivePath);
|
iarPath, iarPathExisting);
|
||||||
|
|
||||||
string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length);
|
string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
|
||||||
CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes);
|
CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
|
||||||
|
|
||||||
return destFolder;
|
return destFolder;
|
||||||
}
|
}
|
||||||
|
@ -254,10 +255,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
{
|
{
|
||||||
while (null == destFolder && archivePath.Length > 0)
|
while (null == destFolder && archivePath.Length > 0)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
|
||||||
|
|
||||||
if (resolvedFolders.ContainsKey(archivePath))
|
if (resolvedFolders.ContainsKey(archivePath))
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
"[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
|
||||||
destFolder = resolvedFolders[archivePath];
|
destFolder = resolvedFolders[archivePath];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -294,8 +297,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <param name="destFolder">
|
/// <param name="destFolder">
|
||||||
/// The root folder from which the creation will take place.
|
/// The root folder from which the creation will take place.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="path">
|
/// <param name="iarPathExisting">
|
||||||
/// The path to create
|
/// the part of the iar path that already exists
|
||||||
|
/// </param>
|
||||||
|
/// <param name="iarPathToReplicate">
|
||||||
|
/// The path to replicate in the user's inventory from iar
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="resolvedFolders">
|
/// <param name="resolvedFolders">
|
||||||
/// The folders that we have resolved so far for a given archive path.
|
/// The folders that we have resolved so far for a given archive path.
|
||||||
|
@ -304,11 +310,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// Track the inventory nodes created.
|
/// Track the inventory nodes created.
|
||||||
/// </param>
|
/// </param>
|
||||||
protected void CreateFoldersForPath(
|
protected void CreateFoldersForPath(
|
||||||
InventoryFolderBase destFolder, string path, Dictionary <string, InventoryFolderBase> resolvedFolders,
|
InventoryFolderBase destFolder,
|
||||||
|
string iarPathExisting,
|
||||||
|
string iarPathToReplicate,
|
||||||
|
Dictionary <string, InventoryFolderBase> resolvedFolders,
|
||||||
List<InventoryNodeBase> loadedNodes)
|
List<InventoryNodeBase> loadedNodes)
|
||||||
{
|
{
|
||||||
string pathCreated = "";
|
string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
string[] rawDirsToCreate = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (i < rawDirsToCreate.Length)
|
while (i < rawDirsToCreate.Length)
|
||||||
|
@ -340,9 +348,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_scene.InventoryService.AddFolder(destFolder);
|
m_scene.InventoryService.AddFolder(destFolder);
|
||||||
|
|
||||||
// Record that we have now created this folder
|
// Record that we have now created this folder
|
||||||
pathCreated += rawDirsToCreate[i] + "/";
|
iarPathExisting += rawDirsToCreate[i] + "/";
|
||||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", pathCreated);
|
m_log.DebugFormat("[INVENTORY ARCHIVER]: Created folder {0} from IAR", iarPathExisting);
|
||||||
resolvedFolders[pathCreated] = destFolder;
|
resolvedFolders[iarPathExisting] = destFolder;
|
||||||
|
|
||||||
if (0 == i)
|
if (0 == i)
|
||||||
loadedNodes.Add(destFolder);
|
loadedNodes.Add(destFolder);
|
||||||
|
|
|
@ -55,8 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
///
|
///
|
||||||
/// This method does not handle paths that contain multiple delimitors
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
///
|
///
|
||||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
/// FIXME: We have no way of distinguishing folders with the same path
|
||||||
/// XPath like expression
|
|
||||||
///
|
///
|
||||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
///
|
///
|
||||||
|
@ -70,14 +69,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// The path to the required folder.
|
/// The path to the required folder.
|
||||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>null if the folder is not found</returns>
|
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||||
public static InventoryFolderBase FindFolderByPath(
|
public static List<InventoryFolderBase> FindFolderByPath(
|
||||||
IInventoryService inventoryService, UUID userId, string path)
|
IInventoryService inventoryService, UUID userId, string path)
|
||||||
{
|
{
|
||||||
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
|
||||||
|
|
||||||
if (null == rootFolder)
|
if (null == rootFolder)
|
||||||
return null;
|
return new List<InventoryFolderBase>();
|
||||||
|
|
||||||
return FindFolderByPath(inventoryService, rootFolder, path);
|
return FindFolderByPath(inventoryService, rootFolder, path);
|
||||||
}
|
}
|
||||||
|
@ -88,8 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
///
|
///
|
||||||
/// This method does not handle paths that contain multiple delimitors
|
/// This method does not handle paths that contain multiple delimitors
|
||||||
///
|
///
|
||||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
/// FIXME: We have no way of distinguishing folders with the same path.
|
||||||
/// XPath like expression
|
|
||||||
///
|
///
|
||||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||||
///
|
///
|
||||||
|
@ -103,17 +101,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// The path to the required folder.
|
/// The path to the required folder.
|
||||||
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>null if the folder is not found</returns>
|
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
|
||||||
public static InventoryFolderBase FindFolderByPath(
|
public static List<InventoryFolderBase> FindFolderByPath(
|
||||||
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
|
||||||
{
|
{
|
||||||
|
List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>();
|
||||||
|
|
||||||
if (path == string.Empty)
|
if (path == string.Empty)
|
||||||
return startFolder;
|
{
|
||||||
|
foundFolders.Add(startFolder);
|
||||||
|
return foundFolders;
|
||||||
|
}
|
||||||
|
|
||||||
path = path.Trim();
|
path = path.Trim();
|
||||||
|
|
||||||
if (path == PATH_DELIMITER.ToString())
|
if (path == PATH_DELIMITER.ToString())
|
||||||
return startFolder;
|
{
|
||||||
|
foundFolders.Add(startFolder);
|
||||||
|
return foundFolders;
|
||||||
|
}
|
||||||
|
|
||||||
string[] components = SplitEscapedPath(path);
|
string[] components = SplitEscapedPath(path);
|
||||||
components[0] = UnescapePath(components[0]);
|
components[0] = UnescapePath(components[0]);
|
||||||
|
@ -127,14 +133,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
if (folder.Name == components[0])
|
if (folder.Name == components[0])
|
||||||
{
|
{
|
||||||
if (components.Length > 1)
|
if (components.Length > 1)
|
||||||
return FindFolderByPath(inventoryService, folder, components[1]);
|
foundFolders.AddRange(FindFolderByPath(inventoryService, folder, components[1]));
|
||||||
else
|
else
|
||||||
return folder;
|
foundFolders.Add(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We didn't find a folder with the right name
|
return foundFolders;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -249,9 +249,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
|
||||||
inventoryFolder
|
List<InventoryFolderBase> candidateFolders
|
||||||
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
|
||||||
//inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
|
if (candidateFolders.Count > 0)
|
||||||
|
inventoryFolder = candidateFolders[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// The path may point to an item instead
|
// The path may point to an item instead
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
item1.AssetID = asset1.FullID;
|
item1.AssetID = asset1.FullID;
|
||||||
item1.ID = item1Id;
|
item1.ID = item1Id;
|
||||||
InventoryFolderBase objsFolder
|
InventoryFolderBase objsFolder
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||||
item1.Folder = objsFolder.ID;
|
item1.Folder = objsFolder.ID;
|
||||||
scene.AddInventoryItem(userId, item1);
|
scene.AddInventoryItem(userId, item1);
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
item1.AssetID = asset1.FullID;
|
item1.AssetID = asset1.FullID;
|
||||||
item1.ID = item1Id;
|
item1.ID = item1Id;
|
||||||
InventoryFolderBase objsFolder
|
InventoryFolderBase objsFolder
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects");
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
|
||||||
item1.Folder = objsFolder.ID;
|
item1.Folder = objsFolder.ID;
|
||||||
scene.AddInventoryItem(userId, item1);
|
scene.AddInventoryItem(userId, item1);
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
public void TestNewIarPath()
|
public void TestNewIarPath()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
Scene scene = SceneSetupHelpers.SetupScene("inventory");
|
||||||
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
|
||||||
|
@ -516,33 +516,60 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
|
||||||
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
|
||||||
|
|
||||||
string folder1Name = "a";
|
string folder1Name = "1";
|
||||||
string folder2Name = "b";
|
string folder2aName = "2a";
|
||||||
string itemName = "c.lsl";
|
string folder2bName = "2b";
|
||||||
|
|
||||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
|
||||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
|
||||||
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
|
||||||
|
|
||||||
string itemArchivePath
|
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
|
||||||
= string.Format(
|
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
|
||||||
"{0}{1}{2}{3}",
|
|
||||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
|
||||||
|
|
||||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
{
|
||||||
.ReplicateArchivePathToUserInventory(
|
// Test replication of path1
|
||||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||||
foldersCreated, nodesLoaded);
|
.ReplicateArchivePathToUserInventory(
|
||||||
|
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||||
|
foldersCreated, nodesLoaded);
|
||||||
|
|
||||||
InventoryFolderBase folder1
|
List<InventoryFolderBase> folder1Candidates
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||||
Assert.That(folder1, Is.Not.Null, "Could not find folder a");
|
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||||
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
|
|
||||||
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
|
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||||
|
List<InventoryFolderBase> folder2aCandidates
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||||
|
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Test replication of path2
|
||||||
|
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||||
|
.ReplicateArchivePathToUserInventory(
|
||||||
|
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||||
|
foldersCreated, nodesLoaded);
|
||||||
|
|
||||||
|
List<InventoryFolderBase> folder1Candidates
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
|
||||||
|
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
InventoryFolderBase folder1 = folder1Candidates[0];
|
||||||
|
|
||||||
|
List<InventoryFolderBase> folder2aCandidates
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
|
||||||
|
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
|
||||||
|
|
||||||
|
List<InventoryFolderBase> folder2bCandidates
|
||||||
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
|
||||||
|
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test replication of a partly existing archive path to the user's inventory.
|
/// Test replication of a partly existing archive path to the user's inventory. This should create
|
||||||
|
/// a duplicate path without the merge option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPartExistingIarPath()
|
public void TestPartExistingIarPath()
|
||||||
|
@ -555,7 +582,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
string folder1ExistingName = "a";
|
string folder1ExistingName = "a";
|
||||||
string folder2Name = "b";
|
string folder2Name = "b";
|
||||||
string itemName = "c.lsl";
|
|
||||||
|
|
||||||
InventoryFolderBase folder1
|
InventoryFolderBase folder1
|
||||||
= UserInventoryTestUtils.CreateInventoryFolder(
|
= UserInventoryTestUtils.CreateInventoryFolder(
|
||||||
|
@ -563,28 +589,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
|
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
|
||||||
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
|
||||||
string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
|
|
||||||
|
|
||||||
string itemArchivePath
|
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
|
||||||
= string.Format(
|
|
||||||
"{0}{1}{2}{3}",
|
|
||||||
ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
|
|
||||||
|
|
||||||
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
|
||||||
.ReplicateArchivePathToUserInventory(
|
.ReplicateArchivePathToUserInventory(
|
||||||
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
|
||||||
new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
|
new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>());
|
||||||
|
|
||||||
InventoryFolderBase folder1Post
|
List<InventoryFolderBase> folder1PostCandidates
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
|
||||||
Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
|
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
|
||||||
/*
|
|
||||||
InventoryFolderBase folder2
|
// FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
|
||||||
|
InventoryFolderBase folder1Post = null;
|
||||||
|
foreach (InventoryFolderBase folder in folder1PostCandidates)
|
||||||
|
{
|
||||||
|
if (folder.ID != folder1.ID)
|
||||||
|
{
|
||||||
|
folder1Post = folder;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
|
||||||
|
|
||||||
|
List<InventoryFolderBase> folder2PostCandidates
|
||||||
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
|
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
|
||||||
Assert.That(folder2, Is.Not.Null);
|
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
|
||||||
InventoryItemBase item = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, folder2, itemName);
|
|
||||||
Assert.That(item, Is.Not.Null);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1778,7 +1778,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.");
|
m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName);
|
||||||
m_log.Debug(e.ToString());
|
m_log.Debug(e.ToString());
|
||||||
mesh = null;
|
mesh = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID);
|
// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID);
|
||||||
|
|
||||||
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public InventoryFolderBase getUserRootFolder(UUID user)
|
public InventoryFolderBase getUserRootFolder(UUID user)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
|
// m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
|
||||||
|
|
||||||
InventoryFolderBase folder = null;
|
InventoryFolderBase folder = null;
|
||||||
m_rootFolders.TryGetValue(user, out folder);
|
m_rootFolders.TryGetValue(user, out folder);
|
||||||
|
@ -141,8 +141,8 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
if (folder.ParentID == UUID.Zero)
|
if (folder.ParentID == UUID.Zero)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[MOCK INV DB]: Adding root folder {0} {1} for {2}", folder.Name, folder.ID, folder.Owner);
|
// "[MOCK INV DB]: Adding root folder {0} {1} for {2}", folder.Name, folder.ID, folder.Owner);
|
||||||
m_rootFolders[folder.Owner] = folder;
|
m_rootFolders[folder.Owner] = folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,8 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
|
|
||||||
public void addInventoryItem(InventoryItemBase item)
|
public void addInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
"[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder);
|
// "[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder);
|
||||||
|
|
||||||
m_items[item.ID] = item;
|
m_items[item.ID] = item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue