diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/ACL.cs | 32 | ||||
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 50 | ||||
-rw-r--r-- | OpenSim/Framework/AssetLandmark.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Osp/OspResolver.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Services/LoginService.cs | 26 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs | 159 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 151 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Parallel.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 101 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/ACLTest.cs | 98 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AssetBaseTest.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/CacheTests.cs | 75 | ||||
-rw-r--r-- | OpenSim/Framework/ThreadTracker.cs | 2 |
17 files changed, 362 insertions, 389 deletions
diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs index 3b1c0f0..f76e8b7 100644 --- a/OpenSim/Framework/ACL.cs +++ b/OpenSim/Framework/ACL.cs | |||
@@ -248,35 +248,5 @@ namespace OpenSim.Framework | |||
248 | 248 | ||
249 | #endregion | 249 | #endregion |
250 | 250 | ||
251 | #region Tests | 251 | |
252 | |||
253 | /// <summary> | ||
254 | /// ACL Test class | ||
255 | /// </summary> | ||
256 | internal class ACLTester | ||
257 | { | ||
258 | public ACLTester() | ||
259 | { | ||
260 | ACL acl = new ACL(); | ||
261 | |||
262 | Role Guests = new Role("Guests"); | ||
263 | acl.AddRole(Guests); | ||
264 | |||
265 | Role[] parents = new Role[0]; | ||
266 | parents[0] = Guests; | ||
267 | |||
268 | Role JoeGuest = new Role("JoeGuest", parents); | ||
269 | acl.AddRole(JoeGuest); | ||
270 | |||
271 | Resource CanBuild = new Resource("CanBuild"); | ||
272 | acl.AddResource(CanBuild); | ||
273 | |||
274 | |||
275 | acl.GrantPermission("Guests", "CanBuild"); | ||
276 | |||
277 | acl.HasPermission("JoeGuest", "CanBuild"); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | #endregion | ||
282 | } \ No newline at end of file | 252 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 9679ff2..212f41d 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Xml.Serialization; | 29 | using System.Xml.Serialization; |
30 | using System.Reflection; | ||
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | 33 | ||
32 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
@@ -37,6 +39,8 @@ namespace OpenSim.Framework | |||
37 | [Serializable] | 39 | [Serializable] |
38 | public class AssetBase | 40 | public class AssetBase |
39 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
40 | /// <summary> | 44 | /// <summary> |
41 | /// Data of the Asset | 45 | /// Data of the Asset |
42 | /// </summary> | 46 | /// </summary> |
@@ -47,16 +51,44 @@ namespace OpenSim.Framework | |||
47 | /// </summary> | 51 | /// </summary> |
48 | private AssetMetadata m_metadata; | 52 | private AssetMetadata m_metadata; |
49 | 53 | ||
54 | // This is needed for .NET serialization!!! | ||
55 | // Do NOT "Optimize" away! | ||
50 | public AssetBase() | 56 | public AssetBase() |
51 | { | 57 | { |
52 | m_metadata = new AssetMetadata(); | 58 | m_metadata = new AssetMetadata(); |
59 | m_metadata.FullID = UUID.Zero; | ||
60 | m_metadata.ID = UUID.Zero.ToString(); | ||
61 | m_metadata.Type = (sbyte)AssetType.Unknown; | ||
53 | } | 62 | } |
54 | 63 | ||
55 | public AssetBase(UUID assetId, string name) | 64 | public AssetBase(UUID assetID, string name, sbyte assetType) |
56 | { | 65 | { |
66 | if (assetType == (sbyte)AssetType.Unknown) | ||
67 | { | ||
68 | System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true); | ||
69 | m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}", | ||
70 | name, assetID, trace.ToString()); | ||
71 | } | ||
72 | |||
57 | m_metadata = new AssetMetadata(); | 73 | m_metadata = new AssetMetadata(); |
58 | m_metadata.FullID = assetId; | 74 | m_metadata.FullID = assetID; |
59 | m_metadata.Name = name; | 75 | m_metadata.Name = name; |
76 | m_metadata.Type = assetType; | ||
77 | } | ||
78 | |||
79 | public AssetBase(string assetID, string name, sbyte assetType) | ||
80 | { | ||
81 | if (assetType == (sbyte)AssetType.Unknown) | ||
82 | { | ||
83 | System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(true); | ||
84 | m_log.ErrorFormat("[ASSETBASE]: Creating asset '{0}' ({1}) with an unknown asset type\n{2}", | ||
85 | name, assetID, trace.ToString()); | ||
86 | } | ||
87 | |||
88 | m_metadata = new AssetMetadata(); | ||
89 | m_metadata.ID = assetID; | ||
90 | m_metadata.Name = name; | ||
91 | m_metadata.Type = assetType; | ||
60 | } | 92 | } |
61 | 93 | ||
62 | public bool ContainsReferences | 94 | public bool ContainsReferences |
@@ -193,11 +225,11 @@ namespace OpenSim.Framework | |||
193 | private string m_name = String.Empty; | 225 | private string m_name = String.Empty; |
194 | private string m_description = String.Empty; | 226 | private string m_description = String.Empty; |
195 | private DateTime m_creation_date; | 227 | private DateTime m_creation_date; |
196 | private sbyte m_type; | 228 | private sbyte m_type = (sbyte)AssetType.Unknown; |
197 | private string m_content_type; | 229 | private string m_content_type; |
198 | private byte[] m_sha1; | 230 | private byte[] m_sha1; |
199 | private bool m_local = false; | 231 | private bool m_local; |
200 | private bool m_temporary = false; | 232 | private bool m_temporary; |
201 | //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); | 233 | //private Dictionary<string, Uri> m_methods = new Dictionary<string, Uri>(); |
202 | //private OSDMap m_extra_data; | 234 | //private OSDMap m_extra_data; |
203 | 235 | ||
@@ -211,7 +243,13 @@ namespace OpenSim.Framework | |||
211 | { | 243 | { |
212 | //get { return m_fullid.ToString(); } | 244 | //get { return m_fullid.ToString(); } |
213 | //set { m_fullid = new UUID(value); } | 245 | //set { m_fullid = new UUID(value); } |
214 | get { return m_id; } | 246 | get |
247 | { | ||
248 | if (String.IsNullOrEmpty(m_id)) | ||
249 | m_id = m_fullid.ToString(); | ||
250 | |||
251 | return m_id; | ||
252 | } | ||
215 | set | 253 | set |
216 | { | 254 | { |
217 | UUID uuid = UUID.Zero; | 255 | UUID uuid = UUID.Zero; |
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index fd7a2cd..058b442 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs | |||
@@ -38,11 +38,9 @@ namespace OpenSim.Framework | |||
38 | public int Version; | 38 | public int Version; |
39 | 39 | ||
40 | public AssetLandmark(AssetBase a) | 40 | public AssetLandmark(AssetBase a) |
41 | : base(a.FullID, a.Name, a.Type) | ||
41 | { | 42 | { |
42 | Data = a.Data; | 43 | Data = a.Data; |
43 | FullID = a.FullID; | ||
44 | Type = a.Type; | ||
45 | Name = a.Name; | ||
46 | Description = a.Description; | 44 | Description = a.Description; |
47 | InternData(); | 45 | InternData(); |
48 | } | 46 | } |
diff --git a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs index a394b1a..6ab1b58 100644 --- a/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs +++ b/OpenSim/Framework/AssetLoader/Filesystem/AssetLoaderFileSystem.cs | |||
@@ -43,18 +43,15 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected static AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage) | 46 | protected static AssetBase CreateAsset(string assetIdStr, string name, string path, sbyte type) |
47 | { | 47 | { |
48 | AssetBase asset = new AssetBase( | 48 | AssetBase asset = new AssetBase(new UUID(assetIdStr), name, type); |
49 | new UUID(assetIdStr), | ||
50 | name | ||
51 | ); | ||
52 | 49 | ||
53 | if (!String.IsNullOrEmpty(path)) | 50 | if (!String.IsNullOrEmpty(path)) |
54 | { | 51 | { |
55 | //m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path); | 52 | //m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path); |
56 | 53 | ||
57 | LoadAsset(asset, isImage, path); | 54 | LoadAsset(asset, path); |
58 | } | 55 | } |
59 | else | 56 | else |
60 | { | 57 | { |
@@ -64,8 +61,14 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
64 | return asset; | 61 | return asset; |
65 | } | 62 | } |
66 | 63 | ||
67 | protected static void LoadAsset(AssetBase info, bool image, string path) | 64 | protected static void LoadAsset(AssetBase info, string path) |
68 | { | 65 | { |
66 | // bool image = | ||
67 | // (info.Type == (sbyte)AssetType.Texture || | ||
68 | // info.Type == (sbyte)AssetType.TextureTGA || | ||
69 | // info.Type == (sbyte)AssetType.ImageJPEG || | ||
70 | // info.Type == (sbyte)AssetType.ImageTGA); | ||
71 | |||
69 | FileInfo fInfo = new FileInfo(path); | 72 | FileInfo fInfo = new FileInfo(path); |
70 | long numBytes = fInfo.Length; | 73 | long numBytes = fInfo.Length; |
71 | if (fInfo.Exists) | 74 | if (fInfo.Exists) |
@@ -138,10 +141,10 @@ namespace OpenSim.Framework.AssetLoader.Filesystem | |||
138 | { | 141 | { |
139 | string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); | 142 | string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString()); |
140 | string name = source.Configs[i].GetString("name", String.Empty); | 143 | string name = source.Configs[i].GetString("name", String.Empty); |
141 | sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); | 144 | sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); |
142 | string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty)); | 145 | string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty)); |
143 | 146 | ||
144 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); | 147 | AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, type); |
145 | 148 | ||
146 | newAsset.Type = type; | 149 | newAsset.Type = type; |
147 | assets.Add(newAsset); | 150 | assets.Add(newAsset); |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 1dfb2d4..1f1ac78 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities | |||
89 | //private static readonly string m_requestTexture = "0003/"; | 89 | //private static readonly string m_requestTexture = "0003/"; |
90 | private static readonly string m_notecardUpdatePath = "0004/"; | 90 | private static readonly string m_notecardUpdatePath = "0004/"; |
91 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | 91 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
92 | private static readonly string m_fetchInventoryPath = "0006/"; | 92 | // private static readonly string m_fetchInventoryPath = "0006/"; |
93 | 93 | ||
94 | // The following entries are in a module, however, they are also here so that we don't re-assign | 94 | // The following entries are in a module, however, they are also here so that we don't re-assign |
95 | // the path to another cap by mistake. | 95 | // the path to another cap by mistake. |
@@ -208,7 +208,7 @@ namespace OpenSim.Framework.Capabilities | |||
208 | // As of RC 1.22.9 of the Linden client this is | 208 | // As of RC 1.22.9 of the Linden client this is |
209 | // supported | 209 | // supported |
210 | 210 | ||
211 | m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); | 211 | //m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); |
212 | 212 | ||
213 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and | 213 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and |
214 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires | 214 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires |
@@ -888,10 +888,7 @@ namespace OpenSim.Framework.Capabilities | |||
888 | } | 888 | } |
889 | 889 | ||
890 | AssetBase asset; | 890 | AssetBase asset; |
891 | asset = new AssetBase(); | 891 | asset = new AssetBase(assetID, assetName, assType); |
892 | asset.FullID = assetID; | ||
893 | asset.Type = assType; | ||
894 | asset.Name = assetName; | ||
895 | asset.Data = data; | 892 | asset.Data = data; |
896 | if (AddNewAsset != null) | 893 | if (AddNewAsset != null) |
897 | AddNewAsset(asset); | 894 | AddNewAsset(asset); |
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index aa71536..6648c36 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -679,7 +679,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
679 | /// <param name="fetchFolders"></param> | 679 | /// <param name="fetchFolders"></param> |
680 | /// <param name="fetchItems"></param> | 680 | /// <param name="fetchItems"></param> |
681 | /// <returns>true if the request was queued or successfully processed, false otherwise</returns> | 681 | /// <returns>true if the request was queued or successfully processed, false otherwise</returns> |
682 | public bool SendInventoryDecendents(IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems) | 682 | public bool SendInventoryDecendents(IClientAPI client, UUID folderID, int version, bool fetchFolders, bool fetchItems) |
683 | { | 683 | { |
684 | if (m_hasReceivedInventory) | 684 | if (m_hasReceivedInventory) |
685 | { | 685 | { |
@@ -693,7 +693,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
693 | 693 | ||
694 | client.SendInventoryFolderDetails( | 694 | client.SendInventoryFolderDetails( |
695 | client.AgentId, folderID, folder.RequestListOfItems(), | 695 | client.AgentId, folderID, folder.RequestListOfItems(), |
696 | folder.RequestListOfFolders(), fetchFolders, fetchItems); | 696 | folder.RequestListOfFolders(), version, fetchFolders, fetchItems); |
697 | 697 | ||
698 | return true; | 698 | return true; |
699 | } | 699 | } |
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 32f0efc..4013896 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
93 | if (!ospa.StartsWith(OSPA_PREFIX)) | 93 | if (!ospa.StartsWith(OSPA_PREFIX)) |
94 | return UUID.Zero; | 94 | return UUID.Zero; |
95 | 95 | ||
96 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); | 96 | // m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); |
97 | 97 | ||
98 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); | 98 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); |
99 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); | 99 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); |
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 922cd49..b652299 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs | |||
@@ -1031,30 +1031,26 @@ namespace OpenSim.Framework.Communications.Services | |||
1031 | return true; | 1031 | return true; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | // StartLocation not available, send him to a nearby region instead | 1034 | // Get the default region handle |
1035 | // regionInfo = m_gridService.RequestClosestRegion(""); | 1035 | ulong defaultHandle = Utils.UIntsToLong(m_defaultHomeX * Constants.RegionSize, m_defaultHomeY * Constants.RegionSize); |
1036 | //m_log.InfoFormat("[LOGIN]: StartLocation not available sending to region {0}", regionInfo.regionName); | ||
1037 | 1036 | ||
1038 | // Send him to default region instead | 1037 | // If we haven't already tried the default region, reset regionInfo |
1039 | ulong defaultHandle = (((ulong)m_defaultHomeX * Constants.RegionSize) << 32) | | 1038 | if (regionInfo != null && defaultHandle != regionInfo.RegionHandle) |
1040 | ((ulong)m_defaultHomeY * Constants.RegionSize); | 1039 | regionInfo = null; |
1041 | 1040 | ||
1042 | if ((regionInfo != null) && (defaultHandle == regionInfo.RegionHandle)) | 1041 | if (regionInfo == null) |
1043 | { | 1042 | { |
1044 | m_log.ErrorFormat("[LOGIN]: Not trying the default region since this is the same as the selected region"); | 1043 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); |
1045 | return false; | 1044 | regionInfo = GetRegionInfo(defaultHandle); |
1046 | } | 1045 | } |
1047 | 1046 | ||
1048 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); | ||
1049 | regionInfo = GetRegionInfo(defaultHandle); | ||
1050 | |||
1051 | if (regionInfo == null) | 1047 | if (regionInfo == null) |
1052 | { | 1048 | { |
1053 | m_log.ErrorFormat("[LOGIN]: No default region available. Aborting."); | 1049 | m_log.ErrorFormat("[LOGIN]: Sending user to any region"); |
1054 | return false; | 1050 | regionInfo = RequestClosestRegion(String.Empty); |
1055 | } | 1051 | } |
1056 | 1052 | ||
1057 | theUser.CurrentAgent.Position = new Vector3(128, 128, 0); | 1053 | theUser.CurrentAgent.Position = new Vector3(128f, 128f, 0f); |
1058 | response.StartLocation = "safe"; | 1054 | response.StartLocation = "safe"; |
1059 | 1055 | ||
1060 | return PrepareLoginToRegion(regionInfo, theUser, response, client); | 1056 | return PrepareLoginToRegion(regionInfo, theUser, response, client); |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs b/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs deleted file mode 100644 index caaebd7..0000000 --- a/OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Threading; | ||
31 | using NUnit.Framework; | ||
32 | using NUnit.Framework.SyntaxHelpers; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Communications.Cache; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Framework.Communications.Tests | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Asset cache tests | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class AssetCacheTests | ||
46 | { | ||
47 | private class FakeUserService : IUserService | ||
48 | { | ||
49 | public void AddTemporaryUserProfile(UserProfileData userProfile) | ||
50 | { | ||
51 | throw new NotImplementedException(); | ||
52 | } | ||
53 | |||
54 | public UserProfileData GetUserProfile(string firstName, string lastName) | ||
55 | { | ||
56 | throw new NotImplementedException(); | ||
57 | } | ||
58 | |||
59 | public UserProfileData GetUserProfile(UUID userId) | ||
60 | { | ||
61 | throw new NotImplementedException(); | ||
62 | } | ||
63 | |||
64 | public UserProfileData GetUserProfile(Uri uri) | ||
65 | { | ||
66 | UserProfileData userProfile = new UserProfileData(); | ||
67 | |||
68 | // userProfile.ID = new UUID(Util.GetHashGuid(uri.ToString(), AssetCache.AssetInfo.Secret)); | ||
69 | |||
70 | return userProfile; | ||
71 | } | ||
72 | |||
73 | public Uri GetUserUri(UserProfileData userProfile) | ||
74 | { | ||
75 | throw new NotImplementedException(); | ||
76 | } | ||
77 | |||
78 | public UserAgentData GetAgentByUUID(UUID userId) | ||
79 | { | ||
80 | throw new NotImplementedException(); | ||
81 | } | ||
82 | |||
83 | public void ClearUserAgent(UUID avatarID) | ||
84 | { | ||
85 | throw new NotImplementedException(); | ||
86 | } | ||
87 | |||
88 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID QueryID, string Query) | ||
89 | { | ||
90 | throw new NotImplementedException(); | ||
91 | } | ||
92 | |||
93 | public UserProfileData SetupMasterUser(string firstName, string lastName) | ||
94 | { | ||
95 | throw new NotImplementedException(); | ||
96 | } | ||
97 | |||
98 | public UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
99 | { | ||
100 | throw new NotImplementedException(); | ||
101 | } | ||
102 | |||
103 | public UserProfileData SetupMasterUser(UUID userId) | ||
104 | { | ||
105 | throw new NotImplementedException(); | ||
106 | } | ||
107 | |||
108 | public bool UpdateUserProfile(UserProfileData data) | ||
109 | { | ||
110 | throw new NotImplementedException(); | ||
111 | } | ||
112 | |||
113 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
114 | { | ||
115 | throw new NotImplementedException(); | ||
116 | } | ||
117 | |||
118 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
119 | { | ||
120 | throw new NotImplementedException(); | ||
121 | } | ||
122 | |||
123 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
124 | { | ||
125 | throw new NotImplementedException(); | ||
126 | } | ||
127 | |||
128 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
129 | { | ||
130 | throw new NotImplementedException(); | ||
131 | } | ||
132 | |||
133 | public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) | ||
134 | { | ||
135 | throw new NotImplementedException(); | ||
136 | } | ||
137 | |||
138 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
139 | { | ||
140 | throw new NotImplementedException(); | ||
141 | } | ||
142 | |||
143 | public bool VerifySession(UUID userID, UUID sessionID) | ||
144 | { | ||
145 | return true; | ||
146 | } | ||
147 | |||
148 | public void SetInventoryService(IInventoryService inv) | ||
149 | { | ||
150 | throw new NotImplementedException(); | ||
151 | } | ||
152 | |||
153 | public virtual bool AuthenticateUserByPassword(UUID userID, string password) | ||
154 | { | ||
155 | throw new NotImplementedException(); | ||
156 | } | ||
157 | } | ||
158 | } | ||
159 | } | ||
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index e891d9c..60f0ba8 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
75 | 75 | ||
76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); | 76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); |
77 | 77 | ||
78 | //IInventoryService m_inventoryService = new TestInventoryService(); | 78 | //IInventoryService m_inventoryService = new MockInventoryService(); |
79 | 79 | ||
80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; | 80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; |
81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); | 81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); |
@@ -95,7 +95,8 @@ namespace OpenSim.Framework.Communications.Tests | |||
95 | TestHelper.InMethod(); | 95 | TestHelper.InMethod(); |
96 | // We want to use our own LoginService for this test, one that | 96 | // We want to use our own LoginService for this test, one that |
97 | // doesn't require authentication. | 97 | // doesn't require authentication. |
98 | new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(), | 98 | new LLStandaloneLoginService( |
99 | (UserManagerBase)m_commsManager.UserService, "Hello folks", new MockInventoryService(), | ||
99 | m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); | 100 | m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); |
100 | 101 | ||
101 | Hashtable loginParams = new Hashtable(); | 102 | Hashtable loginParams = new Hashtable(); |
@@ -457,148 +458,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
457 | #endregion | 458 | #endregion |
458 | } | 459 | } |
459 | } | 460 | } |
460 | 461 | } \ No newline at end of file | |
461 | class TestInventoryService : IInventoryService | ||
462 | { | ||
463 | public TestInventoryService() | ||
464 | { | ||
465 | } | ||
466 | |||
467 | /// <summary> | ||
468 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
469 | /// </summary> | ||
470 | /// <param name="userId"></param> | ||
471 | /// <returns></returns> | ||
472 | public bool CreateUserInventory(UUID userId) | ||
473 | { | ||
474 | return false; | ||
475 | } | ||
476 | |||
477 | /// <summary> | ||
478 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
479 | /// </summary> | ||
480 | /// <param name="userId"></param> | ||
481 | /// <returns></returns> | ||
482 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
483 | { | ||
484 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
485 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
486 | folder.ID = UUID.Random(); | ||
487 | folder.Owner = userId; | ||
488 | folders.Add(folder); | ||
489 | return folders; | ||
490 | } | ||
491 | |||
492 | /// <summary> | ||
493 | /// Returns a list of all the active gestures in a user's inventory. | ||
494 | /// </summary> | ||
495 | /// <param name="userId"> | ||
496 | /// The <see cref="UUID"/> of the user | ||
497 | /// </param> | ||
498 | /// <returns> | ||
499 | /// A flat list of the gesture items. | ||
500 | /// </returns> | ||
501 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
502 | { | ||
503 | return null; | ||
504 | } | ||
505 | |||
506 | public InventoryCollection GetUserInventory(UUID userID) | ||
507 | { | ||
508 | return null; | ||
509 | } | ||
510 | |||
511 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
512 | { | ||
513 | } | ||
514 | |||
515 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
516 | { | ||
517 | return null; | ||
518 | } | ||
519 | |||
520 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
521 | { | ||
522 | return null; | ||
523 | } | ||
524 | |||
525 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
526 | { | ||
527 | return null; | ||
528 | } | ||
529 | |||
530 | public bool AddFolder(InventoryFolderBase folder) | ||
531 | { | ||
532 | return false; | ||
533 | } | ||
534 | |||
535 | public bool UpdateFolder(InventoryFolderBase folder) | ||
536 | { | ||
537 | return false; | ||
538 | } | ||
539 | |||
540 | public bool MoveFolder(InventoryFolderBase folder) | ||
541 | { | ||
542 | return false; | ||
543 | } | ||
544 | |||
545 | public bool DeleteFolders(UUID ownerID, List<UUID> ids) | ||
546 | { | ||
547 | return false; | ||
548 | } | ||
549 | |||
550 | public bool PurgeFolder(InventoryFolderBase folder) | ||
551 | { | ||
552 | return false; | ||
553 | } | ||
554 | |||
555 | public bool AddItem(InventoryItemBase item) | ||
556 | { | ||
557 | return false; | ||
558 | } | ||
559 | |||
560 | public bool UpdateItem(InventoryItemBase item) | ||
561 | { | ||
562 | return false; | ||
563 | } | ||
564 | |||
565 | public bool MoveItems(UUID owner, List<InventoryItemBase> items) | ||
566 | { | ||
567 | return false; | ||
568 | } | ||
569 | |||
570 | public bool DeleteItems(UUID owner, List<UUID> items) | ||
571 | { | ||
572 | return false; | ||
573 | } | ||
574 | |||
575 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
576 | { | ||
577 | return null; | ||
578 | } | ||
579 | |||
580 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
581 | { | ||
582 | return null; | ||
583 | } | ||
584 | |||
585 | public bool HasInventoryForUser(UUID userID) | ||
586 | { | ||
587 | return false; | ||
588 | } | ||
589 | |||
590 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
591 | { | ||
592 | InventoryFolderBase root = new InventoryFolderBase(); | ||
593 | root.ID = UUID.Random(); | ||
594 | root.Owner = userID; | ||
595 | root.ParentID = UUID.Zero; | ||
596 | return root; | ||
597 | } | ||
598 | |||
599 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
600 | { | ||
601 | return 1; | ||
602 | } | ||
603 | } | ||
604 | } | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d304345..04ba9c6 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -446,6 +446,7 @@ namespace OpenSim.Framework | |||
446 | public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes); | 446 | public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes); |
447 | public delegate void MuteListRequest(IClientAPI client, uint muteCRC); | 447 | public delegate void MuteListRequest(IClientAPI client, uint muteCRC); |
448 | public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); | 448 | public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); |
449 | public delegate void GrantUserFriendRights(IClientAPI client, UUID requester, UUID target, int rights); | ||
449 | public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client); | 450 | public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client); |
450 | 451 | ||
451 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); | 452 | public delegate void AgentFOV(IClientAPI client, float verticalAngle); |
@@ -591,7 +592,6 @@ namespace OpenSim.Framework | |||
591 | public readonly Vector3 Velocity; | 592 | public readonly Vector3 Velocity; |
592 | public readonly Vector3 Acceleration; | 593 | public readonly Vector3 Acceleration; |
593 | public readonly Vector3 AngularVelocity; | 594 | public readonly Vector3 AngularVelocity; |
594 | public readonly byte State; | ||
595 | public readonly UUID AssetID; | 595 | public readonly UUID AssetID; |
596 | public readonly UUID OwnerID; | 596 | public readonly UUID OwnerID; |
597 | public readonly int AttachPoint; | 597 | public readonly int AttachPoint; |
@@ -599,7 +599,7 @@ namespace OpenSim.Framework | |||
599 | public readonly double Priority; | 599 | public readonly double Priority; |
600 | 600 | ||
601 | public SendPrimitiveTerseData(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, | 601 | public SendPrimitiveTerseData(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, |
602 | Quaternion rotation, Vector3 velocity, Vector3 acceleration, Vector3 rotationalvelocity, byte state, | 602 | Quaternion rotation, Vector3 velocity, Vector3 acceleration, Vector3 rotationalvelocity, |
603 | UUID assetID, UUID ownerID, int attachPoint, byte[] textureEntry, double priority) | 603 | UUID assetID, UUID ownerID, int attachPoint, byte[] textureEntry, double priority) |
604 | { | 604 | { |
605 | RegionHandle = regionHandle; | 605 | RegionHandle = regionHandle; |
@@ -610,7 +610,6 @@ namespace OpenSim.Framework | |||
610 | Velocity = velocity; | 610 | Velocity = velocity; |
611 | Acceleration = acceleration; | 611 | Acceleration = acceleration; |
612 | AngularVelocity = rotationalvelocity; | 612 | AngularVelocity = rotationalvelocity; |
613 | State = state; | ||
614 | AssetID = assetID; | 613 | AssetID = assetID; |
615 | OwnerID = ownerID; | 614 | OwnerID = ownerID; |
616 | AttachPoint = attachPoint; | 615 | AttachPoint = attachPoint; |
@@ -1023,6 +1022,7 @@ namespace OpenSim.Framework | |||
1023 | event PickInfoUpdate OnPickInfoUpdate; | 1022 | event PickInfoUpdate OnPickInfoUpdate; |
1024 | event AvatarNotesUpdate OnAvatarNotesUpdate; | 1023 | event AvatarNotesUpdate OnAvatarNotesUpdate; |
1025 | event AvatarInterestUpdate OnAvatarInterestUpdate; | 1024 | event AvatarInterestUpdate OnAvatarInterestUpdate; |
1025 | event GrantUserFriendRights OnGrantUserRights; | ||
1026 | 1026 | ||
1027 | event MuteListRequest OnMuteListRequest; | 1027 | event MuteListRequest OnMuteListRequest; |
1028 | 1028 | ||
@@ -1124,7 +1124,7 @@ namespace OpenSim.Framework | |||
1124 | void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler); | 1124 | void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler); |
1125 | 1125 | ||
1126 | void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, | 1126 | void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, |
1127 | List<InventoryFolderBase> folders, bool fetchFolders, | 1127 | List<InventoryFolderBase> folders, int version, bool fetchFolders, |
1128 | bool fetchItems); | 1128 | bool fetchItems); |
1129 | 1129 | ||
1130 | void FlushPrimUpdates(); | 1130 | void FlushPrimUpdates(); |
diff --git a/OpenSim/Framework/Parallel.cs b/OpenSim/Framework/Parallel.cs index 515852f..a0394f2 100644 --- a/OpenSim/Framework/Parallel.cs +++ b/OpenSim/Framework/Parallel.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Framework | |||
69 | Util.FireAndForget( | 69 | Util.FireAndForget( |
70 | delegate(object o) | 70 | delegate(object o) |
71 | { | 71 | { |
72 | int threadIndex = (int)o; | 72 | // int threadIndex = (int)o; |
73 | 73 | ||
74 | while (exception == null) | 74 | while (exception == null) |
75 | { | 75 | { |
@@ -126,7 +126,7 @@ namespace OpenSim.Framework | |||
126 | Util.FireAndForget( | 126 | Util.FireAndForget( |
127 | delegate(object o) | 127 | delegate(object o) |
128 | { | 128 | { |
129 | int threadIndex = (int)o; | 129 | // int threadIndex = (int)o; |
130 | 130 | ||
131 | while (exception == null) | 131 | while (exception == null) |
132 | { | 132 | { |
@@ -182,7 +182,7 @@ namespace OpenSim.Framework | |||
182 | Util.FireAndForget( | 182 | Util.FireAndForget( |
183 | delegate(object o) | 183 | delegate(object o) |
184 | { | 184 | { |
185 | int threadIndex = (int)o; | 185 | // int threadIndex = (int)o; |
186 | 186 | ||
187 | while (exception == null) | 187 | while (exception == null) |
188 | { | 188 | { |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 5e4d175..97231ff 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -1066,5 +1066,106 @@ namespace OpenSim.Framework | |||
1066 | 1066 | ||
1067 | return data; | 1067 | return data; |
1068 | } | 1068 | } |
1069 | |||
1070 | |||
1071 | /// <summary> | ||
1072 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | ||
1073 | /// </summary> | ||
1074 | /// <returns></returns> | ||
1075 | public Primitive ToOmvPrimitive() | ||
1076 | { | ||
1077 | // position and rotation defaults here since they are not available in PrimitiveBaseShape | ||
1078 | return ToOmvPrimitive(new Vector3(0.0f, 0.0f, 0.0f), | ||
1079 | new Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); | ||
1080 | } | ||
1081 | |||
1082 | |||
1083 | /// <summary> | ||
1084 | /// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values | ||
1085 | /// </summary> | ||
1086 | /// <param name="position"></param> | ||
1087 | /// <param name="rotation"></param> | ||
1088 | /// <returns></returns> | ||
1089 | public Primitive ToOmvPrimitive(Vector3 position, Quaternion rotation) | ||
1090 | { | ||
1091 | OpenMetaverse.Primitive prim = new OpenMetaverse.Primitive(); | ||
1092 | |||
1093 | prim.Scale = this.Scale; | ||
1094 | prim.Position = position; | ||
1095 | prim.Rotation = rotation; | ||
1096 | |||
1097 | if (this.SculptEntry) | ||
1098 | { | ||
1099 | prim.Sculpt = new Primitive.SculptData(); | ||
1100 | prim.Sculpt.Type = (OpenMetaverse.SculptType)this.SculptType; | ||
1101 | prim.Sculpt.SculptTexture = this.SculptTexture; | ||
1102 | |||
1103 | return prim; | ||
1104 | } | ||
1105 | |||
1106 | prim.PrimData.PathShearX = this.PathShearX < 128 ? (float)this.PathShearX * 0.01f : (float)(this.PathShearX - 256) * 0.01f; | ||
1107 | prim.PrimData.PathShearY = this.PathShearY < 128 ? (float)this.PathShearY * 0.01f : (float)(this.PathShearY - 256) * 0.01f; | ||
1108 | prim.PrimData.PathBegin = (float)this.PathBegin * 2.0e-5f; | ||
1109 | prim.PrimData.PathEnd = 1.0f - (float)this.PathEnd * 2.0e-5f; | ||
1110 | |||
1111 | prim.PrimData.PathScaleX = (200 - this.PathScaleX) * 0.01f; | ||
1112 | prim.PrimData.PathScaleY = (200 - this.PathScaleY) * 0.01f; | ||
1113 | |||
1114 | prim.PrimData.PathTaperX = this.PathTaperX * 0.01f; | ||
1115 | prim.PrimData.PathTaperY = this.PathTaperY * 0.01f; | ||
1116 | |||
1117 | prim.PrimData.PathTwistBegin = this.PathTwistBegin * 0.01f; | ||
1118 | prim.PrimData.PathTwist = this.PathTwist * 0.01f; | ||
1119 | |||
1120 | prim.PrimData.ProfileBegin = (float)this.ProfileBegin * 2.0e-5f; | ||
1121 | prim.PrimData.ProfileEnd = 1.0f - (float)this.ProfileEnd * 2.0e-5f; | ||
1122 | prim.PrimData.ProfileHollow = (float)this.ProfileHollow * 2.0e-5f; | ||
1123 | |||
1124 | prim.PrimData.profileCurve = this.ProfileCurve; | ||
1125 | prim.PrimData.ProfileHole = (HoleType)this.HollowShape; | ||
1126 | |||
1127 | prim.PrimData.PathCurve = (PathCurve)this.PathCurve; | ||
1128 | prim.PrimData.PathRadiusOffset = 0.01f * this.PathRadiusOffset; | ||
1129 | prim.PrimData.PathRevolutions = 1.0f + 0.015f * this.PathRevolutions; | ||
1130 | prim.PrimData.PathSkew = 0.01f * this.PathSkew; | ||
1131 | |||
1132 | prim.PrimData.PCode = OpenMetaverse.PCode.Prim; | ||
1133 | prim.PrimData.State = 0; | ||
1134 | |||
1135 | if (this.FlexiEntry) | ||
1136 | { | ||
1137 | prim.Flexible = new Primitive.FlexibleData(); | ||
1138 | prim.Flexible.Drag = this.FlexiDrag; | ||
1139 | prim.Flexible.Force = new Vector3(this.FlexiForceX, this.FlexiForceY, this.FlexiForceZ); | ||
1140 | prim.Flexible.Gravity = this.FlexiGravity; | ||
1141 | prim.Flexible.Softness = this.FlexiSoftness; | ||
1142 | prim.Flexible.Tension = this.FlexiTension; | ||
1143 | prim.Flexible.Wind = this.FlexiWind; | ||
1144 | } | ||
1145 | |||
1146 | if (this.LightEntry) | ||
1147 | { | ||
1148 | prim.Light = new Primitive.LightData(); | ||
1149 | prim.Light.Color = new Color4(this.LightColorR, this.LightColorG, this.LightColorB, this.LightColorA); | ||
1150 | prim.Light.Cutoff = this.LightCutoff; | ||
1151 | prim.Light.Falloff = this.LightFalloff; | ||
1152 | prim.Light.Intensity = this.LightIntensity; | ||
1153 | prim.Light.Radius = this.LightRadius; | ||
1154 | } | ||
1155 | |||
1156 | prim.Textures = new Primitive.TextureEntry(this.TextureEntry, 0, this.TextureEntry.Length); | ||
1157 | |||
1158 | prim.Properties = new Primitive.ObjectProperties(); | ||
1159 | prim.Properties.Name = "Primitive"; | ||
1160 | prim.Properties.Description = ""; | ||
1161 | prim.Properties.CreatorID = UUID.Zero; | ||
1162 | prim.Properties.GroupID = UUID.Zero; | ||
1163 | prim.Properties.OwnerID = UUID.Zero; | ||
1164 | prim.Properties.Permissions = new Permissions(); | ||
1165 | prim.Properties.SalePrice = 10; | ||
1166 | prim.Properties.SaleType = new SaleType(); | ||
1167 | |||
1168 | return prim; | ||
1169 | } | ||
1069 | } | 1170 | } |
1070 | } | 1171 | } |
diff --git a/OpenSim/Framework/Tests/ACLTest.cs b/OpenSim/Framework/Tests/ACLTest.cs new file mode 100644 index 0000000..d11f307 --- /dev/null +++ b/OpenSim/Framework/Tests/ACLTest.cs | |||
@@ -0,0 +1,98 @@ | |||
1 | using System; | ||
2 | using NUnit.Framework; | ||
3 | using System.Collections.Generic; | ||
4 | |||
5 | |||
6 | namespace OpenSim.Framework.Tests | ||
7 | { | ||
8 | [TestFixture] | ||
9 | public class ACLTest | ||
10 | { | ||
11 | #region Tests | ||
12 | |||
13 | /// <summary> | ||
14 | /// ACL Test class | ||
15 | /// </summary> | ||
16 | [Test] | ||
17 | public void ACLTest01() | ||
18 | { | ||
19 | ACL acl = new ACL(); | ||
20 | |||
21 | Role Guests = new Role("Guests"); | ||
22 | acl.AddRole(Guests); | ||
23 | |||
24 | Role[] parents = new Role[1]; | ||
25 | parents[0] = Guests; | ||
26 | |||
27 | Role JoeGuest = new Role("JoeGuest", parents); | ||
28 | acl.AddRole(JoeGuest); | ||
29 | |||
30 | Resource CanBuild = new Resource("CanBuild"); | ||
31 | acl.AddResource(CanBuild); | ||
32 | |||
33 | |||
34 | acl.GrantPermission("Guests", "CanBuild"); | ||
35 | |||
36 | Permission perm = acl.HasPermission("JoeGuest", "CanBuild"); | ||
37 | Assert.That(perm == Permission.Allow, "JoeGuest should have permission to build"); | ||
38 | perm = Permission.None; | ||
39 | try | ||
40 | { | ||
41 | perm = acl.HasPermission("unknownGuest", "CanBuild"); | ||
42 | |||
43 | } | ||
44 | catch (KeyNotFoundException) | ||
45 | { | ||
46 | |||
47 | |||
48 | } | ||
49 | catch (Exception) | ||
50 | { | ||
51 | Assert.That(false,"Exception thrown should have been KeyNotFoundException"); | ||
52 | } | ||
53 | Assert.That(perm == Permission.None,"Permission None should be set because exception should have been thrown"); | ||
54 | |||
55 | } | ||
56 | |||
57 | [Test] | ||
58 | public void KnownButPermissionDenyAndPermissionNoneUserTest() | ||
59 | { | ||
60 | ACL acl = new ACL(); | ||
61 | |||
62 | Role Guests = new Role("Guests"); | ||
63 | acl.AddRole(Guests); | ||
64 | Role Administrators = new Role("Administrators"); | ||
65 | acl.AddRole(Administrators); | ||
66 | Role[] Guestparents = new Role[1]; | ||
67 | Role[] Adminparents = new Role[1]; | ||
68 | |||
69 | Guestparents[0] = Guests; | ||
70 | Adminparents[0] = Administrators; | ||
71 | |||
72 | Role JoeGuest = new Role("JoeGuest", Guestparents); | ||
73 | acl.AddRole(JoeGuest); | ||
74 | |||
75 | Resource CanBuild = new Resource("CanBuild"); | ||
76 | acl.AddResource(CanBuild); | ||
77 | |||
78 | Resource CanScript = new Resource("CanScript"); | ||
79 | acl.AddResource(CanScript); | ||
80 | |||
81 | Resource CanRestart = new Resource("CanRestart"); | ||
82 | acl.AddResource(CanRestart); | ||
83 | |||
84 | acl.GrantPermission("Guests", "CanBuild"); | ||
85 | acl.DenyPermission("Guests", "CanRestart"); | ||
86 | |||
87 | acl.GrantPermission("Administrators", "CanScript"); | ||
88 | |||
89 | acl.GrantPermission("Administrators", "CanRestart"); | ||
90 | Permission setPermission = acl.HasPermission("JoeGuest", "CanRestart"); | ||
91 | Assert.That(setPermission == Permission.Deny, "Guests Should not be able to restart"); | ||
92 | Assert.That(acl.HasPermission("JoeGuest", "CanScript") == Permission.None, | ||
93 | "No Explicit Permissions set so should be Permission.None"); | ||
94 | } | ||
95 | |||
96 | #endregion | ||
97 | } | ||
98 | } | ||
diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs index 3dc6b4e..18a3e01 100644 --- a/OpenSim/Framework/Tests/AssetBaseTest.cs +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs | |||
@@ -67,8 +67,7 @@ namespace OpenSim.Framework.Tests | |||
67 | 67 | ||
68 | private void CheckContainsReferences(AssetType assetType, bool expected) | 68 | private void CheckContainsReferences(AssetType assetType, bool expected) |
69 | { | 69 | { |
70 | AssetBase asset = new AssetBase(); | 70 | AssetBase asset = new AssetBase(UUID.Zero, String.Empty, (sbyte)assetType); |
71 | asset.Type = (sbyte)assetType; | ||
72 | bool actual = asset.ContainsReferences; | 71 | bool actual = asset.ContainsReferences; |
73 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); | 72 | Assert.AreEqual(expected, actual, "Expected "+assetType+".ContainsReferences to be "+expected+" but was "+actual+"."); |
74 | } | 73 | } |
diff --git a/OpenSim/Framework/Tests/CacheTests.cs b/OpenSim/Framework/Tests/CacheTests.cs new file mode 100644 index 0000000..8e97232 --- /dev/null +++ b/OpenSim/Framework/Tests/CacheTests.cs | |||
@@ -0,0 +1,75 @@ | |||
1 | using System; | ||
2 | using NUnit.Framework; | ||
3 | using OpenMetaverse; | ||
4 | |||
5 | namespace OpenSim.Framework.Tests | ||
6 | { | ||
7 | [TestFixture] | ||
8 | public class CacheTests | ||
9 | { | ||
10 | private Cache cache; | ||
11 | private UUID cacheItemUUID; | ||
12 | [SetUp] | ||
13 | public void Build() | ||
14 | { | ||
15 | cache = new Cache(); | ||
16 | cacheItemUUID = UUID.Random(); | ||
17 | MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1)); | ||
18 | byte[] foo = new byte[1]; | ||
19 | foo[0] = 255; | ||
20 | cachedItem.Store(foo); | ||
21 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
22 | } | ||
23 | [Test] | ||
24 | public void TestRetreive() | ||
25 | { | ||
26 | CacheItemBase citem = (CacheItemBase)cache.Get(cacheItemUUID.ToString()); | ||
27 | byte[] data = (byte[]) citem.Retrieve(); | ||
28 | Assert.That(data.Length == 1, "Cached Item should have one byte element"); | ||
29 | Assert.That(data[0] == 255, "Cached Item element should be 255"); | ||
30 | } | ||
31 | |||
32 | [Test] | ||
33 | public void TestNotInCache() | ||
34 | { | ||
35 | UUID randomNotIn = UUID.Random(); | ||
36 | while (randomNotIn == cacheItemUUID) | ||
37 | { | ||
38 | randomNotIn = UUID.Random(); | ||
39 | } | ||
40 | object citem = cache.Get(randomNotIn.ToString()); | ||
41 | Assert.That(citem == null, "Item should not be in Cache" ); | ||
42 | } | ||
43 | |||
44 | //NOTE: Test Case disabled until Cache is fixed | ||
45 | [Test] | ||
46 | public void TestTTLExpiredEntry() | ||
47 | { | ||
48 | UUID ImmediateExpiryUUID = UUID.Random(); | ||
49 | MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(-1)); | ||
50 | byte[] foo = new byte[1]; | ||
51 | foo[0] = 1; | ||
52 | cachedItem.Store(foo); | ||
53 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
54 | |||
55 | object citem = cache.Get(cacheItemUUID.ToString()); | ||
56 | //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now"); | ||
57 | } | ||
58 | |||
59 | //NOTE: Test Case disabled until Cache is fixed | ||
60 | [Test] | ||
61 | public void ExpireItemManually() | ||
62 | { | ||
63 | UUID ImmediateExpiryUUID = UUID.Random(); | ||
64 | MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(1)); | ||
65 | byte[] foo = new byte[1]; | ||
66 | foo[0] = 1; | ||
67 | cachedItem.Store(foo); | ||
68 | cache.Store(cacheItemUUID.ToString(), cachedItem); | ||
69 | cache.Invalidate(ImmediateExpiryUUID.ToString()); | ||
70 | object citem = cache.Get(cacheItemUUID.ToString()); | ||
71 | //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); | ||
72 | } | ||
73 | |||
74 | } | ||
75 | } | ||
diff --git a/OpenSim/Framework/ThreadTracker.cs b/OpenSim/Framework/ThreadTracker.cs index b68d9b3..069e98b 100644 --- a/OpenSim/Framework/ThreadTracker.cs +++ b/OpenSim/Framework/ThreadTracker.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Framework | |||
35 | { | 35 | { |
36 | public static class ThreadTracker | 36 | public static class ThreadTracker |
37 | { | 37 | { |
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 38 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
39 | 39 | ||
40 | public static ProcessThreadCollection GetThreads() | 40 | public static ProcessThreadCollection GetThreads() |
41 | { | 41 | { |