aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorMelanie2011-06-20 03:08:56 +0200
committerMelanie2011-06-20 03:08:56 +0200
commitf4f55c4d6bdbe9a86b5343159916977b331fefe0 (patch)
tree08fb85f2aa0193bf8549e684b98501c2c52faa1a /OpenSim/Tests
parentAdd some flags to control content in search better (diff)
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.zip
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.gz
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.bz2
opensim-SC-f4f55c4d6bdbe9a86b5343159916977b331fefe0.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Clients/InstantMessage/IMClient.cs75
-rw-r--r--OpenSim/Tests/Clients/Presence/OpenSim.Server.ini2
-rw-r--r--OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini2
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs11
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs94
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs2
6 files changed, 172 insertions, 14 deletions
diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs
new file mode 100644
index 0000000..e7304a2
--- /dev/null
+++ b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs
@@ -0,0 +1,75 @@
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.Text;
31using System.Reflection;
32
33using OpenMetaverse;
34using log4net;
35using log4net.Appender;
36using log4net.Layout;
37
38using OpenSim.Framework;
39using OpenSim.Services.Interfaces;
40using OpenSim.Services.Connectors.InstantMessage;
41
42namespace OpenSim.Tests.Clients.InstantMessage
43{
44 public class IMClient
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 public static void Main(string[] args)
51 {
52 ConsoleAppender consoleAppender = new ConsoleAppender();
53 consoleAppender.Layout =
54 new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
55 log4net.Config.BasicConfigurator.Configure(consoleAppender);
56
57 string serverURI = "http://127.0.0.1:8002";
58 GridInstantMessage im = new GridInstantMessage();
59 im.fromAgentID = new Guid();
60 im.toAgentID = new Guid();
61 im.message = "Hello";
62 im.imSessionID = new Guid();
63
64 bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im);
65
66 if (success)
67 m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI);
68 else
69 m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI);
70
71 System.Console.WriteLine("\n");
72 }
73
74 }
75}
diff --git a/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini b/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini
index 47e73f9..8610c78 100644
--- a/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini
+++ b/OpenSim/Tests/Clients/Presence/OpenSim.Server.ini
@@ -29,5 +29,5 @@ port = 8003
29[PresenceService] 29[PresenceService]
30 LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" 30 LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService"
31 StorageProvider = "OpenSim.Data.MySQL.dll" 31 StorageProvider = "OpenSim.Data.MySQL.dll"
32 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" 32 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;Old Guids=true;"
33 33
diff --git a/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini b/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini
index eb1f473..453e17e 100644
--- a/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini
+++ b/OpenSim/Tests/Clients/UserAccounts/OpenSim.Server.ini
@@ -29,5 +29,5 @@ port = 8003
29[UserAccountService] 29[UserAccountService]
30 LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" 30 LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
31 StorageProvider = "OpenSim.Data.MySQL.dll" 31 StorageProvider = "OpenSim.Data.MySQL.dll"
32 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" 32 ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;Old Guids=true;"
33 33
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index 8cfad79..d924ecd 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -118,16 +118,19 @@ namespace OpenSim.Tests.Common
118 118
119 public static UserAccount CreateUserWithInventory(Scene scene) 119 public static UserAccount CreateUserWithInventory(Scene scene)
120 { 120 {
121 return CreateUserWithInventory(scene, 99);
122 }
123
124 public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail)
125 {
121 return CreateUserWithInventory( 126 return CreateUserWithInventory(
122 scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll"); 127 scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll");
123 } 128 }
124 129
125 public static UserAccount CreateUserWithInventory( 130 public static UserAccount CreateUserWithInventory(
126 Scene scene, string firstName, string lastName, UUID userId, string pw) 131 Scene scene, string firstName, string lastName, UUID userId, string pw)
127 { 132 {
128 UserAccount ua 133 UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
129 = new UserAccount(userId)
130 { FirstName = firstName, LastName = lastName };
131 CreateUserWithInventory(scene, ua, pw); 134 CreateUserWithInventory(scene, ua, pw);
132 return ua; 135 return ua;
133 } 136 }
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index 0419134..1703597 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -26,8 +26,10 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
31using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
32using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
33 35
@@ -40,18 +42,41 @@ namespace OpenSim.Tests.Common
40 { 42 {
41 public static readonly string PATH_DELIMITER = "/"; 43 public static readonly string PATH_DELIMITER = "/";
42 44
43 public static InventoryItemBase CreateInventoryItem( 45 /// <summary>
44 Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) 46 /// Creates a notecard in the objects folder and specify an item id.
47 /// </summary>
48 /// <param name="scene"></param>
49 /// <param name="itemName"></param>
50 /// <param name="itemId"></param>
51 /// <param name="userId"></param>
52 /// <returns></returns>
53 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId)
45 { 54 {
55 return CreateInventoryItem(scene, itemName, UUID.Random(), userId);
56 }
57
58 /// <summary>
59 /// Creates a notecard in the objects folder and specify an item id.
60 /// </summary>
61 /// <param name="scene"></param>
62 /// <param name="itemName"></param>
63 /// <param name="itemId"></param>
64 /// <param name="userId"></param>
65 /// <returns></returns>
66 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId)
67 {
68 AssetBase asset = AssetHelpers.CreateAsset(scene, userId);
46 InventoryItemBase item = new InventoryItemBase(); 69 InventoryItemBase item = new InventoryItemBase();
47 item.Name = itemName; 70 item.Name = itemName;
48 item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; 71 item.AssetID = asset.FullID;
49 item.ID = itemId; 72 item.ID = itemId;
73 item.Owner = userId;
74 item.AssetType = asset.Type;
75 item.InvType = (int)InventoryType.Notecard;
76
77 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
50 78
51 // Really quite bad since the objs folder could be moved in the future and confuse the tests 79 item.Folder = folder.ID;
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53
54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(item); 80 scene.AddInventoryItem(item);
56 81
57 return item; 82 return item;
@@ -111,5 +136,60 @@ namespace OpenSim.Tests.Common
111 else 136 else
112 return newFolder; 137 return newFolder;
113 } 138 }
139
140 /// <summary>
141 /// Get the inventory folder that matches the path name. If there are multiple folders then only the first
142 /// is returned.
143 /// </summary>
144 /// <param name="inventoryService"></param>
145 /// <param name="userId"></param>
146 /// <param name="path"></param>
147 /// <returns>null if no folder matching the path was found</returns>
148 public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path)
149 {
150 List<InventoryFolderBase> folders = GetInventoryFolders(inventoryService, userId, path);
151
152 if (folders.Count != 0)
153 return folders[0];
154 else
155 return null;
156 }
157
158 /// <summary>
159 /// Get the inventory folders that match the path name.
160 /// </summary>
161 /// <param name="inventoryService"></param>
162 /// <param name="userId"></param>
163 /// <param name="path"></param>
164 /// <returns>An empty list if no matching folders were found</returns>
165 public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path)
166 {
167 return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path);
168 }
169
170 /// <summary>
171 /// Get the inventory item that matches the path name. If there are multiple items then only the first
172 /// is returned.
173 /// </summary>
174 /// <param name="inventoryService"></param>
175 /// <param name="userId"></param>
176 /// <param name="path"></param>
177 /// <returns>null if no item matching the path was found</returns>
178 public static InventoryItemBase GetInventoryItem(IInventoryService inventoryService, UUID userId, string path)
179 {
180 return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path);
181 }
182
183 /// <summary>
184 /// Get the inventory items that match the path name.
185 /// </summary>
186 /// <param name="inventoryService"></param>
187 /// <param name="userId"></param>
188 /// <param name="path"></param>
189 /// <returns>An empty list if no matching items were found.</returns>
190 public static List<InventoryItemBase> GetInventoryItems(IInventoryService inventoryService, UUID userId, string path)
191 {
192 return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
193 }
114 } 194 }
115} \ No newline at end of file 195} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 7f0eaa7..bacd773 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -637,7 +637,7 @@ namespace OpenSim.Tests.Common.Mock
637 { 637 {
638 } 638 }
639 639
640 public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) 640 public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels)
641 { 641 {
642 } 642 }
643 643