diff options
Diffstat (limited to 'OpenSim/Tests/Robust')
-rw-r--r-- | OpenSim/Tests/Robust/Clients/Grid/GridClient.cs | 133 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Clients/Grid/GridForm.html | 11 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs | 58 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs | 206 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs | 81 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs | 86 | ||||
-rw-r--r-- | OpenSim/Tests/Robust/Server/DemonServer.cs | 69 |
7 files changed, 644 insertions, 0 deletions
diff --git a/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs b/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs new file mode 100644 index 0000000..671aca7 --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/Grid/GridClient.cs | |||
@@ -0,0 +1,133 @@ | |||
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.Text; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using NUnit.Framework; | ||
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | |||
41 | namespace Robust.Tests | ||
42 | { | ||
43 | [TestFixture] | ||
44 | public class GridClient | ||
45 | { | ||
46 | // private static readonly ILog m_log = | ||
47 | // LogManager.GetLogger( | ||
48 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | [Test] | ||
51 | public void Grid_001() | ||
52 | { | ||
53 | GridServicesConnector m_Connector = new GridServicesConnector(DemonServer.Address); | ||
54 | |||
55 | GridRegion r1 = CreateRegion("Test Region 1", 1000, 1000); | ||
56 | GridRegion r2 = CreateRegion("Test Region 2", 1001, 1000); | ||
57 | GridRegion r3 = CreateRegion("Test Region 3", 1005, 1000); | ||
58 | |||
59 | string msg = m_Connector.RegisterRegion(UUID.Zero, r1); | ||
60 | Assert.AreEqual(msg, string.Empty, "Region 1 failed to register"); | ||
61 | |||
62 | msg = m_Connector.RegisterRegion(UUID.Zero, r2); | ||
63 | Assert.AreEqual(msg, string.Empty, "Region 2 failed to register"); | ||
64 | |||
65 | msg = m_Connector.RegisterRegion(UUID.Zero, r3); | ||
66 | Assert.AreEqual(msg, string.Empty, "Region 3 failed to register"); | ||
67 | |||
68 | bool success; | ||
69 | success = m_Connector.DeregisterRegion(r3.RegionID); | ||
70 | Assert.AreEqual(success, true, "Region 3 failed to deregister"); | ||
71 | |||
72 | msg = m_Connector.RegisterRegion(UUID.Zero, r3); | ||
73 | Assert.AreEqual(msg, string.Empty, "Region 3 failed to re-register"); | ||
74 | |||
75 | List<GridRegion> regions = m_Connector.GetNeighbours(UUID.Zero, r1.RegionID); | ||
76 | Assert.AreNotEqual(regions, null, "GetNeighbours of region 1 failed"); | ||
77 | Assert.AreEqual(regions.Count, 1, "Region 1 should have 1 neighbor"); | ||
78 | Assert.AreEqual(regions[0].RegionName, "Test Region 2", "Region 1 has the wrong neighbor"); | ||
79 | |||
80 | GridRegion region = m_Connector.GetRegionByUUID(UUID.Zero, r2.RegionID); | ||
81 | Assert.AreNotEqual(region, null, "GetRegionByUUID for region 2 failed"); | ||
82 | Assert.AreEqual(region.RegionName, "Test Region 2", "GetRegionByUUID of region 2 returned wrong region"); | ||
83 | |||
84 | region = m_Connector.GetRegionByUUID(UUID.Zero, UUID.Random()); | ||
85 | Assert.AreEqual(region, null, "Region with randon id should not exist"); | ||
86 | |||
87 | region = m_Connector.GetRegionByName(UUID.Zero, r3.RegionName); | ||
88 | Assert.AreNotEqual(region, null, "GetRegionByUUID for region 3 failed"); | ||
89 | Assert.AreEqual(region.RegionName, "Test Region 3", "GetRegionByUUID of region 3 returned wrong region"); | ||
90 | |||
91 | region = m_Connector.GetRegionByName(UUID.Zero, "Foo"); | ||
92 | Assert.AreEqual(region, null, "Region Foo should not exist"); | ||
93 | |||
94 | regions = m_Connector.GetRegionsByName(UUID.Zero, "Test", 10); | ||
95 | Assert.AreNotEqual(regions, null, "GetRegionsByName failed"); | ||
96 | Assert.AreEqual(regions.Count, 3, "GetRegionsByName should return 3"); | ||
97 | |||
98 | regions = m_Connector.GetRegionRange(UUID.Zero, | ||
99 | (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002), | ||
100 | (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) ); | ||
101 | Assert.AreNotEqual(regions, null, "GetRegionRange failed"); | ||
102 | Assert.AreEqual(regions.Count, 2, "GetRegionRange should return 2"); | ||
103 | |||
104 | regions = m_Connector.GetRegionRange(UUID.Zero, | ||
105 | (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950), | ||
106 | (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) ); | ||
107 | Assert.AreNotEqual(regions, null, "GetRegionRange (bis) failed"); | ||
108 | Assert.AreEqual(regions.Count, 0, "GetRegionRange (bis) should return 0"); | ||
109 | |||
110 | // Deregister them all | ||
111 | success = m_Connector.DeregisterRegion(r1.RegionID); | ||
112 | Assert.AreEqual(success, true, "Region 1 failed to deregister"); | ||
113 | |||
114 | success = m_Connector.DeregisterRegion(r2.RegionID); | ||
115 | Assert.AreEqual(success, true, "Region 2 failed to deregister"); | ||
116 | |||
117 | success = m_Connector.DeregisterRegion(r3.RegionID); | ||
118 | Assert.AreEqual(success, true, "Region 3 failed to deregister"); | ||
119 | } | ||
120 | |||
121 | private static GridRegion CreateRegion(string name, uint xcell, uint ycell) | ||
122 | { | ||
123 | GridRegion region = new GridRegion(xcell, ycell); | ||
124 | region.RegionName = name; | ||
125 | region.RegionID = UUID.Random(); | ||
126 | region.ExternalHostName = "127.0.0.1"; | ||
127 | region.HttpPort = 9000; | ||
128 | region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 9000); | ||
129 | |||
130 | return region; | ||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/OpenSim/Tests/Robust/Clients/Grid/GridForm.html b/OpenSim/Tests/Robust/Clients/Grid/GridForm.html new file mode 100644 index 0000000..252920f --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/Grid/GridForm.html | |||
@@ -0,0 +1,11 @@ | |||
1 | <html> | ||
2 | |||
3 | <form name="input" action="http://127.0.0.1:8002/grid" method="post"> | ||
4 | xmin:<input type="text" name="XMIN" value="0"> | ||
5 | xmax:<input type="text" name="XMAX" value="0"> | ||
6 | ymin:<input type="text" name="YMIN" value="0"> | ||
7 | ymax:<input type="text" name="YMAX" value="0"> | ||
8 | <input type="hidden" name="METHOD" value="get_region_range"> | ||
9 | <input type="submit" value="Submit" /> | ||
10 | </form> | ||
11 | </html> | ||
diff --git a/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs new file mode 100644 index 0000000..8f312eb --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/InstantMessage/IMClient.cs | |||
@@ -0,0 +1,58 @@ | |||
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.Text; | ||
31 | |||
32 | using OpenMetaverse; | ||
33 | using NUnit.Framework; | ||
34 | |||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Services.Connectors.InstantMessage; | ||
38 | |||
39 | namespace Robust.Tests | ||
40 | { | ||
41 | [TestFixture] | ||
42 | public class IMClient | ||
43 | { | ||
44 | [Test] | ||
45 | public void HGIM_001() | ||
46 | { | ||
47 | GridInstantMessage im = new GridInstantMessage(); | ||
48 | im.fromAgentID = new Guid(); | ||
49 | im.toAgentID = new Guid(); | ||
50 | im.message = "Hello"; | ||
51 | im.imSessionID = new Guid(); | ||
52 | |||
53 | bool success = InstantMessageServiceConnector.SendInstantMessage(DemonServer.Address, im); | ||
54 | Assert.IsFalse(success, "Sending of IM succeeded, but it should have failed"); | ||
55 | } | ||
56 | |||
57 | } | ||
58 | } | ||
diff --git a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs new file mode 100644 index 0000000..0280b73 --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs | |||
@@ -0,0 +1,206 @@ | |||
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.Text; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using NUnit.Framework; | ||
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.Connectors; | ||
39 | |||
40 | using OpenSim.Tests.Common; | ||
41 | |||
42 | namespace Robust.Tests | ||
43 | { | ||
44 | [TestFixture] | ||
45 | public class InventoryClient | ||
46 | { | ||
47 | // private static readonly ILog m_log = | ||
48 | // LogManager.GetLogger( | ||
49 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private UUID m_userID = new UUID("00000000-0000-0000-0000-333333333333"); | ||
52 | private UUID m_rootFolderID; | ||
53 | private UUID m_notecardsFolder; | ||
54 | private UUID m_objectsFolder; | ||
55 | |||
56 | [Test] | ||
57 | public void Inventory_001_CreateInventory() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); | ||
61 | |||
62 | // Create an inventory that looks like this: | ||
63 | // | ||
64 | // /My Inventory | ||
65 | // <other system folders> | ||
66 | // /Objects | ||
67 | // Some Object | ||
68 | // /Notecards | ||
69 | // Notecard 1 | ||
70 | // Notecard 2 | ||
71 | // /Test Folder | ||
72 | // Link to notecard -> /Notecards/Notecard 2 | ||
73 | // Link to Objects folder -> /Objects | ||
74 | |||
75 | bool success = m_Connector.CreateUserInventory(m_userID); | ||
76 | Assert.IsTrue(success, "Failed to create user inventory"); | ||
77 | |||
78 | m_rootFolderID = m_Connector.GetRootFolder(m_userID).ID; | ||
79 | Assert.AreNotEqual(m_rootFolderID, UUID.Zero, "Root folder ID must not be UUID.Zero"); | ||
80 | |||
81 | InventoryFolderBase of = m_Connector.GetFolderForType(m_userID, FolderType.Object); | ||
82 | Assert.IsNotNull(of, "Failed to retrieve Objects folder"); | ||
83 | m_objectsFolder = of.ID; | ||
84 | Assert.AreNotEqual(m_objectsFolder, UUID.Zero, "Objects folder ID must not be UUID.Zero"); | ||
85 | |||
86 | // Add an object | ||
87 | InventoryItemBase item = new InventoryItemBase(new UUID("b0000000-0000-0000-0000-00000000000b"), m_userID); | ||
88 | item.AssetID = UUID.Random(); | ||
89 | item.AssetType = (int)AssetType.Object; | ||
90 | item.Folder = m_objectsFolder; | ||
91 | item.Name = "Some Object"; | ||
92 | item.Description = string.Empty; | ||
93 | success = m_Connector.AddItem(item); | ||
94 | Assert.IsTrue(success, "Failed to add object to inventory"); | ||
95 | |||
96 | InventoryFolderBase ncf = m_Connector.GetFolderForType(m_userID, FolderType.Notecard); | ||
97 | Assert.IsNotNull(of, "Failed to retrieve Notecards folder"); | ||
98 | m_notecardsFolder = ncf.ID; | ||
99 | Assert.AreNotEqual(m_notecardsFolder, UUID.Zero, "Notecards folder ID must not be UUID.Zero"); | ||
100 | m_notecardsFolder = ncf.ID; | ||
101 | |||
102 | // Add a notecard | ||
103 | item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID); | ||
104 | item.AssetID = UUID.Random(); | ||
105 | item.AssetType = (int)AssetType.Notecard; | ||
106 | item.Folder = m_notecardsFolder; | ||
107 | item.Name = "Test Notecard 1"; | ||
108 | item.Description = string.Empty; | ||
109 | success = m_Connector.AddItem(item); | ||
110 | Assert.IsTrue(success, "Failed to add Notecard 1 to inventory"); | ||
111 | // Add another notecard | ||
112 | item.ID = new UUID("20000000-0000-0000-0000-000000000002"); | ||
113 | item.AssetID = new UUID("a0000000-0000-0000-0000-00000000000a"); | ||
114 | item.Name = "Test Notecard 2"; | ||
115 | item.Description = string.Empty; | ||
116 | success = m_Connector.AddItem(item); | ||
117 | Assert.IsTrue(success, "Failed to add Notecard 2 to inventory"); | ||
118 | |||
119 | // Add a folder | ||
120 | InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID); | ||
121 | folder.Type = (int)FolderType.None; | ||
122 | success = m_Connector.AddFolder(folder); | ||
123 | Assert.IsTrue(success, "Failed to add Test Folder to inventory"); | ||
124 | |||
125 | // Add a link to notecard 2 in Test Folder | ||
126 | item.AssetID = item.ID; // use item ID of notecard 2 | ||
127 | item.ID = new UUID("40000000-0000-0000-0000-000000000004"); | ||
128 | item.AssetType = (int)AssetType.Link; | ||
129 | item.Folder = folder.ID; | ||
130 | item.Name = "Link to notecard"; | ||
131 | item.Description = string.Empty; | ||
132 | success = m_Connector.AddItem(item); | ||
133 | Assert.IsTrue(success, "Failed to add link to notecard to inventory"); | ||
134 | |||
135 | // Add a link to the Objects folder in Test Folder | ||
136 | item.AssetID = m_Connector.GetFolderForType(m_userID, FolderType.Object).ID; // use item ID of Objects folder | ||
137 | item.ID = new UUID("50000000-0000-0000-0000-000000000005"); | ||
138 | item.AssetType = (int)AssetType.LinkFolder; | ||
139 | item.Folder = folder.ID; | ||
140 | item.Name = "Link to Objects folder"; | ||
141 | item.Description = string.Empty; | ||
142 | success = m_Connector.AddItem(item); | ||
143 | Assert.IsTrue(success, "Failed to add link to objects folder to inventory"); | ||
144 | |||
145 | InventoryCollection coll = m_Connector.GetFolderContent(m_userID, m_rootFolderID); | ||
146 | Assert.IsNotNull(coll, "Failed to retrieve contents of root folder"); | ||
147 | Assert.Greater(coll.Folders.Count, 0, "Root folder does not have any subfolders"); | ||
148 | |||
149 | coll = m_Connector.GetFolderContent(m_userID, folder.ID); | ||
150 | Assert.IsNotNull(coll, "Failed to retrieve contents of Test Folder"); | ||
151 | Assert.AreEqual(coll.Items.Count + coll.Folders.Count, 2, "Test Folder is expected to have exactly 2 things inside"); | ||
152 | |||
153 | } | ||
154 | |||
155 | [Test] | ||
156 | public void Inventory_002_MultipleItemsRequest() | ||
157 | { | ||
158 | TestHelpers.InMethod(); | ||
159 | XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); | ||
160 | |||
161 | // Prefetch Notecard 1, will be cached from here on | ||
162 | InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID); | ||
163 | item = m_Connector.GetItem(item); | ||
164 | Assert.NotNull(item, "Failed to get Notecard 1"); | ||
165 | Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1"); | ||
166 | |||
167 | UUID[] uuids = new UUID[2]; | ||
168 | uuids[0] = item.ID; | ||
169 | uuids[1] = new UUID("20000000-0000-0000-0000-000000000002"); | ||
170 | |||
171 | InventoryItemBase[] items = m_Connector.GetMultipleItems(m_userID, uuids); | ||
172 | Assert.NotNull(items, "Failed to get multiple items"); | ||
173 | Assert.IsTrue(items.Length == 2, "Requested 2 items, but didn't receive 2 items"); | ||
174 | |||
175 | // Now they should both be cached | ||
176 | items = m_Connector.GetMultipleItems(m_userID, uuids); | ||
177 | Assert.NotNull(items, "(Repeat) Failed to get multiple items"); | ||
178 | Assert.IsTrue(items.Length == 2, "(Repeat) Requested 2 items, but didn't receive 2 items"); | ||
179 | |||
180 | // This item doesn't exist, but [0] does, and it's cached. | ||
181 | uuids[1] = new UUID("bb000000-0000-0000-0000-0000000000bb"); | ||
182 | // Fetching should return 2 items, but [1] should be null | ||
183 | items = m_Connector.GetMultipleItems(m_userID, uuids); | ||
184 | Assert.NotNull(items, "(Three times) Failed to get multiple items"); | ||
185 | Assert.IsTrue(items.Length == 2, "(Three times) Requested 2 items, but didn't receive 2 items"); | ||
186 | Assert.AreEqual("Test Notecard 1", items[0].Name, "(Three times) Wrong name for Notecard 1"); | ||
187 | Assert.IsNull(items[1], "(Three times) Expecting 2nd item to be null"); | ||
188 | |||
189 | // Now both don't exist | ||
190 | uuids[0] = new UUID("aa000000-0000-0000-0000-0000000000aa"); | ||
191 | items = m_Connector.GetMultipleItems(m_userID, uuids); | ||
192 | Assert.Null(items[0], "Request to multiple non-existent items is supposed to return null [0]"); | ||
193 | Assert.Null(items[1], "Request to multiple non-existent items is supposed to return null [1]"); | ||
194 | |||
195 | // This item exists, and it's not cached | ||
196 | uuids[1] = new UUID("b0000000-0000-0000-0000-00000000000b"); | ||
197 | // Fetching should return 2 items, but [0] should be null | ||
198 | items = m_Connector.GetMultipleItems(m_userID, uuids); | ||
199 | Assert.NotNull(items, "(Four times) Failed to get multiple items"); | ||
200 | Assert.IsTrue(items.Length == 2, "(Four times) Requested 2 items, but didn't receive 2 items"); | ||
201 | Assert.AreEqual("Some Object", items[1].Name, "(Four times) Wrong name for Some Object"); | ||
202 | Assert.IsNull(items[0], "(Four times) Expecting 1st item to be null"); | ||
203 | |||
204 | } | ||
205 | } | ||
206 | } | ||
diff --git a/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs b/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs new file mode 100644 index 0000000..31c8ee9 --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/Presence/PresenceClient.cs | |||
@@ -0,0 +1,81 @@ | |||
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.Text; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using NUnit.Framework; | ||
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.Connectors; | ||
39 | |||
40 | namespace Robust.Tests | ||
41 | { | ||
42 | [TestFixture] | ||
43 | public class PresenceClient | ||
44 | { | ||
45 | [Test] | ||
46 | public void Presence_001() | ||
47 | { | ||
48 | PresenceServicesConnector m_Connector = new PresenceServicesConnector(DemonServer.Address); | ||
49 | |||
50 | UUID user1 = UUID.Random(); | ||
51 | UUID session1 = UUID.Random(); | ||
52 | UUID region1 = UUID.Random(); | ||
53 | |||
54 | bool success = m_Connector.LoginAgent(user1.ToString(), session1, UUID.Zero); | ||
55 | Assert.AreEqual(success, true, "Failed to add user session"); | ||
56 | |||
57 | PresenceInfo pinfo = m_Connector.GetAgent(session1); | ||
58 | Assert.AreNotEqual(pinfo, null, "Unable to retrieve session"); | ||
59 | Assert.AreEqual(pinfo.UserID, user1.ToString(), "Retrieved session does not match expected userID"); | ||
60 | Assert.AreNotEqual(pinfo.RegionID, region1, "Retrieved session is unexpectedly in region"); | ||
61 | |||
62 | success = m_Connector.ReportAgent(session1, region1); | ||
63 | Assert.AreEqual(success, true, "Failed to report session in region 1"); | ||
64 | |||
65 | pinfo = m_Connector.GetAgent(session1); | ||
66 | Assert.AreNotEqual(pinfo, null, "Unable to session presence"); | ||
67 | Assert.AreEqual(pinfo.UserID, user1.ToString(), "Retrieved session does not match expected userID"); | ||
68 | Assert.AreEqual(pinfo.RegionID, region1, "Retrieved session is not in expected region"); | ||
69 | |||
70 | success = m_Connector.LogoutAgent(session1); | ||
71 | Assert.AreEqual(success, true, "Failed to remove session"); | ||
72 | |||
73 | pinfo = m_Connector.GetAgent(session1); | ||
74 | Assert.AreEqual(pinfo, null, "Session is still there, even though it shouldn't"); | ||
75 | |||
76 | success = m_Connector.ReportAgent(session1, UUID.Random()); | ||
77 | Assert.AreEqual(success, false, "Remove non-existing session should fail"); | ||
78 | } | ||
79 | |||
80 | } | ||
81 | } | ||
diff --git a/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs new file mode 100644 index 0000000..3238dc9 --- /dev/null +++ b/OpenSim/Tests/Robust/Clients/UserAccounts/UserAccountsClient.cs | |||
@@ -0,0 +1,86 @@ | |||
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.Text; | ||
31 | using System.Reflection; | ||
32 | |||
33 | using OpenMetaverse; | ||
34 | using NUnit.Framework; | ||
35 | |||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.Connectors; | ||
39 | |||
40 | namespace Robust.Tests | ||
41 | { | ||
42 | [TestFixture] | ||
43 | public class UserAccountsClient | ||
44 | { | ||
45 | [Test] | ||
46 | public void UserAccounts_001() | ||
47 | { | ||
48 | UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(DemonServer.Address); | ||
49 | |||
50 | string first = "Completely"; | ||
51 | string last = "Clueless"; | ||
52 | string email = "foo@bar.com"; | ||
53 | |||
54 | UserAccount account = m_Connector.CreateUser(first, last, "123", email, UUID.Zero); | ||
55 | Assert.IsNotNull(account, "Failed to create account " + first + " " + last); | ||
56 | UUID user1 = account.PrincipalID; | ||
57 | |||
58 | account = m_Connector.GetUserAccount(UUID.Zero, user1); | ||
59 | Assert.NotNull(account, "Failed to retrieve account for user id " + user1); | ||
60 | Assert.AreEqual(account.FirstName, first, "First name does not match"); | ||
61 | Assert.AreEqual(account.LastName, last, "Last name does not match"); | ||
62 | |||
63 | account = m_Connector.GetUserAccount(UUID.Zero, first, last); | ||
64 | Assert.IsNotNull(account, "Failed to retrieve account for user " + first + " " + last); | ||
65 | Assert.AreEqual(account.FirstName, first, "First name does not match (bis)"); | ||
66 | Assert.AreEqual(account.LastName, last, "Last name does not match (bis)"); | ||
67 | |||
68 | account.Email = "user@example.com"; | ||
69 | bool success = m_Connector.StoreUserAccount(account); | ||
70 | Assert.IsTrue(success, "Failed to store existing account"); | ||
71 | |||
72 | account = m_Connector.GetUserAccount(UUID.Zero, user1); | ||
73 | Assert.NotNull(account, "Failed to retrieve account for user id " + user1); | ||
74 | Assert.AreEqual(account.Email, "user@example.com", "Incorrect email"); | ||
75 | |||
76 | account = new UserAccount(UUID.Zero, "DoesNot", "Exist", "xxx@xxx.com"); | ||
77 | success = m_Connector.StoreUserAccount(account); | ||
78 | Assert.IsFalse(success, "Storing a non-existing account must fail"); | ||
79 | |||
80 | account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist"); | ||
81 | Assert.IsNull(account, "Account DoesNot Exist must not be there"); | ||
82 | |||
83 | } | ||
84 | |||
85 | } | ||
86 | } | ||
diff --git a/OpenSim/Tests/Robust/Server/DemonServer.cs b/OpenSim/Tests/Robust/Server/DemonServer.cs new file mode 100644 index 0000000..1e0797e --- /dev/null +++ b/OpenSim/Tests/Robust/Server/DemonServer.cs | |||
@@ -0,0 +1,69 @@ | |||
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.IO; | ||
31 | using System.Threading; | ||
32 | |||
33 | using Nini.Config; | ||
34 | using log4net; | ||
35 | using NUnit.Framework; | ||
36 | |||
37 | using OpenSim.Server; | ||
38 | |||
39 | namespace Robust.Tests | ||
40 | { | ||
41 | [SetUpFixture] | ||
42 | public class DemonServer : OpenSimServer | ||
43 | { | ||
44 | private Thread m_demon; | ||
45 | |||
46 | public static string Address = "http://localhost:8888"; | ||
47 | |||
48 | [SetUp] | ||
49 | public void StartDemon() | ||
50 | { | ||
51 | if (File.Exists("Robust.Tests.log")) | ||
52 | File.Delete("Robust.Tests.log"); | ||
53 | |||
54 | Console.WriteLine("**** Starting demon Robust server ****"); | ||
55 | m_demon = new Thread( () => Main(new string[] {"-inifile=Robust.Tests.ini"})); | ||
56 | m_demon.Start(); | ||
57 | // Give some time for the server to instantiate all services | ||
58 | Thread.Sleep(3000); | ||
59 | Console.WriteLine("**** Setup Finished ****"); | ||
60 | } | ||
61 | |||
62 | [TearDown] | ||
63 | public void StopDemon() | ||
64 | { | ||
65 | Console.WriteLine("**** Killing demon Robust Server ****"); | ||
66 | m_Server.Shutdown(); | ||
67 | } | ||
68 | } | ||
69 | } | ||