diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-15 13:10:21 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-15 13:10:21 -0400 |
commit | 30ce56e7219b3d2ed16acb322cecec781c3776c5 (patch) | |
tree | 3ab732fc9c8775a3fab0a705b4496ea21c1ab128 /OpenSim/Framework/Tests | |
parent | * part one of adding physics combining (diff) | |
parent | * whoops, missing a / (diff) | |
download | opensim-SC-30ce56e7219b3d2ed16acb322cecec781c3776c5.zip opensim-SC-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.gz opensim-SC-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.bz2 opensim-SC-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitDataTest.cs | 339 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | 201 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/ThreadTrackerTests.cs | 192 |
3 files changed, 732 insertions, 0 deletions
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000..0bf8f64 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -0,0 +1,339 @@ | |||
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 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using OpenMetaverse.StructuredData; | ||
30 | using NUnit.Framework; | ||
31 | |||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class AgentCircuitDataTest | ||
37 | { | ||
38 | private UUID AgentId; | ||
39 | private AvatarAppearance AvAppearance; | ||
40 | private byte[] VisualParams; | ||
41 | private UUID BaseFolder; | ||
42 | private string CapsPath; | ||
43 | private Dictionary<ulong, string> ChildrenCapsPaths; | ||
44 | private uint circuitcode = 0949030; | ||
45 | private string firstname; | ||
46 | private string lastname; | ||
47 | private UUID SecureSessionId; | ||
48 | private UUID SessionId; | ||
49 | private Vector3 StartPos; | ||
50 | |||
51 | |||
52 | [SetUp] | ||
53 | public void setup() | ||
54 | { | ||
55 | AgentId = UUID.Random(); | ||
56 | BaseFolder = UUID.Random(); | ||
57 | CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
58 | ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
59 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
60 | firstname = "CoolAvatarTest"; | ||
61 | lastname = "test"; | ||
62 | StartPos = new Vector3(5,23,125); | ||
63 | |||
64 | SecureSessionId = UUID.Random(); | ||
65 | SessionId = UUID.Random(); | ||
66 | |||
67 | AvAppearance = new AvatarAppearance(AgentId); | ||
68 | AvAppearance.SetDefaultWearables(); | ||
69 | VisualParams = new byte[218]; | ||
70 | AvAppearance.SetDefaultParams(VisualParams); | ||
71 | |||
72 | //body | ||
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | ||
74 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; | ||
75 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; | ||
76 | |||
77 | //Torso | ||
78 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; | ||
79 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; | ||
80 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; | ||
81 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; | ||
82 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; | ||
83 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; | ||
84 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; | ||
85 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; | ||
86 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; | ||
87 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; | ||
88 | |||
89 | // legs | ||
90 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; | ||
91 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; | ||
92 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; | ||
93 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; | ||
94 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; | ||
95 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; | ||
96 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; | ||
97 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; | ||
98 | |||
99 | |||
100 | // head | ||
101 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; | ||
102 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch | ||
103 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; | ||
104 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; | ||
105 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
106 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; | ||
107 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; | ||
108 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; | ||
109 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; | ||
110 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks | ||
111 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks | ||
112 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; | ||
113 | |||
114 | |||
115 | |||
116 | // eyes | ||
117 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; | ||
118 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; | ||
119 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; | ||
120 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; | ||
121 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; | ||
122 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; | ||
123 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; | ||
124 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; | ||
125 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; | ||
126 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; | ||
127 | |||
128 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; | ||
129 | VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; | ||
130 | |||
131 | // ears | ||
132 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; | ||
133 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; | ||
134 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; | ||
135 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; | ||
136 | |||
137 | // nose | ||
138 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; | ||
139 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; | ||
140 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; | ||
141 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division | ||
142 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; | ||
143 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge | ||
144 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge | ||
145 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; | ||
146 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; | ||
147 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; | ||
148 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; | ||
149 | |||
150 | |||
151 | // Mouth | ||
152 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; | ||
153 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness | ||
154 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; | ||
155 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; | ||
156 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; | ||
157 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy | ||
158 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; | ||
159 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; | ||
160 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; | ||
161 | |||
162 | |||
163 | // chin | ||
164 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; | ||
165 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; | ||
166 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; | ||
167 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; | ||
168 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; | ||
169 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; | ||
170 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; | ||
171 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; | ||
172 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; | ||
173 | |||
174 | |||
175 | // hair color | ||
176 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; | ||
177 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; | ||
178 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; | ||
179 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; | ||
180 | |||
181 | // hair style | ||
182 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; | ||
183 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; | ||
184 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; | ||
185 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; | ||
186 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; | ||
187 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; | ||
188 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; | ||
189 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; | ||
190 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; | ||
191 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; | ||
192 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; | ||
193 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; | ||
194 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; | ||
195 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; | ||
196 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; | ||
197 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; | ||
198 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; | ||
199 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; | ||
200 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; | ||
201 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; | ||
202 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; | ||
203 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; | ||
204 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; | ||
205 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; | ||
206 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; | ||
207 | |||
208 | //Eyebrows | ||
209 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; | ||
210 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; | ||
211 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height | ||
212 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; | ||
213 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; | ||
214 | |||
215 | //Facial hair | ||
216 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; | ||
217 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; | ||
218 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; | ||
219 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; | ||
220 | VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; | ||
221 | |||
222 | AvAppearance.VisualParams = VisualParams; | ||
223 | |||
224 | List<byte> wearbyte = new List<byte>(); | ||
225 | for (int i = 0; i < VisualParams.Length; i++) | ||
226 | { | ||
227 | wearbyte.Add(VisualParams[i]); | ||
228 | } | ||
229 | |||
230 | |||
231 | AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); | ||
232 | } | ||
233 | |||
234 | /// <summary> | ||
235 | /// Test to ensure that the serialization format is the same and the underlying types don't change without notice | ||
236 | /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. | ||
237 | /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types | ||
238 | /// have changed and are incompatible. | ||
239 | /// </summary> | ||
240 | [Test] | ||
241 | public void HistoricalAgentCircuitDataOSDConversion() | ||
242 | { | ||
243 | string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}"; | ||
244 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
245 | Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); | ||
246 | Agent1Data.Appearance = AvAppearance; | ||
247 | Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
248 | Agent1Data.CapsPath = CapsPath; | ||
249 | Agent1Data.child = false; | ||
250 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
251 | Agent1Data.circuitcode = circuitcode; | ||
252 | Agent1Data.firstname = firstname; | ||
253 | Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); | ||
254 | Agent1Data.lastname = lastname; | ||
255 | Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); | ||
256 | Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); | ||
257 | Agent1Data.startpos = StartPos; | ||
258 | |||
259 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(oldSerialization); | ||
260 | |||
261 | |||
262 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
263 | Agent2Data.UnpackAgentCircuitData(map2); | ||
264 | |||
265 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
266 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
267 | |||
268 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
269 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
270 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
271 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
272 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
273 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
274 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
275 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
276 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
277 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
278 | /* | ||
279 | Enable this once VisualParams go in the packing method | ||
280 | for (int i=0;i<208;i++) | ||
281 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
282 | */ | ||
283 | } | ||
284 | |||
285 | /// <summary> | ||
286 | /// Test to ensure that the packing and unpacking methods work. | ||
287 | /// </summary> | ||
288 | [Test] | ||
289 | public void TestAgentCircuitDataOSDConversion() | ||
290 | { | ||
291 | AgentCircuitData Agent1Data = new AgentCircuitData(); | ||
292 | Agent1Data.AgentID = AgentId; | ||
293 | Agent1Data.Appearance = AvAppearance; | ||
294 | Agent1Data.BaseFolder = BaseFolder; | ||
295 | Agent1Data.CapsPath = CapsPath; | ||
296 | Agent1Data.child = false; | ||
297 | Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; | ||
298 | Agent1Data.circuitcode = circuitcode; | ||
299 | Agent1Data.firstname = firstname; | ||
300 | Agent1Data.InventoryFolder = BaseFolder; | ||
301 | Agent1Data.lastname = lastname; | ||
302 | Agent1Data.SecureSessionID = SecureSessionId; | ||
303 | Agent1Data.SessionID = SessionId; | ||
304 | Agent1Data.startpos = StartPos; | ||
305 | |||
306 | |||
307 | OSDMap map = Agent1Data.PackAgentCircuitData(); | ||
308 | string str = OSDParser.SerializeJsonString(map); | ||
309 | //System.Console.WriteLine(str); | ||
310 | OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(str); | ||
311 | |||
312 | |||
313 | AgentCircuitData Agent2Data = new AgentCircuitData(); | ||
314 | Agent2Data.UnpackAgentCircuitData(map2); | ||
315 | |||
316 | Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); | ||
317 | Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); | ||
318 | |||
319 | Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); | ||
320 | Assert.That((Agent1Data.child == Agent2Data.child)); | ||
321 | Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); | ||
322 | Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); | ||
323 | Assert.That((Agent1Data.firstname == Agent2Data.firstname)); | ||
324 | Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); | ||
325 | Assert.That((Agent1Data.lastname == Agent2Data.lastname)); | ||
326 | Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); | ||
327 | Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); | ||
328 | Assert.That((Agent1Data.startpos == Agent2Data.startpos)); | ||
329 | |||
330 | /* | ||
331 | Enable this once VisualParams go in the packing method | ||
332 | for (int i = 0; i < 208; i++) | ||
333 | Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); | ||
334 | */ | ||
335 | |||
336 | |||
337 | } | ||
338 | } | ||
339 | } | ||
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs new file mode 100644 index 0000000..ab5f04a --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs | |||
@@ -0,0 +1,201 @@ | |||
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 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | ||
29 | using NUnit.Framework; | ||
30 | using System; | ||
31 | |||
32 | namespace OpenSim.Framework.Tests | ||
33 | { | ||
34 | [TestFixture] | ||
35 | public class AgentCircuitManagerTests | ||
36 | { | ||
37 | private AgentCircuitData m_agentCircuitData1; | ||
38 | private AgentCircuitData m_agentCircuitData2; | ||
39 | private UUID AgentId1; | ||
40 | private UUID AgentId2; | ||
41 | private uint circuitcode1; | ||
42 | private uint circuitcode2; | ||
43 | |||
44 | private UUID SessionId1; | ||
45 | private UUID SessionId2; | ||
46 | private Random rnd = new Random(Environment.TickCount); | ||
47 | |||
48 | [SetUp] | ||
49 | public void setup() | ||
50 | { | ||
51 | |||
52 | AgentId1 = UUID.Random(); | ||
53 | AgentId2 = UUID.Random(); | ||
54 | circuitcode1 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
55 | circuitcode2 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); | ||
56 | SessionId1 = UUID.Random(); | ||
57 | SessionId2 = UUID.Random(); | ||
58 | UUID BaseFolder = UUID.Random(); | ||
59 | string CapsPath = "http://www.opensimulator.org/Caps/Foo"; | ||
60 | Dictionary<ulong,string> ChildrenCapsPaths = new Dictionary<ulong, string>(); | ||
61 | ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); | ||
62 | string firstname = "CoolAvatarTest"; | ||
63 | string lastname = "test"; | ||
64 | Vector3 StartPos = new Vector3(5, 23, 125); | ||
65 | |||
66 | UUID SecureSessionId = UUID.Random(); | ||
67 | UUID SessionId = UUID.Random(); | ||
68 | |||
69 | m_agentCircuitData1 = new AgentCircuitData(); | ||
70 | m_agentCircuitData1.AgentID = AgentId1; | ||
71 | m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1); | ||
72 | m_agentCircuitData1.BaseFolder = BaseFolder; | ||
73 | m_agentCircuitData1.CapsPath = CapsPath; | ||
74 | m_agentCircuitData1.child = false; | ||
75 | m_agentCircuitData1.ChildrenCapSeeds = ChildrenCapsPaths; | ||
76 | m_agentCircuitData1.circuitcode = circuitcode1; | ||
77 | m_agentCircuitData1.firstname = firstname; | ||
78 | m_agentCircuitData1.InventoryFolder = BaseFolder; | ||
79 | m_agentCircuitData1.lastname = lastname; | ||
80 | m_agentCircuitData1.SecureSessionID = SecureSessionId; | ||
81 | m_agentCircuitData1.SessionID = SessionId1; | ||
82 | m_agentCircuitData1.startpos = StartPos; | ||
83 | |||
84 | m_agentCircuitData2 = new AgentCircuitData(); | ||
85 | m_agentCircuitData2.AgentID = AgentId2; | ||
86 | m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2); | ||
87 | m_agentCircuitData2.BaseFolder = BaseFolder; | ||
88 | m_agentCircuitData2.CapsPath = CapsPath; | ||
89 | m_agentCircuitData2.child = false; | ||
90 | m_agentCircuitData2.ChildrenCapSeeds = ChildrenCapsPaths; | ||
91 | m_agentCircuitData2.circuitcode = circuitcode2; | ||
92 | m_agentCircuitData2.firstname = firstname; | ||
93 | m_agentCircuitData2.InventoryFolder = BaseFolder; | ||
94 | m_agentCircuitData2.lastname = lastname; | ||
95 | m_agentCircuitData2.SecureSessionID = SecureSessionId; | ||
96 | m_agentCircuitData2.SessionID = SessionId2; | ||
97 | m_agentCircuitData2.startpos = StartPos; | ||
98 | } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Validate that adding the circuit works appropriately | ||
102 | /// </summary> | ||
103 | [Test] | ||
104 | public void AddAgentCircuitTest() | ||
105 | { | ||
106 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
107 | agentCircuitManager.AddNewCircuit(circuitcode1,m_agentCircuitData1); | ||
108 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
109 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
110 | |||
111 | Assert.That((m_agentCircuitData1.AgentID == agent.AgentID)); | ||
112 | Assert.That((m_agentCircuitData1.BaseFolder == agent.BaseFolder)); | ||
113 | |||
114 | Assert.That((m_agentCircuitData1.CapsPath == agent.CapsPath)); | ||
115 | Assert.That((m_agentCircuitData1.child == agent.child)); | ||
116 | Assert.That((m_agentCircuitData1.ChildrenCapSeeds.Count == agent.ChildrenCapSeeds.Count)); | ||
117 | Assert.That((m_agentCircuitData1.circuitcode == agent.circuitcode)); | ||
118 | Assert.That((m_agentCircuitData1.firstname == agent.firstname)); | ||
119 | Assert.That((m_agentCircuitData1.InventoryFolder == agent.InventoryFolder)); | ||
120 | Assert.That((m_agentCircuitData1.lastname == agent.lastname)); | ||
121 | Assert.That((m_agentCircuitData1.SecureSessionID == agent.SecureSessionID)); | ||
122 | Assert.That((m_agentCircuitData1.SessionID == agent.SessionID)); | ||
123 | Assert.That((m_agentCircuitData1.startpos == agent.startpos)); | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Validate that removing the circuit code removes it appropriately | ||
128 | /// </summary> | ||
129 | [Test] | ||
130 | public void RemoveAgentCircuitTest() | ||
131 | { | ||
132 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
133 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
134 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
135 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
136 | |||
137 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode2); | ||
138 | Assert.That(agent == null); | ||
139 | |||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Validate that changing the circuit code works | ||
144 | /// </summary> | ||
145 | [Test] | ||
146 | public void ChangeAgentCircuitCodeTest() | ||
147 | { | ||
148 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
149 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
150 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
151 | bool result = false; | ||
152 | |||
153 | result = agentCircuitManager.TryChangeCiruitCode(circuitcode1, 393930); | ||
154 | |||
155 | AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(393930); | ||
156 | AgentCircuitData agent2 = agentCircuitManager.GetAgentCircuitData(circuitcode1); | ||
157 | Assert.That(agent != null); | ||
158 | Assert.That(agent2 == null); | ||
159 | Assert.That(result); | ||
160 | |||
161 | } | ||
162 | |||
163 | /// <summary> | ||
164 | /// Validates that the login authentication scheme is working | ||
165 | /// First one should be authorized | ||
166 | /// Rest should not be authorized | ||
167 | /// </summary> | ||
168 | [Test] | ||
169 | public void ValidateLoginTest() | ||
170 | { | ||
171 | AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); | ||
172 | agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); | ||
173 | agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); | ||
174 | |||
175 | // should be authorized | ||
176 | AuthenticateResponse resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode1); | ||
177 | Assert.That(resp.Authorised); | ||
178 | |||
179 | |||
180 | //should not be authorized | ||
181 | resp = agentCircuitManager.AuthenticateSession(SessionId1, UUID.Random(), circuitcode1); | ||
182 | Assert.That(!resp.Authorised); | ||
183 | |||
184 | resp = agentCircuitManager.AuthenticateSession(UUID.Random(), AgentId1, circuitcode1); | ||
185 | Assert.That(!resp.Authorised); | ||
186 | |||
187 | resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode2); | ||
188 | Assert.That(!resp.Authorised); | ||
189 | |||
190 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId1, circuitcode2); | ||
191 | Assert.That(!resp.Authorised); | ||
192 | |||
193 | agentCircuitManager.RemoveCircuit(circuitcode2); | ||
194 | |||
195 | resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); | ||
196 | Assert.That(!resp.Authorised); | ||
197 | |||
198 | } | ||
199 | |||
200 | } | ||
201 | } | ||
diff --git a/OpenSim/Framework/Tests/ThreadTrackerTests.cs b/OpenSim/Framework/Tests/ThreadTrackerTests.cs new file mode 100644 index 0000000..37c75ef --- /dev/null +++ b/OpenSim/Framework/Tests/ThreadTrackerTests.cs | |||
@@ -0,0 +1,192 @@ | |||
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 NUnit.Framework; | ||
30 | using System.Threading; | ||
31 | using System.Collections.Generic; | ||
32 | |||
33 | namespace OpenSim.Framework.Tests | ||
34 | { | ||
35 | [TestFixture] | ||
36 | public class ThreadTrackerTests | ||
37 | { | ||
38 | private bool running = true; | ||
39 | private bool running2 = true; | ||
40 | |||
41 | [Test] | ||
42 | public void DefaultThreadTrackerTest() | ||
43 | { | ||
44 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
45 | |||
46 | /* | ||
47 | foreach (Thread t in lThread) | ||
48 | { | ||
49 | System.Console.WriteLine(t.Name); | ||
50 | } | ||
51 | */ | ||
52 | |||
53 | Assert.That(lThread.Count == 1); | ||
54 | Assert.That(lThread[0].Name == "ThreadTrackerThread"); | ||
55 | } | ||
56 | |||
57 | /// <summary> | ||
58 | /// Validate that adding a thread to the thread tracker works | ||
59 | /// Validate that removing a thread from the thread tracker also works. | ||
60 | /// </summary> | ||
61 | [Test] | ||
62 | public void AddThreadToThreadTrackerTestAndRemoveTest() | ||
63 | { | ||
64 | Thread t = new Thread(run); | ||
65 | t.Name = "TestThread"; | ||
66 | t.Priority = ThreadPriority.BelowNormal; | ||
67 | t.IsBackground = true; | ||
68 | t.SetApartmentState(ApartmentState.MTA); | ||
69 | t.Start(); | ||
70 | ThreadTracker.Add(t); | ||
71 | |||
72 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
73 | |||
74 | Assert.That(lThread.Count == 2); | ||
75 | |||
76 | foreach (Thread tr in lThread) | ||
77 | { | ||
78 | Assert.That((tr.Name == "ThreadTrackerThread" || tr.Name == "TestThread")); | ||
79 | } | ||
80 | running = false; | ||
81 | ThreadTracker.Remove(t); | ||
82 | |||
83 | lThread = ThreadTracker.GetThreads(); | ||
84 | |||
85 | Assert.That(lThread.Count == 1); | ||
86 | |||
87 | foreach (Thread tr in lThread) | ||
88 | { | ||
89 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
90 | } | ||
91 | |||
92 | |||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Test a dead thread removal by aborting it and setting it's last seen active date to 50 seconds | ||
97 | /// </summary> | ||
98 | [Test] | ||
99 | public void DeadThreadTest() | ||
100 | { | ||
101 | Thread t = new Thread(run2); | ||
102 | t.Name = "TestThread"; | ||
103 | t.Priority = ThreadPriority.BelowNormal; | ||
104 | t.IsBackground = true; | ||
105 | t.SetApartmentState(ApartmentState.MTA); | ||
106 | t.Start(); | ||
107 | ThreadTracker.Add(t); | ||
108 | t.Abort(); | ||
109 | Thread.Sleep(5000); | ||
110 | ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50*10000000); | ||
111 | ThreadTracker.CleanUp(); | ||
112 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
113 | |||
114 | Assert.That(lThread.Count == 1); | ||
115 | |||
116 | foreach (Thread tr in lThread) | ||
117 | { | ||
118 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | [Test] | ||
123 | public void UnstartedThreadTest() | ||
124 | { | ||
125 | Thread t = new Thread(run2); | ||
126 | t.Name = "TestThread"; | ||
127 | t.Priority = ThreadPriority.BelowNormal; | ||
128 | t.IsBackground = true; | ||
129 | t.SetApartmentState(ApartmentState.MTA); | ||
130 | ThreadTracker.Add(t); | ||
131 | ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50 * 10000000); | ||
132 | ThreadTracker.CleanUp(); | ||
133 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
134 | |||
135 | Assert.That(lThread.Count == 1); | ||
136 | |||
137 | foreach (Thread tr in lThread) | ||
138 | { | ||
139 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | [Test] | ||
144 | public void NullThreadTest() | ||
145 | { | ||
146 | Thread t = null; | ||
147 | ThreadTracker.Add(t); | ||
148 | |||
149 | List<Thread> lThread = ThreadTracker.GetThreads(); | ||
150 | |||
151 | Assert.That(lThread.Count == 1); | ||
152 | |||
153 | foreach (Thread tr in lThread) | ||
154 | { | ||
155 | Assert.That((tr.Name == "ThreadTrackerThread")); | ||
156 | } | ||
157 | } | ||
158 | |||
159 | |||
160 | /// <summary> | ||
161 | /// Worker thread 0 | ||
162 | /// </summary> | ||
163 | /// <param name="o"></param> | ||
164 | public void run( object o) | ||
165 | { | ||
166 | while (running) | ||
167 | { | ||
168 | Thread.Sleep(5000); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /// <summary> | ||
173 | /// Worker thread 1 | ||
174 | /// </summary> | ||
175 | /// <param name="o"></param> | ||
176 | public void run2(object o) | ||
177 | { | ||
178 | try | ||
179 | { | ||
180 | while (running2) | ||
181 | { | ||
182 | Thread.Sleep(5000); | ||
183 | } | ||
184 | |||
185 | } | ||
186 | catch (ThreadAbortException) | ||
187 | { | ||
188 | } | ||
189 | } | ||
190 | |||
191 | } | ||
192 | } | ||