aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/TestSuite/pCampBot.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/TestSuite/pCampBot.cs114
1 files changed, 114 insertions, 0 deletions
diff --git a/OpenSim/TestSuite/pCampBot.cs b/OpenSim/TestSuite/pCampBot.cs
new file mode 100644
index 0000000..d42d4bd
--- /dev/null
+++ b/OpenSim/TestSuite/pCampBot.cs
@@ -0,0 +1,114 @@
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 OpenSim 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
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife;
33using libsecondlife.Packets;
34using Nini.Config;
35using log4net;
36using log4net.Config;
37using System.Threading;
38using OpenSim.Framework.Console;
39
40namespace pCampBot
41{
42 /// <summary>
43 /// Event Types from the BOT. Add new events here
44 /// </summary>
45 public enum EventType:int
46 {
47 NONE = 0,
48 CONNECTED = 1,
49 DISCONNECTED = 2
50 }
51
52 public class pCampBot
53 {
54
55 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
56
57 [STAThread]
58 public static void Main(string[] args)
59 {
60 // log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
61 // log4net call
62 // BasicConfigurator.Configure();
63
64 IConfig config = ParseConfig(args);
65 if (config.Get("help") != null || config.Get("loginuri") == null) {
66 Help();
67 } else {
68 int botcount = config.GetInt("botcount", 1);
69
70 BotManager bm = new BotManager();
71
72 System.Console.WriteLine("Error enabled: {0}", m_log.IsErrorEnabled);
73 //startup specified number of bots. 1 is the default
74 m_log.Error("pCampBot started with " + botcount + "bots");
75
76// bm.dobotStartup(botcount, config);
77// while (true)
78// {
79// MainConsole.Instance.Prompt();
80// }
81 }
82 }
83
84 private static IConfig ParseConfig(String[] args)
85 {
86 //Set up our nifty config.. thanks to nini
87 ArgvConfigSource cs = new ArgvConfigSource(args);
88
89 cs.AddSwitch("Startup", "botcount","n");
90 cs.AddSwitch("Startup", "loginuri","l");
91 cs.AddSwitch("Startup", "firstname");
92 cs.AddSwitch("Startup", "lastname");
93 cs.AddSwitch("Startup", "password");
94 cs.AddSwitch("Startup", "help","h");
95
96 IConfig ol = cs.Configs["Startup"];
97 return ol;
98 }
99
100 private static void Help()
101 {
102 System.Console.WriteLine(
103 "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
104 "Spawns a set of bots to test an OpenSim region\n\n" +
105 " -l, -loginuri loginuri for sim to log into (required)\n" +
106 " -n, -botcount number of bots to start (default: 1)\n" +
107 " -firstname first name for the bot(s) (default: random string)\n" +
108 " -lastname lastname for the bot(s) (default: random string)\n" +
109 " -password password for the bots(s) (default: random string)\n" +
110 " -h, -help show this message"
111 );
112 }
113 }
114}