From b16abc8166c29585cb76cc55c3bdd76e5833cb4f Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 5 Jan 2017 19:07:37 +0000
Subject: Massive tab and trailing space cleanup
---
.../Archiver/InventoryArchiveReadRequest.cs | 160 +++++++++---------
.../Inventory/Archiver/InventoryArchiveUtils.cs | 38 ++---
.../Inventory/Archiver/InventoryArchiverModule.cs | 2 +-
.../Tests/InventoryArchiveLoadPathTests.cs | 114 ++++++-------
.../Archiver/Tests/InventoryArchiveLoadTests.cs | 84 +++++-----
.../Archiver/Tests/InventoryArchiveSaveTests.cs | 60 +++----
.../Archiver/Tests/InventoryArchiveTestCase.cs | 74 ++++-----
.../Inventory/Transfer/InventoryTransferModule.cs | 44 ++---
.../Transfer/Tests/InventoryTransferModuleTests.cs | 178 ++++++++++-----------
9 files changed, 377 insertions(+), 377 deletions(-)
(limited to 'OpenSim/Region/CoreModules/Avatar/Inventory')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 4a06fd1..3838316 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// bumps here should be compatible.
///
public static int MAX_MAJOR_VERSION = 1;
-
+
protected TarArchiveReader archive;
private UserAccount m_userInfo;
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// ID of this request
///
protected UUID m_id;
-
+
///
/// Do we want to merge this load with existing inventory?
///
@@ -82,41 +82,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The stream from which the inventory archive will be loaded.
///
private Stream m_loadStream;
-
+
///
/// Has the control file been loaded for this archive?
///
public bool ControlFileLoaded { get; private set; }
-
+
///
/// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't
/// enforce.
///
public bool EnforceControlFileCheck { get; private set; }
-
+
protected bool m_assetsLoaded;
protected bool m_inventoryNodesLoaded;
-
+
protected int m_successfulAssetRestores;
protected int m_failedAssetRestores;
- protected int m_successfulItemRestores;
-
+ protected int m_successfulItemRestores;
+
///
/// Root destination folder for the IAR load.
///
protected InventoryFolderBase m_rootDestinationFolder;
-
+
///
/// Inventory nodes loaded from the iar.
///
- protected HashSet m_loadedNodes = new HashSet();
-
+ protected HashSet m_loadedNodes = new HashSet();
+
///
/// In order to load identically named folders, we need to keep track of the folders that we have already
/// resolved.
///
- Dictionary m_resolvedFolders = new Dictionary();
-
+ Dictionary m_resolvedFolders = new Dictionary();
+
///
/// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids
/// after OSP resolution (since OSP creators are only stored in the item
@@ -163,9 +163,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_invPath = invPath;
m_loadStream = loadStream;
m_module = module;
-
+
// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
- // (I thought they weren't). We will need to bump the version number and perform this check on all
+ // (I thought they weren't). We will need to bump the version number and perform this check on all
// subsequent IAR versions only
ControlFileLoaded = true;
}
@@ -188,19 +188,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
Exception reportedException = null;
string filePath = "ERROR";
-
+
List folderCandidates
= InventoryArchiveUtils.FindFoldersByPath(
m_InventoryService, m_userInfo.PrincipalID, m_invPath);
-
+
if (folderCandidates.Count == 0)
{
// 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);
-
+
return m_loadedNodes;
}
-
+
m_rootDestinationFolder = folderCandidates[0];
archive = new TarArchiveReader(m_loadStream);
byte[] data;
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{
LoadControlFile(filePath, data);
- }
+ }
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
LoadAssetFile(filePath, data);
@@ -221,17 +221,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
LoadInventoryFile(filePath, entryType, data);
}
}
-
+
archive.Close();
m_log.DebugFormat(
- "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
+ "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
m_successfulAssetRestores, m_failedAssetRestores);
//Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required
if(m_module != null)
m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores);
-
+
return m_loadedNodes;
}
catch(Exception Ex)
@@ -268,8 +268,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
/// The last user inventory folder created or found for the archive path
public InventoryFolderBase ReplicateArchivePathToUserInventory(
- string iarPath,
- InventoryFolderBase rootDestFolder,
+ string iarPath,
+ InventoryFolderBase rootDestFolder,
Dictionary resolvedFolders,
HashSet loadedNodes)
{
@@ -277,27 +277,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// m_log.DebugFormat(
// "[INVENTORY ARCHIVER]: Loading folder {0} {1}", rootDestFolder.Name, rootDestFolder.ID);
-
- InventoryFolderBase destFolder
+
+ InventoryFolderBase destFolder
= ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
-
+
// m_log.DebugFormat(
-// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
+// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
// iarPath, iarPathExisting);
-
+
string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
-
+
return destFolder;
}
///
/// Resolve a destination folder
///
- ///
+ ///
/// We require here a root destination folder (usually the root of the user's inventory) and the archive
/// path. We also pass in a list of previously resolved folders in case we've found this one previously.
- ///
+ ///
///
/// The item archive path to resolve. The portion of the path passed back is that
/// which corresponds to the resolved desintation folder.
@@ -321,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
while (archivePath.Length > 0)
{
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
-
+
if (resolvedFolders.ContainsKey(archivePath))
{
// m_log.DebugFormat(
@@ -332,13 +332,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
if (m_merge)
{
- // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the
+ // TODO: Using m_invPath is totally wrong - what we need to do is strip the uuid from the
// iar name and try to find that instead.
string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath);
List folderCandidates
= InventoryArchiveUtils.FindFoldersByPath(
m_InventoryService, m_userInfo.PrincipalID, plainPath);
-
+
if (folderCandidates.Count != 0)
{
InventoryFolderBase destFolder = folderCandidates[0];
@@ -346,7 +346,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return destFolder;
}
}
-
+
// Don't include the last slash so find the penultimate one
int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2);
@@ -365,10 +365,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
}
-
+
return rootDestFolder;
}
-
+
///
/// Create a set of folders for the given path.
///
@@ -388,10 +388,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Track the inventory nodes created.
///
protected void CreateFoldersForPath(
- InventoryFolderBase destFolder,
+ InventoryFolderBase destFolder,
string iarPathExisting,
- string iarPathToReplicate,
- Dictionary resolvedFolders,
+ string iarPathToReplicate,
+ Dictionary resolvedFolders,
HashSet loadedNodes)
{
string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
@@ -402,7 +402,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (!rawDirsToCreate[i].Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
continue;
-
+
int identicalNameIdentifierIndex
= rawDirsToCreate[i].LastIndexOf(
ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
UUID newFolderId = UUID.Random();
- destFolder
+ destFolder
= new InventoryFolderBase(
newFolderId, newFolderName, m_userInfo.PrincipalID,
(short)FolderType.None, destFolder.ID, 1);
@@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
loadedNodes.Add(destFolder);
}
}
-
+
///
/// Load an item from the archive
///
@@ -438,7 +438,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
{
InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
-
+
// Don't use the item ID that's in the file
item.ID = UUID.Random();
@@ -446,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (UUID.Zero != ospResolvedId) // The user exists in this grid
{
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
-
+
// item.CreatorIdAsUuid = ospResolvedId;
// Don't preserve the OSPA in the creator id (which actually gets persisted to the
@@ -474,7 +474,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (!m_InventoryService.AddItem(item))
m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder);
-
+
return item;
}
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
data = SceneObjectSerializer.ModifySerializedObject(assetId, data,
sog => {
bool modified = false;
-
+
foreach (SceneObjectPart sop in sog.Parts)
{
if (string.IsNullOrEmpty(sop.CreatorData))
@@ -528,10 +528,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
modified = true;
}
}
-
+
return modified;
});
-
+
if (data == null)
return false;
}
@@ -568,7 +568,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
string version = string.Format("{0}.{1}", majorVersion, minorVersion);
-
+
if (majorVersion > MAX_MAJOR_VERSION)
{
throw new Exception(
@@ -576,38 +576,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below",
majorVersion, MAX_MAJOR_VERSION));
}
-
- ControlFileLoaded = true;
- m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
+
+ ControlFileLoaded = true;
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
}
-
+
///
/// Load inventory file
///
///
///
- ///
+ ///
protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
{
if (!ControlFileLoaded)
throw new Exception(
string.Format(
- "The IAR you are trying to load does not list {0} before {1}. Aborting load",
+ "The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH));
-
+
if (m_assetsLoaded)
throw new Exception(
string.Format(
- "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
- ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
-
+ "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
+ ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
+
path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length);
-
+
// Trim off the file portion if we aren't already dealing with a directory path
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
path = path.Remove(path.LastIndexOf("/") + 1);
-
- InventoryFolderBase foundFolder
+
+ InventoryFolderBase foundFolder
= ReplicateArchivePathToUserInventory(
path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes);
@@ -618,17 +618,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (item != null)
{
m_successfulItemRestores++;
-
- // If we aren't loading the folder containing the item then well need to update the
+
+ // If we aren't loading the folder containing the item then well need to update the
// viewer separately for that item.
if (!m_loadedNodes.Contains(foundFolder))
m_loadedNodes.Add(item);
}
}
-
- m_inventoryNodesLoaded = true;
+
+ m_inventoryNodesLoaded = true;
}
-
+
///
/// Load asset file
///
@@ -639,15 +639,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (!ControlFileLoaded)
throw new Exception(
string.Format(
- "The IAR you are trying to load does not list {0} before {1}. Aborting load",
+ "The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH));
-
+
if (!m_inventoryNodesLoaded)
throw new Exception(
string.Format(
- "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
- ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
-
+ "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
+ ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
+
if (LoadAsset(path, data))
m_successfulAssetRestores++;
else
@@ -655,10 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if ((m_successfulAssetRestores) % 50 == 0)
m_log.DebugFormat(
- "[INVENTORY ARCHIVER]: Loaded {0} assets...",
- m_successfulAssetRestores);
-
- m_assetsLoaded = true;
- }
+ "[INVENTORY ARCHIVER]: Loaded {0} assets...",
+ m_successfulAssetRestores);
+
+ m_assetsLoaded = true;
+ }
}
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index dbaf2aa..b66aad5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The path to the required folder.
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
///
- /// The folder found. Please note that if there are multiple folders with the same name then an
+ /// The folder found. Please note that if there are multiple folders with the same name then an
/// unspecified one will be returned. If no such folder eixsts then null is returned
public static InventoryFolderBase FindFolderByPath(
IInventoryService inventoryService, UUID userId, string path)
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The path to the required folder.
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
///
- /// The folder found. Please note that if there are multiple folders with the same name then an
+ /// The folder found. Please note that if there are multiple folders with the same name then an
/// unspecified one will be returned. If no such folder eixsts then null is returned
public static InventoryFolderBase FindFolderByPath(
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return FindFoldersByPath(inventoryService, rootFolder, path);
}
-
+
///
/// Find a set of folders given a PATH_DELIMITER delimited path starting from this folder
///
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
{
List foundFolders = new List();
-
+
if (path == string.Empty)
{
foundFolders.Add(startFolder);
@@ -189,17 +189,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
foundFolders.Add(startFolder);
return foundFolders;
}
-
+
// If the path isn't just / then trim any starting extraneous slashes
path = path.TrimStart(new char[] { PATH_DELIMITER });
-
+
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path);
string[] components = SplitEscapedPath(path);
components[0] = UnescapePath(components[0]);
//string[] components = path.Split(new string[] { PATH_DELIMITER.ToString() }, 2, StringSplitOptions.None);
-
+
InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
// m_log.DebugFormat(
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
///
- ///
+ ///
///
/// Inventory service to query
///
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
///
- ///
+ ///
/// Inventory service to query
/// The folder from which the path starts
/// The path to the required item.
@@ -313,10 +313,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// If the path isn't just / then trim any starting extraneous slashes
path = path.TrimStart(new char[] { PATH_DELIMITER });
-
+
string[] components = SplitEscapedPath(path);
components[0] = UnescapePath(components[0]);
-
+
//string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
if (components.Length == 1)
@@ -324,15 +324,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// m_log.DebugFormat(
// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
// components[0], startFolder.Name, startFolder.ID);
-
+
List items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
-
+
foreach (InventoryItemBase item in items)
{
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
-
+
if (item.Name == components[0])
foundItems.Add(item);
}
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// m_log.DebugFormat("FOUND COMPONENTS [{0}] and [{1}]", components[0], components[1]);
InventoryCollection contents = inventoryService.GetFolderContent(startFolder.Owner, startFolder.ID);
-
+
foreach (InventoryFolderBase folder in contents.Folders)
{
if (folder.Name == components[0])
@@ -365,9 +365,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
public static string[] SplitEscapedPath(string path)
{
// m_log.DebugFormat("SPLITTING PATH {0}", path);
-
+
bool singleEscapeChar = false;
-
+
for (int i = 0; i < path.Length; i++)
{
if (path[i] == ESCAPE_CHARACTER && !singleEscapeChar)
@@ -395,7 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
public static string UnescapePath(string path)
{
// m_log.DebugFormat("ESCAPING PATH {0}", path);
-
+
StringBuilder sb = new StringBuilder();
bool singleEscapeChar = false;
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
// m_log.DebugFormat("ESCAPED PATH TO {0}", sb);
-
+
return sb.ToString();
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 8847414..be59eb5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
public string Name { get { return "Inventory Archiver Module"; } }
- #endregion
+ #endregion
///
/// Trigger the inventory archive saved event.
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
index c2e645f..f559c2e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
@@ -56,23 +56,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
+
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
-
+
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = new SceneHelpers().SetupScene();
-
+
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
- archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
+ archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
-
- Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
+
+ Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Now try loading to a root child folder
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false);
@@ -90,9 +90,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
- Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
+ Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
}
-
+
///
/// Test that things work when the load path specified starts with a slash
///
@@ -101,22 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
+
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
-
+
UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name);
-
+
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
}
-
+
[Test]
public void TestLoadIarPathWithEscapedChars()
{
@@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
-
+
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
@@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.Name = itemName;
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
- InventoryFolderBase objsFolder
+ InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
@@ -189,16 +189,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
-
+
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Assert.That(
-// foundItem1.CreatorId, Is.EqualTo(userUuid),
+// foundItem1.CreatorId, Is.EqualTo(userUuid),
// "Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That(
- foundItem1.Name, Is.EqualTo(itemName),
+ foundItem1.Name, Is.EqualTo(itemName),
"Loaded item name doesn't match saved name");
}
-
+
///
/// Test replication of an archive path to the user's inventory.
///
@@ -207,21 +207,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
+
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
-
+
Dictionary foldersCreated = new Dictionary();
HashSet nodesLoaded = new HashSet();
-
+
string folder1Name = "1";
string folder2aName = "2a";
string folder2bName = "2b";
-
+
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
-
+
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
@@ -229,42 +229,42 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// Test replication of path1
new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
- iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
+ iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
-
+
List folder1Candidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
-
+
InventoryFolderBase folder1 = folder1Candidates[0];
- List folder2aCandidates
+ List folder2aCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
}
-
+
{
// Test replication of path2
new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
- iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
+ iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
-
+
List folder1Candidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
-
- InventoryFolderBase folder1 = folder1Candidates[0];
-
- List folder2aCandidates
+
+ InventoryFolderBase folder1 = folder1Candidates[0];
+
+ List folder2aCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
-
- List folder2bCandidates
+
+ List folder2bCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1, folder2bName);
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
}
}
-
+
///
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a duplicate path without the merge option.
@@ -274,31 +274,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure();
-
+
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
-
+
string folder1ExistingName = "a";
string folder2Name = "b";
-
- InventoryFolderBase folder1
+
+ InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false);
-
+
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
-
+
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
- itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
+ itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary(), new HashSet());
- List folder1PostCandidates
+ List folder1PostCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
-
+
// 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)
@@ -311,11 +311,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
- List folder2PostCandidates
+ List folder2PostCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
-
+
///
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a merged path.
@@ -325,33 +325,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
+
Scene scene = new SceneHelpers().SetupScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
-
+
string folder1ExistingName = "a";
string folder2Name = "b";
-
- InventoryFolderBase folder1
+
+ InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName, false);
-
+
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
-
+
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true)
.ReplicateArchivePathToUserInventory(
- itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
+ itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary(), new HashSet());
- List folder1PostCandidates
+ List folder1PostCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
- List folder2PostCandidates
+ List folder2PostCandidates
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
index 57b4f80..d0bdc91 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
[TestFixture]
public class InventoryArchiveLoadTests : InventoryArchiveTestCase
- {
+ {
protected TestScene m_scene;
protected InventoryArchiverModule m_archiverModule;
@@ -55,12 +55,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public override void SetUp()
{
base.SetUp();
-
+
SerialiserModule serialiserModule = new SerialiserModule();
m_archiverModule = new InventoryArchiverModule();
m_scene = new SceneHelpers().SetupScene();
- SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
+ SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
}
[Test]
@@ -68,35 +68,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
-
+
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
- m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
-
+ m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
+
InventoryItemBase coaItem
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
-
- Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1");
-
+
+ Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1");
+
string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID);
-
- CoalescedSceneObjects coa;
+
+ CoalescedSceneObjects coa;
bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa);
-
+
Assert.That(readResult, Is.True);
Assert.That(coa.Count, Is.EqualTo(2));
-
+
List coaObjects = coa.Objects;
Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120")));
Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45)));
-
+
Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140")));
- Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
- }
+ Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
+ }
///
/// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized
/// objects.
- ///
+ ///
[Test]
public void TestLoadIarCreatorAccountPresent()
{
@@ -105,26 +105,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
- m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
+ m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
Assert.That(
- foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()),
- "Loaded item non-uuid creator doesn't match original");
+ foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()),
+ "Loaded item non-uuid creator doesn't match original");
Assert.That(
- foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID),
+ foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID),
"Loaded item uuid creator doesn't match original");
Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID),
"Loaded item owner doesn't match inventory reciever");
-
- AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
+
+ AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
-
- Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
+
+ Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
}
-
+
// ///
// /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
// /// an account exists with the same name as the creator, though not the same id.
@@ -137,24 +137,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
//
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
-//
-// m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
+//
+// m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
// InventoryItemBase foundItem1
// = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
//
// Assert.That(
-// foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
-// "Loaded item non-uuid creator doesn't match original");
+// foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
+// "Loaded item non-uuid creator doesn't match original");
// Assert.That(
-// foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
+// foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
// "Loaded item uuid creator doesn't match original");
// Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
// "Loaded item owner doesn't match inventory reciever");
-//
-// AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
+//
+// AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
// string xmlData = Utils.BytesToString(asset1.Data);
// SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
-//
+//
// Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
// }
@@ -167,26 +167,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
+
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
-
+
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
Assert.That(
- foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
+ foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That(
- foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
+ foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
"Loaded item uuid creator doesn't match that of the loading user");
-
- AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
+
+ AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
-
- Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
+
+ Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
index 7265405..bd112b4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
@@ -50,19 +50,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
protected TestScene m_scene;
protected InventoryArchiverModule m_archiverModule;
-
+
[SetUp]
public override void SetUp()
{
base.SetUp();
-
+
SerialiserModule serialiserModule = new SerialiserModule();
m_archiverModule = new InventoryArchiverModule();
m_scene = new SceneHelpers().SetupScene();
- SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
+ SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
}
-
+
///
/// Test that the IAR has the required files in the right order.
///
@@ -73,20 +73,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestOrder()
{
TestHelpers.InMethod();
-// log4net.Config.XmlConfigurator.Configure();
-
+// log4net.Config.XmlConfigurator.Configure();
+
MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
- TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
+ TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
-
+
byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
-
+
InventoryArchiveReadRequest iarr
= new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false);
iarr.LoadControlFile(filePath, data);
-
+
Assert.That(iarr.ControlFileLoaded, Is.True);
}
@@ -119,22 +119,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// InventoryArchiveUtils.
bool gotObjectsFolder = false;
- string objectsFolderName
+ string objectsFolderName
= string.Format(
- "{0}{1}",
- ArchiveConstants.INVENTORY_PATH,
+ "{0}{1}",
+ ArchiveConstants.INVENTORY_PATH,
InventoryArchiveWriteRequest.CreateArchiveFolderName(
UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, userId, "Objects")));
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
-
+
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
// Console.WriteLine("Got {0}", filePath);
// Lazily, we only bother to look for the system objects folder created when we call CreateUserWithInventory()
- // XXX: But really we need to stop all that stuff being created in tests or check for such folders
+ // XXX: But really we need to stop all that stuff being created in tests or check for such folders
// more thoroughly
if (filePath == objectsFolderName)
gotObjectsFolder = true;
@@ -157,19 +157,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
// Create base folder
- InventoryFolderBase f1
+ InventoryFolderBase f1
= UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1", true);
-
+
// Create item1
- SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Dog Object", 0x5);
+ SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Dog Object", 0x5);
InventoryItemBase i1 = UserInventoryHelpers.AddInventoryItem(m_scene, so1, 0x50, 0x60, "f1");
// Create embedded folder
- InventoryFolderBase f1_1
+ InventoryFolderBase f1_1
= UserInventoryHelpers.CreateInventoryFolder(m_scene.InventoryService, userId, "f1/f1.1", true);
// Create embedded item
- SceneObjectGroup so1_1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Cat Object", 0x6);
+ SceneObjectGroup so1_1 = SceneHelpers.CreateSceneObject(1, userId, "My Little Cat Object", 0x6);
InventoryItemBase i2 = UserInventoryHelpers.AddInventoryItem(m_scene, so1_1, 0x500, 0x600, "f1/f1.1");
MemoryStream archiveWriteStream = new MemoryStream();
@@ -188,18 +188,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// InventoryArchiveUtils.
bool gotf1 = false, gotf1_1 = false, gotso1 = false, gotso2 = false;
- string f1FileName
+ string f1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1));
- string f1_1FileName
+ string f1_1FileName
= string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveFolderName(f1_1));
- string so1FileName
+ string so1FileName
= string.Format("{0}{1}", f1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i1));
string so2FileName
= string.Format("{0}{1}", f1_1FileName, InventoryArchiveWriteRequest.CreateArchiveItemName(i2));
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
-
+
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
// Console.WriteLine("Got {0}", filePath);
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// TODO: Test presence of more files and contents of files.
}
-
+
///
/// Test saving a single inventory item to an IAR
/// (subject to change since there is no fixed format yet).
@@ -239,10 +239,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
-
+
// Create asset
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
- SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
+ SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50);
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
@@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.Name = item1Name;
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
- InventoryFolderBase objsFolder
+ InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
m_scene.AddInventoryItem(item1);
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TarArchiveReader.TarEntryType tarEntryType;
// Console.WriteLine("Reading archive");
-
+
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
Console.WriteLine("Got {0}", filePath);
@@ -294,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// {
// gotControlFile = true;
// }
-
+
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{
// string fileName = filePath.Remove(0, "Objects/".Length);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index 519c697..0b65829 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -49,35 +49,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public class InventoryArchiveTestCase : OpenSimTestCase
{
protected ManualResetEvent mre = new ManualResetEvent(false);
-
+
///
/// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
///
protected byte[] m_iarStreamBytes;
-
+
///
/// Stream of data representing a common IAR for load tests.
///
protected MemoryStream m_iarStream;
-
- protected UserAccount m_uaMT
- = new UserAccount {
+
+ protected UserAccount m_uaMT
+ = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
LastName = "Tiddles" };
-
+
protected UserAccount m_uaLL1
- = new UserAccount {
+ = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
- LastName = "Lucan" };
-
+ LastName = "Lucan" };
+
protected UserAccount m_uaLL2
- = new UserAccount {
+ = new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
FirstName = "Lord",
- LastName = "Lucan" };
-
+ LastName = "Lucan" };
+
protected string m_item1Name = "Ray Gun Item";
protected string m_coaItemName = "Coalesced Item";
@@ -105,72 +105,72 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
base.SetUp();
m_iarStream = new MemoryStream(m_iarStreamBytes);
}
-
+
protected void ConstructDefaultIarBytesForTestLoad()
{
// log4net.Config.XmlConfigurator.Configure();
-
+
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = new SceneHelpers().SetupScene();
- SceneHelpers.SetupSceneModules(scene, archiverModule);
-
+ SceneHelpers.SetupSceneModules(scene, archiverModule);
+
UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream();
-
+
// Create scene object asset
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
- SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
+ SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
- scene.AssetService.Store(asset1);
+ scene.AssetService.Store(asset1);
// Create scene object item
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = m_item1Name;
- item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
+ item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
item1.AssetID = asset1.FullID;
item1.GroupID = UUID.Random();
item1.CreatorId = m_uaLL1.PrincipalID.ToString();
item1.Owner = m_uaLL1.PrincipalID;
- item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
+ item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
scene.AddInventoryItem(item1);
-
+
// Create coalesced objects asset
SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120);
cobj1.AbsolutePosition = new Vector3(15, 30, 45);
-
+
SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140);
- cobj2.AbsolutePosition = new Vector3(25, 50, 75);
-
+ cobj2.AbsolutePosition = new Vector3(25, 50, 75);
+
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2);
-
+
AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa);
- scene.AssetService.Store(coaAsset);
-
+ scene.AssetService.Store(coaAsset);
+
// Create coalesced objects inventory item
InventoryItemBase coaItem = new InventoryItemBase();
coaItem.Name = m_coaItemName;
- coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180");
+ coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180");
coaItem.AssetID = coaAsset.FullID;
coaItem.GroupID = UUID.Random();
coaItem.CreatorId = m_uaLL1.PrincipalID.ToString();
coaItem.Owner = m_uaLL1.PrincipalID;
- coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
- scene.AddInventoryItem(coaItem);
-
+ coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
+ scene.AddInventoryItem(coaItem);
+
archiverModule.ArchiveInventory(
- UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream);
-
+ UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream);
+
m_iarStreamBytes = archiveWriteStream.ToArray();
}
-
+
protected void SaveCompleted(
- UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
+ UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException, int SaveCount, int FilterCount)
{
mre.Set();
- }
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 46da5a9..5d7f25c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -149,10 +149,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
// m_log.DebugFormat(
-// "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}",
+// "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}",
// (InstantMessageDialog)im.dialog, client.Name,
// im.fromAgentID, im.fromAgentName, im.toAgentID);
-
+
Scene scene = FindClientScene(client.AgentId);
if (scene == null) // Something seriously wrong here.
@@ -164,31 +164,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (im.binaryBucket.Length < 17) // Invalid
return;
-
+
UUID recipientID = new UUID(im.toAgentID);
ScenePresence user = scene.GetScenePresence(recipientID);
UUID copyID;
// First byte is the asset type
AssetType assetType = (AssetType)im.binaryBucket[0];
-
+
if (AssetType.Folder == assetType)
{
UUID folderID = new UUID(im.binaryBucket, 1);
-
+
m_log.DebugFormat(
"[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory",
folderID, new UUID(im.toAgentID));
-
+
InventoryFolderBase folderCopy
= scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero);
-
+
if (folderCopy == null)
{
client.SendAgentAlertMessage("Can't find folder to give. Nothing given.", false);
return;
}
-
+
// The outgoing binary bucket should contain only the byte which signals an asset folder is
// being copied and the following bytes for the copied folder's UUID
copyID = folderCopy.ID;
@@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
im.binaryBucket = new byte[1 + copyIDBytes.Length];
im.binaryBucket[0] = (byte)AssetType.Folder;
Array.Copy(copyIDBytes, 0, im.binaryBucket, 1, copyIDBytes.Length);
-
+
if (user != null)
user.ControllingClient.SendBulkUpdateInventory(folderCopy);
@@ -225,10 +225,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
client.SendAgentAlertMessage(message, false);
return;
}
-
+
copyID = itemCopy.ID;
Array.Copy(copyID.GetBytes(), 0, im.binaryBucket, 1, 16);
-
+
if (user != null)
user.ControllingClient.SendBulkUpdateInventory(itemCopy);
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else
{
if (m_TransferModule != null)
- m_TransferModule.SendInstantMessage(im, delegate(bool success)
+ m_TransferModule.SendInstantMessage(im, delegate(bool success)
{
if (!success)
client.SendAlertMessage("User not online. Inventory has been saved");
@@ -308,8 +308,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
}
// XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~
- // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be
- // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet
+ // to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be
+ // response from renaming the #RLV/~example folder to ~example. For some reason this is not yet
// happening, possibly because we are not sending the correct inventory update messages with the correct
// transaction IDs
else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
@@ -380,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
InventoryFolderBase folder = null;
UUID? previousParentFolderID = null;
-
+
if (item != null && trashFolder != null)
{
previousParentFolderID = item.Folder;
@@ -404,18 +404,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
client.SendBulkUpdateInventory(folder);
}
}
-
+
if ((null == item && null == folder) | null == trashFolder)
{
string reason = String.Empty;
-
+
if (trashFolder == null)
reason += " Trash folder not found.";
if (item == null)
reason += " Item not found.";
if (folder == null)
reason += " Folder not found.";
-
+
client.SendAgentAlertMessage("Unable to delete "+
"received inventory" + reason, false);
}
@@ -471,12 +471,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
if (im.binaryBucket.Length < 17) // Invalid
return;
-
+
UUID recipientID = new UUID(im.toAgentID);
// First byte is the asset type
AssetType assetType = (AssetType)im.binaryBucket[0];
-
+
if (AssetType.Folder == assetType)
{
UUID folderID = new UUID(im.binaryBucket, 1);
@@ -505,12 +505,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{
if (im.binaryBucket.Length < 1) // Invalid
return;
-
+
UUID recipientID = new UUID(im.toAgentID);
// Bucket is the asset type
AssetType assetType = (AssetType)im.binaryBucket[0];
-
+
if (AssetType.Folder == assetType)
{
UUID folderID = new UUID(im.imSessionID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
index 7ddc396..82ed091 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
@@ -44,9 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
{
[TestFixture]
public class InventoryTransferModuleTests : OpenSimTestCase
- {
- protected TestScene m_scene;
-
+ {
+ protected TestScene m_scene;
+
[SetUp]
public override void SetUp()
{
@@ -56,9 +56,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
config.AddConfig("Messaging");
config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule");
- m_scene = new SceneHelpers().SetupScene();
+ m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, config, new InventoryTransferModule());
- }
+ }
[Test]
public void TestAcceptGivenItem()
@@ -69,9 +69,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
UUID itemId = TestHelpers.ParseTail(0x100);
UUID assetId = TestHelpers.ParseTail(0x200);
- UserAccount ua1
+ UserAccount ua1
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw");
- UserAccount ua2
+ UserAccount ua2
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw");
ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
TestClient receiverClient = (TestClient)receiverSp.ControllingClient;
// Create the object to test give
- InventoryItemBase originalItem
+ InventoryItemBase originalItem
= UserInventoryHelpers.CreateInventoryItem(
m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object);
@@ -89,35 +89,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
byte[] itemIdBytes = itemId.GetBytes();
Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
- GridInstantMessage giveIm
+ GridInstantMessage giveIm
= new GridInstantMessage(
- m_scene,
- giverSp.UUID,
- giverSp.Name,
- receiverSp.UUID,
+ m_scene,
+ giverSp.UUID,
+ giverSp.Name,
+ receiverSp.UUID,
(byte)InstantMessageDialog.InventoryOffered,
false,
- "inventory offered msg",
+ "inventory offered msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
giveImBinaryBucket,
true);
giverClient.HandleImprovedInstantMessage(giveIm);
- // These details might not all be correct.
- GridInstantMessage acceptIm
+ // These details might not all be correct.
+ GridInstantMessage acceptIm
= new GridInstantMessage(
- m_scene,
- receiverSp.UUID,
- receiverSp.Name,
- giverSp.UUID,
- (byte)InstantMessageDialog.InventoryAccepted,
+ m_scene,
+ receiverSp.UUID,
+ receiverSp.Name,
+ giverSp.UUID,
+ (byte)InstantMessageDialog.InventoryAccepted,
false,
- "inventory accepted msg",
+ "inventory accepted msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
null,
true);
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID));
// Test for item successfully making it into the receiver's inventory
- InventoryItemBase receivedItem
+ InventoryItemBase receivedItem
= UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Objects/givenObj");
Assert.That(receivedItem, Is.Not.Null);
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalItemAfterDelete, Is.Not.Null);
// TODO: Test scenario where giver deletes their item first.
- }
+ }
///
/// Test user rejection of a given item.
@@ -165,9 +165,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
UUID itemId = TestHelpers.ParseTail(0x100);
UUID assetId = TestHelpers.ParseTail(0x200);
- UserAccount ua1
+ UserAccount ua1
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw");
- UserAccount ua2
+ UserAccount ua2
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw");
ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
@@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
TestClient receiverClient = (TestClient)receiverSp.ControllingClient;
// Create the object to test give
- InventoryItemBase originalItem
+ InventoryItemBase originalItem
= UserInventoryHelpers.CreateInventoryItem(
m_scene, "givenObj", itemId, assetId, giverSp.UUID, InventoryType.Object);
@@ -188,36 +188,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
byte[] itemIdBytes = itemId.GetBytes();
Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
- GridInstantMessage giveIm
+ GridInstantMessage giveIm
= new GridInstantMessage(
- m_scene,
- giverSp.UUID,
- giverSp.Name,
- receiverSp.UUID,
+ m_scene,
+ giverSp.UUID,
+ giverSp.Name,
+ receiverSp.UUID,
(byte)InstantMessageDialog.InventoryOffered,
false,
- "inventory offered msg",
+ "inventory offered msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
giveImBinaryBucket,
true);
giverClient.HandleImprovedInstantMessage(giveIm);
- // These details might not all be correct.
+ // These details might not all be correct.
// Session ID is now the created item ID (!)
- GridInstantMessage rejectIm
+ GridInstantMessage rejectIm
= new GridInstantMessage(
- m_scene,
- receiverSp.UUID,
- receiverSp.Name,
- giverSp.UUID,
- (byte)InstantMessageDialog.InventoryDeclined,
+ m_scene,
+ receiverSp.UUID,
+ receiverSp.Name,
+ giverSp.UUID,
+ (byte)InstantMessageDialog.InventoryDeclined,
false,
- "inventory declined msg",
+ "inventory declined msg",
new UUID(receivedIm.imSessionID),
- false,
+ false,
Vector3.Zero,
null,
true);
@@ -233,7 +233,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalItemAfterGive.ID, Is.EqualTo(originalItem.ID));
// Test for item successfully making it into the receiver's inventory
- InventoryItemBase receivedItem
+ InventoryItemBase receivedItem
= UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj");
InventoryFolderBase trashFolder
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
= UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, giverSp.UUID, "Objects/givenObj");
Assert.That(originalItemAfterDelete, Is.Not.Null);
- }
+ }
[Test]
public void TestAcceptGivenFolder()
@@ -261,9 +261,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
UUID initialSessionId = TestHelpers.ParseTail(0x10);
UUID folderId = TestHelpers.ParseTail(0x100);
- UserAccount ua1
+ UserAccount ua1
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw");
- UserAccount ua2
+ UserAccount ua2
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw");
ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
ScenePresence receiverSp = SceneHelpers.AddScenePresence(m_scene, ua2);
TestClient receiverClient = (TestClient)receiverSp.ControllingClient;
- InventoryFolderBase originalFolder
+ InventoryFolderBase originalFolder
= UserInventoryHelpers.CreateInventoryFolder(
m_scene.InventoryService, giverSp.UUID, folderId, "f1", true);
@@ -281,35 +281,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
byte[] itemIdBytes = folderId.GetBytes();
Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
- GridInstantMessage giveIm
+ GridInstantMessage giveIm
= new GridInstantMessage(
- m_scene,
- giverSp.UUID,
- giverSp.Name,
- receiverSp.UUID,
+ m_scene,
+ giverSp.UUID,
+ giverSp.Name,
+ receiverSp.UUID,
(byte)InstantMessageDialog.InventoryOffered,
false,
- "inventory offered msg",
+ "inventory offered msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
giveImBinaryBucket,
true);
giverClient.HandleImprovedInstantMessage(giveIm);
- // These details might not all be correct.
- GridInstantMessage acceptIm
+ // These details might not all be correct.
+ GridInstantMessage acceptIm
= new GridInstantMessage(
- m_scene,
- receiverSp.UUID,
- receiverSp.Name,
- giverSp.UUID,
- (byte)InstantMessageDialog.InventoryAccepted,
+ m_scene,
+ receiverSp.UUID,
+ receiverSp.Name,
+ giverSp.UUID,
+ (byte)InstantMessageDialog.InventoryAccepted,
false,
- "inventory accepted msg",
+ "inventory accepted msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
null,
true);
@@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID));
// Test for item successfully making it into the receiver's inventory
- InventoryFolderBase receivedFolder
+ InventoryFolderBase receivedFolder
= UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "f1");
Assert.That(receivedFolder, Is.Not.Null);
@@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalFolderAfterDelete, Is.Not.Null);
// TODO: Test scenario where giver deletes their item first.
- }
+ }
///
/// Test user rejection of a given item.
@@ -357,9 +357,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
UUID initialSessionId = TestHelpers.ParseTail(0x10);
UUID folderId = TestHelpers.ParseTail(0x100);
- UserAccount ua1
+ UserAccount ua1
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "One", TestHelpers.ParseTail(0x1), "pw");
- UserAccount ua2
+ UserAccount ua2
= UserAccountHelpers.CreateUserWithInventory(m_scene, "User", "Two", TestHelpers.ParseTail(0x2), "pw");
ScenePresence giverSp = SceneHelpers.AddScenePresence(m_scene, ua1);
@@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
TestClient receiverClient = (TestClient)receiverSp.ControllingClient;
// Create the folder to test give
- InventoryFolderBase originalFolder
+ InventoryFolderBase originalFolder
= UserInventoryHelpers.CreateInventoryFolder(
m_scene.InventoryService, giverSp.UUID, folderId, "f1", true);
@@ -381,36 +381,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
byte[] itemIdBytes = folderId.GetBytes();
Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
- GridInstantMessage giveIm
+ GridInstantMessage giveIm
= new GridInstantMessage(
- m_scene,
- giverSp.UUID,
- giverSp.Name,
- receiverSp.UUID,
+ m_scene,
+ giverSp.UUID,
+ giverSp.Name,
+ receiverSp.UUID,
(byte)InstantMessageDialog.InventoryOffered,
false,
- "inventory offered msg",
+ "inventory offered msg",
initialSessionId,
- false,
+ false,
Vector3.Zero,
giveImBinaryBucket,
true);
giverClient.HandleImprovedInstantMessage(giveIm);
- // These details might not all be correct.
+ // These details might not all be correct.
// Session ID is now the created item ID (!)
- GridInstantMessage rejectIm
+ GridInstantMessage rejectIm
= new GridInstantMessage(
- m_scene,
- receiverSp.UUID,
- receiverSp.Name,
- giverSp.UUID,
- (byte)InstantMessageDialog.InventoryDeclined,
+ m_scene,
+ receiverSp.UUID,
+ receiverSp.Name,
+ giverSp.UUID,
+ (byte)InstantMessageDialog.InventoryDeclined,
false,
- "inventory declined msg",
+ "inventory declined msg",
new UUID(receivedIm.imSessionID),
- false,
+ false,
Vector3.Zero,
null,
true);
@@ -426,7 +426,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
Assert.That(originalFolderAfterGive.ID, Is.EqualTo(originalFolder.ID));
// Test for folder successfully making it into the receiver's inventory
- InventoryFolderBase receivedFolder
+ InventoryFolderBase receivedFolder
= UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1");
InventoryFolderBase trashFolder
@@ -443,6 +443,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
= UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, giverSp.UUID, "f1");
Assert.That(originalFolderAfterDelete, Is.Not.Null);
- }
+ }
}
}
\ No newline at end of file
--
cgit v1.1