aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorKittoFlora2009-11-16 01:40:15 +0100
committerKittoFlora2009-11-16 01:40:15 +0100
commit873c9098d8627972e80a1688e85a4cda45e1e7fe (patch)
treea0edc24aef11d5ad6928493d8985386f48dd2607 /OpenSim/Framework/Communications
parentMerge branch 'vehicles' into tests (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.zip
opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.gz
opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.bz2
opensim-SC-873c9098d8627972e80a1688e85a4cda45e1e7fe.tar.xz
Merge branch 'careminster' into tests
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs4
-rw-r--r--OpenSim/Framework/Communications/Osp/OspResolver.cs2
-rw-r--r--OpenSim/Framework/Communications/Services/LoginService.cs26
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/AssetCacheTests.cs159
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs151
5 files changed, 18 insertions, 324 deletions
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
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Services.Interfaces;
37using OpenSim.Tests.Common.Mock;
38
39namespace 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}