stella 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/README.txt +135 -0
  2. data/Rakefile +100 -0
  3. data/bin/stella +12 -0
  4. data/lib/stella.rb +58 -0
  5. data/lib/stella/adapter/ab.rb +303 -0
  6. data/lib/stella/adapter/base.rb +87 -0
  7. data/lib/stella/adapter/httperf.rb +296 -0
  8. data/lib/stella/adapter/siege.rb +321 -0
  9. data/lib/stella/cli.rb +291 -0
  10. data/lib/stella/cli/agents.rb +73 -0
  11. data/lib/stella/cli/base.rb +19 -0
  12. data/lib/stella/cli/language.rb +18 -0
  13. data/lib/stella/cli/localtest.rb +80 -0
  14. data/lib/stella/command/base.rb +111 -0
  15. data/lib/stella/command/localtest.rb +339 -0
  16. data/lib/stella/logger.rb +63 -0
  17. data/lib/stella/response.rb +82 -0
  18. data/lib/stella/storable.rb +116 -0
  19. data/lib/stella/support.rb +106 -0
  20. data/lib/stella/test/base.rb +34 -0
  21. data/lib/stella/test/definition.rb +79 -0
  22. data/lib/stella/test/run/summary.rb +50 -0
  23. data/lib/stella/test/summary.rb +82 -0
  24. data/lib/stella/text.rb +64 -0
  25. data/lib/stella/text/resource.rb +39 -0
  26. data/lib/utils/crypto-key.rb +84 -0
  27. data/lib/utils/escape.rb +302 -0
  28. data/lib/utils/fileutil.rb +59 -0
  29. data/lib/utils/httputil.rb +210 -0
  30. data/lib/utils/mathutil.rb +78 -0
  31. data/lib/utils/textgraph.rb +267 -0
  32. data/lib/utils/timerutil.rb +58 -0
  33. data/support/text/en.yaml +54 -0
  34. data/support/text/nl.yaml +1 -0
  35. data/support/useragents.txt +75 -0
  36. data/vendor/useragent/MIT-LICENSE +20 -0
  37. data/vendor/useragent/README +21 -0
  38. data/vendor/useragent/init.rb +1 -0
  39. data/vendor/useragent/lib/user_agent.rb +83 -0
  40. data/vendor/useragent/lib/user_agent/browsers.rb +24 -0
  41. data/vendor/useragent/lib/user_agent/browsers/all.rb +69 -0
  42. data/vendor/useragent/lib/user_agent/browsers/gecko.rb +43 -0
  43. data/vendor/useragent/lib/user_agent/browsers/internet_explorer.rb +40 -0
  44. data/vendor/useragent/lib/user_agent/browsers/opera.rb +49 -0
  45. data/vendor/useragent/lib/user_agent/browsers/webkit.rb +94 -0
  46. data/vendor/useragent/lib/user_agent/comparable.rb +25 -0
  47. data/vendor/useragent/lib/user_agent/operating_systems.rb +19 -0
  48. data/vendor/useragent/spec/browsers/gecko_user_agent_spec.rb +209 -0
  49. data/vendor/useragent/spec/browsers/internet_explorer_user_agent_spec.rb +99 -0
  50. data/vendor/useragent/spec/browsers/opera_user_agent_spec.rb +59 -0
  51. data/vendor/useragent/spec/browsers/other_user_agent_spec.rb +19 -0
  52. data/vendor/useragent/spec/browsers/webkit_user_agent_spec.rb +373 -0
  53. data/vendor/useragent/spec/spec_helper.rb +1 -0
  54. data/vendor/useragent/spec/user_agent_spec.rb +331 -0
  55. data/vendor/useragent/useragent.gemspec +12 -0
  56. metadata +139 -0
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Opera browser", :shared => true do
4
+ it "should return 'Opera' as its browser" do
5
+ @useragent.browser.should == "Opera"
6
+ end
7
+
8
+ it "should return :strong as its security" do
9
+ @useragent.security.should == :strong
10
+ end
11
+ end
12
+
13
+ describe "UserAgent: 'Opera/9.27 (Macintosh; Intel Mac OS X; U; en)'" do
14
+ before do
15
+ @useragent = UserAgent.parse("Opera/9.27 (Macintosh; Intel Mac OS X; U; en)")
16
+ end
17
+
18
+ it_should_behave_like "Opera browser"
19
+
20
+ it "should return '9.27' as its version" do
21
+ @useragent.version.should == "9.27"
22
+ end
23
+
24
+ it "should return 'Macintosh' as its platform" do
25
+ @useragent.platform.should == "Macintosh"
26
+ end
27
+
28
+ it "should return 'Intel Mac OS X' as its os" do
29
+ @useragent.os.should == "Intel Mac OS X"
30
+ end
31
+
32
+ it "should return 'en' as its localization" do
33
+ @useragent.localization.should == "en"
34
+ end
35
+ end
36
+
37
+ describe "UserAgent: 'Opera/9.27 (Windows NT 5.1; U; en)'" do
38
+ before do
39
+ @useragent = UserAgent.parse("Opera/9.27 (Windows NT 5.1; U; en)")
40
+ end
41
+
42
+ it_should_behave_like "Opera browser"
43
+
44
+ it "should return '9.27' as its version" do
45
+ @useragent.version.should == "9.27"
46
+ end
47
+
48
+ it "should return 'Windows' as its platform" do
49
+ @useragent.platform.should == "Windows"
50
+ end
51
+
52
+ it "should return 'Windows XP' as its os" do
53
+ @useragent.os.should == "Windows XP"
54
+ end
55
+
56
+ it "should return 'en' as its localization" do
57
+ @useragent.localization.should == "en"
58
+ end
59
+ end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "UserAgent: 'amaya/9.51 libwww/5.4.0'" do
4
+ before do
5
+ @useragent = UserAgent.parse("amaya/9.51 libwww/5.4.0")
6
+ end
7
+
8
+ it "should return 'amaya' as its browser" do
9
+ @useragent.browser.should == "amaya"
10
+ end
11
+
12
+ it "should return '9.51' as its version" do
13
+ @useragent.version.should == "9.51"
14
+ end
15
+
16
+ it "should return '5.4.0' as its libwww version" do
17
+ @useragent.libwww.version.should == "5.4.0"
18
+ end
19
+ end
@@ -0,0 +1,373 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Safari browser", :shared => true do
4
+ it "should return 'Safari' as its browser" do
5
+ @useragent.browser.should == "Safari"
6
+ end
7
+
8
+ it "should return :strong as its security" do
9
+ @useragent.security.should == :strong
10
+ end
11
+ end
12
+
13
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
14
+ before do
15
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
16
+ end
17
+
18
+ it_should_behave_like "Safari browser"
19
+
20
+ it "should return '526.8' as its build" do
21
+ @useragent.build.should == "526.8"
22
+ end
23
+
24
+ it "should return '4.0dp1' as its version" do
25
+ @useragent.version.should == "4.0dp1"
26
+ end
27
+
28
+ it "should return '526.9' as its webkit version" do
29
+ @useragent.webkit.version.should == "526.9"
30
+ end
31
+
32
+ it "should return 'Macintosh' as its platform" do
33
+ @useragent.platform.should == "Macintosh"
34
+ end
35
+
36
+ it "should return 'Intel Mac OS X 10_5_3' as its os" do
37
+ @useragent.os.should == "Intel Mac OS X 10_5_3"
38
+ end
39
+
40
+ it "should return 'en-us' as its localization" do
41
+ @useragent.localization.should == "en-us"
42
+ end
43
+ end
44
+
45
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
46
+ before do
47
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
48
+ end
49
+
50
+ it_should_behave_like "Safari browser"
51
+
52
+ it "should return '526.8' as its build" do
53
+ @useragent.build.should == "526.8"
54
+ end
55
+
56
+ it "should return '4.0dp1' as its version" do
57
+ @useragent.version.should == "4.0dp1"
58
+ end
59
+
60
+ it "should return '526.9' as its webkit version" do
61
+ @useragent.webkit.version.should == "526.9"
62
+ end
63
+
64
+ it "should return 'Windows' as its platform" do
65
+ @useragent.platform.should == "Windows"
66
+ end
67
+
68
+ it "should return 'Windows XP' as its os" do
69
+ @useragent.os.should == "Windows XP"
70
+ end
71
+
72
+ it "should return 'en' as its localization" do
73
+ @useragent.localization.should == "en"
74
+ end
75
+ end
76
+
77
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
78
+ before do
79
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18")
80
+ end
81
+
82
+ it_should_behave_like "Safari browser"
83
+
84
+ it "should return '525.18' as its build" do
85
+ @useragent.build.should == "525.18"
86
+ end
87
+
88
+ it "should return '3.1.1' as its version" do
89
+ @useragent.version.should == "3.1.1"
90
+ end
91
+
92
+ it "should return '525.18' as its webkit version" do
93
+ @useragent.webkit.version.should == "525.18"
94
+ end
95
+
96
+ it "should return 'Macintosh' as its platform" do
97
+ @useragent.platform.should == "Macintosh"
98
+ end
99
+
100
+ it "should return 'Intel Mac OS X 10_5_3' as its os" do
101
+ @useragent.os.should == "Intel Mac OS X 10_5_3"
102
+ end
103
+
104
+ it "should return 'en-us' as its localization" do
105
+ @useragent.localization.should == "en-us"
106
+ end
107
+
108
+ it "should be == 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
109
+ @useragent.should == @useragent
110
+ end
111
+
112
+ it "should not be == 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
113
+ @useragent.should_not == UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
114
+ end
115
+
116
+ it "should be > 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
117
+ @useragent.should > UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
118
+ end
119
+
120
+ it "should not be > 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
121
+ @useragent.should_not > UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
122
+ end
123
+
124
+ it "should be < 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
125
+ @useragent.should < UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
126
+ end
127
+
128
+ it "should not be < 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
129
+ @useragent.should_not < @useragent
130
+ end
131
+
132
+ it "should be >= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
133
+ @useragent.should >= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
134
+ end
135
+
136
+ it "should not be >= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'" do
137
+ @useragent.should_not >= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8")
138
+ end
139
+
140
+ it "should be <= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
141
+ @useragent.should <= @useragent
142
+ end
143
+
144
+ it "should not be <= 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
145
+ @useragent.should_not <= UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
146
+ end
147
+ end
148
+
149
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18'" do
150
+ before do
151
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18")
152
+ end
153
+
154
+ it_should_behave_like "Safari browser"
155
+
156
+ it "should return '525.18' as its build" do
157
+ @useragent.build.should == "525.18"
158
+ end
159
+
160
+ it "should return '3.1.1' as its version" do
161
+ @useragent.version.should == "3.1.1"
162
+ end
163
+
164
+ it "should return '525.18' as its webkit version" do
165
+ @useragent.webkit.version.should == "525.18"
166
+ end
167
+
168
+ it "should return 'Windows' as its platform" do
169
+ @useragent.platform.should == "Windows"
170
+ end
171
+
172
+ it "should return 'Windows XP' as its os" do
173
+ @useragent.os.should == "Windows XP"
174
+ end
175
+
176
+ it "should return 'en' as its localization" do
177
+ @useragent.localization.should == "en"
178
+ end
179
+ end
180
+
181
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3'" do
182
+ before do
183
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3")
184
+ end
185
+
186
+ it_should_behave_like "Safari browser"
187
+
188
+ it "should return '419.3' as its build" do
189
+ @useragent.build.should == "419.3"
190
+ end
191
+
192
+ it "should return '2.0.4' as its version" do
193
+ @useragent.version.should == "2.0.4"
194
+ end
195
+
196
+ it "should return '419' as its webkit version" do
197
+ @useragent.webkit.version.should == "419"
198
+ end
199
+
200
+ it "should return 'Macintosh' as its platform" do
201
+ @useragent.platform.should == "Macintosh"
202
+ end
203
+
204
+ it "should return 'Intel Mac OS X' as its os" do
205
+ @useragent.os.should == "Intel Mac OS X"
206
+ end
207
+
208
+ it "should return 'en' as its localization" do
209
+ @useragent.localization.should == "en"
210
+ end
211
+ end
212
+
213
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6'" do
214
+ before do
215
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6")
216
+ end
217
+
218
+ it_should_behave_like "Safari browser"
219
+
220
+ it "should return '312.6' as its build" do
221
+ @useragent.build.should == "312.6"
222
+ end
223
+
224
+ it "should return '1.3.2' as its version" do
225
+ @useragent.version.should == "1.3.2"
226
+ end
227
+
228
+ it "should return '312.8' as its webkit version" do
229
+ @useragent.webkit.version.should == "312.8"
230
+ end
231
+
232
+ it "should return 'Macintosh' as its platform" do
233
+ @useragent.platform.should == "Macintosh"
234
+ end
235
+
236
+ it "should return 'PPC Mac OS X' as its os" do
237
+ @useragent.os.should == "PPC Mac OS X"
238
+ end
239
+
240
+ it "should return 'en' as its localization" do
241
+ @useragent.localization.should == "en"
242
+ end
243
+ end
244
+
245
+ describe "UserAgent: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.7 (KHTML, like Gecko) Safari/125.12'" do
246
+ before do
247
+ @useragent = UserAgent.parse("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.7 (KHTML, like Gecko) Safari/125.12")
248
+ end
249
+
250
+ it_should_behave_like "Safari browser"
251
+
252
+ it "should return '125.12' as its build" do
253
+ @useragent.build.should == "125.12"
254
+ end
255
+
256
+ it "should return '1.2.4' as its version" do
257
+ @useragent.version.should == "1.2.4"
258
+ end
259
+
260
+ it "should return '125.5.7' as its webkit version" do
261
+ @useragent.webkit.version.should == "125.5.7"
262
+ end
263
+
264
+ it "should return 'Macintosh' as its platform" do
265
+ @useragent.platform.should == "Macintosh"
266
+ end
267
+
268
+ it "should return 'PPC Mac OS X' as its os" do
269
+ @useragent.os.should == "PPC Mac OS X"
270
+ end
271
+
272
+ it "should return 'en' as its localization" do
273
+ @useragent.localization.should == "en"
274
+ end
275
+ end
276
+
277
+ describe "UserAgent: 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419'" do
278
+ before do
279
+ @useragent = UserAgent.parse("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419")
280
+ end
281
+
282
+ it_should_behave_like "Safari browser"
283
+
284
+ it "should return '419' as its build" do
285
+ @useragent.build.should == "419"
286
+ end
287
+
288
+ it "should return '3.0' as its version" do
289
+ @useragent.version.should == "3.0"
290
+ end
291
+
292
+ it "should return '420.1' as its webkit version" do
293
+ @useragent.webkit.version.should == "420.1"
294
+ end
295
+
296
+ it "should return 'iPhone' as its platform" do
297
+ @useragent.platform.should == "iPhone"
298
+ end
299
+
300
+ it "should return 'CPU like Mac OS X' as its os" do
301
+ @useragent.os.should == "CPU like Mac OS X"
302
+ end
303
+
304
+ it "should return 'en' as its localization" do
305
+ @useragent.localization.should == "en"
306
+ end
307
+ end
308
+
309
+ describe "UserAgent: 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419'" do
310
+ before do
311
+ @useragent = UserAgent.parse("Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419")
312
+ end
313
+
314
+ it_should_behave_like "Safari browser"
315
+
316
+ it "should return '419' as its build" do
317
+ @useragent.build.should == "419"
318
+ end
319
+
320
+ it "should return '3.0' as its version" do
321
+ @useragent.version.should == "3.0"
322
+ end
323
+
324
+ it "should return '420.1' as its webkit version" do
325
+ @useragent.webkit.version.should == "420.1"
326
+ end
327
+
328
+ it "should return 'iPod' as its platform" do
329
+ @useragent.platform.should == "iPod"
330
+ end
331
+
332
+ it "should return 'CPU like Mac OS X' as its os" do
333
+ @useragent.os.should == "CPU like Mac OS X"
334
+ end
335
+
336
+ it "should return 'en' as its localization" do
337
+ @useragent.localization.should == "en"
338
+ end
339
+ end
340
+
341
+ describe "UserAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.0.2 Safari/525.13'" do
342
+ before do
343
+ @useragent = UserAgent.parse("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.0.2 Safari/525.13")
344
+ end
345
+
346
+ it "should return 'Chrome' as its browser" do
347
+ @useragent.browser.should == "Chrome"
348
+ end
349
+
350
+ it "should return '525.13' as its build" do
351
+ @useragent.build.should == "525.13"
352
+ end
353
+
354
+ it "should return '0.0.2' as its version" do
355
+ @useragent.version.should == "0.0.2"
356
+ end
357
+
358
+ it "should return '525.13' as its webkit version" do
359
+ @useragent.webkit.version.should == "525.13"
360
+ end
361
+
362
+ it "should return 'Windows' as its platform" do
363
+ @useragent.platform.should == "Windows"
364
+ end
365
+
366
+ it "should return 'Windows XP' as its os" do
367
+ @useragent.os.should == "Windows XP"
368
+ end
369
+
370
+ it "should return 'en-US' as its localization" do
371
+ @useragent.localization.should == "en-US"
372
+ end
373
+ end