flapjack 0.6.43 → 0.6.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. data/bin/flapjack +4 -2
  2. data/bin/flapjack-nagios-receiver +4 -1
  3. data/bin/flapjack-populator +4 -1
  4. data/etc/flapjack_config.yaml.example +111 -106
  5. data/features/steps/notifications_steps.rb +6 -6
  6. data/lib/flapjack/configuration.rb +76 -24
  7. data/lib/flapjack/coordinator.rb +27 -44
  8. data/lib/flapjack/data/entity.rb +28 -7
  9. data/lib/flapjack/data/entity_check.rb +18 -20
  10. data/lib/flapjack/executive.rb +5 -4
  11. data/lib/flapjack/gateways/api.rb +391 -0
  12. data/lib/flapjack/gateways/api/entity_check_presenter.rb +185 -0
  13. data/lib/flapjack/gateways/api/entity_presenter.rb +70 -0
  14. data/lib/flapjack/gateways/base.rb +38 -0
  15. data/lib/flapjack/{notification → gateways}/email.rb +4 -5
  16. data/lib/flapjack/{notification → gateways}/email/alert.html.haml +0 -0
  17. data/lib/flapjack/{notification → gateways}/email/alert.text.erb +0 -0
  18. data/lib/flapjack/gateways/jabber.rb +387 -0
  19. data/lib/flapjack/gateways/oobetet.rb +241 -0
  20. data/lib/flapjack/gateways/pagerduty.rb +247 -0
  21. data/lib/flapjack/{notification → gateways}/sms.rb +5 -6
  22. data/lib/flapjack/{notification → gateways}/sms/messagenet.rb +1 -1
  23. data/lib/flapjack/gateways/web.rb +293 -0
  24. data/lib/flapjack/{web → gateways/web}/views/_css.haml +0 -0
  25. data/lib/flapjack/{web → gateways/web}/views/_nav.haml +0 -0
  26. data/lib/flapjack/{web → gateways/web}/views/check.haml +0 -0
  27. data/lib/flapjack/{web → gateways/web}/views/contact.haml +0 -0
  28. data/lib/flapjack/{web → gateways/web}/views/contacts.haml +0 -0
  29. data/lib/flapjack/{web → gateways/web}/views/index.haml +0 -0
  30. data/lib/flapjack/{web → gateways/web}/views/self_stats.haml +0 -0
  31. data/lib/flapjack/pikelet.rb +0 -23
  32. data/lib/flapjack/version.rb +1 -1
  33. data/spec/lib/flapjack/coordinator_spec.rb +56 -36
  34. data/spec/lib/flapjack/data/entity_spec.rb +53 -4
  35. data/spec/lib/flapjack/{api → gateways/api}/entity_check_presenter_spec.rb +10 -13
  36. data/spec/lib/flapjack/{api → gateways/api}/entity_presenter_spec.rb +10 -10
  37. data/spec/lib/flapjack/{api_spec.rb → gateways/api_spec.rb} +14 -14
  38. data/spec/lib/flapjack/gateways/email_spec.rb +6 -0
  39. data/spec/lib/flapjack/{jabber_spec.rb → gateways/jabber_spec.rb} +9 -9
  40. data/spec/lib/flapjack/{oobetet_spec.rb → gateways/oobetet_spec.rb} +10 -10
  41. data/spec/lib/flapjack/{pagerduty_spec.rb → gateways/pagerduty_spec.rb} +11 -11
  42. data/spec/lib/flapjack/gateways/sms_spec.rb +6 -0
  43. data/spec/lib/flapjack/{web_spec.rb → gateways/web_spec.rb} +4 -4
  44. metadata +46 -79
  45. data/bin/install-flapjack-systemwide +0 -58
  46. data/features/steps/flapjack-importer_steps.rb +0 -109
  47. data/features/steps/flapjack-worker_steps.rb +0 -68
  48. data/lib/flapjack/api.rb +0 -388
  49. data/lib/flapjack/api/entity_check_presenter.rb +0 -181
  50. data/lib/flapjack/api/entity_presenter.rb +0 -66
  51. data/lib/flapjack/cli/worker_manager.rb +0 -46
  52. data/lib/flapjack/inifile.rb +0 -44
  53. data/lib/flapjack/jabber.rb +0 -383
  54. data/lib/flapjack/notifier_engine.rb +0 -40
  55. data/lib/flapjack/notifiers/mailer/init.rb +0 -3
  56. data/lib/flapjack/notifiers/mailer/mailer.rb +0 -51
  57. data/lib/flapjack/notifiers/xmpp/init.rb +0 -3
  58. data/lib/flapjack/notifiers/xmpp/xmpp.rb +0 -46
  59. data/lib/flapjack/oobetet.rb +0 -240
  60. data/lib/flapjack/pagerduty.rb +0 -242
  61. data/lib/flapjack/web.rb +0 -286
  62. data/spec.old/check_sandbox/echo +0 -3
  63. data/spec.old/check_sandbox/sandboxed_check +0 -5
  64. data/spec.old/configs/flapjack-notifier-couchdb.ini +0 -25
  65. data/spec.old/configs/flapjack-notifier.ini +0 -39
  66. data/spec.old/configs/recipients.ini +0 -14
  67. data/spec.old/helpers.rb +0 -15
  68. data/spec.old/inifile_spec.rb +0 -66
  69. data/spec.old/mock-notifiers/mock/init.rb +0 -3
  70. data/spec.old/mock-notifiers/mock/mock.rb +0 -19
  71. data/spec.old/notifier-directories/spoons/testmailer/init.rb +0 -20
  72. data/spec.old/notifier_application_spec.rb +0 -222
  73. data/spec.old/notifier_filters_spec.rb +0 -52
  74. data/spec.old/notifier_options_multiplexer_spec.rb +0 -71
  75. data/spec.old/notifier_options_spec.rb +0 -115
  76. data/spec.old/notifier_spec.rb +0 -57
  77. data/spec.old/notifiers/mailer_spec.rb +0 -36
  78. data/spec.old/notifiers/xmpp_spec.rb +0 -36
  79. data/spec.old/persistence/datamapper_spec.rb +0 -74
  80. data/spec.old/persistence/mock_persistence_backend.rb +0 -26
  81. data/spec.old/simple.ini +0 -6
  82. data/spec.old/spec.opts +0 -4
  83. data/spec.old/test-filters/blocker.rb +0 -13
  84. data/spec.old/test-filters/mock.rb +0 -13
  85. data/spec.old/transports/beanstalkd_spec.rb +0 -44
  86. data/spec.old/transports/mock_transport.rb +0 -58
  87. data/spec.old/worker_application_spec.rb +0 -62
  88. data/spec.old/worker_options_spec.rb +0 -83
  89. data/spec/lib/flapjack/notification/email_spec.rb +0 -6
  90. data/spec/lib/flapjack/notification/sms_spec.rb +0 -6
@@ -14,6 +14,41 @@ describe Flapjack::Data::Entity, :redis => true do
14
14
  @redis.get("entity_id:#{name}").should == ''
15
15
  end
16
16
 
17
+ it "adds a registered contact with an entity" do
18
+ Flapjack::Data::Contact.add({'id' => '362',
19
+ 'first_name' => 'John',
20
+ 'last_name' => 'Johnson',
21
+ 'email' => 'johnj@example.com' },
22
+ :redis => @redis)
23
+
24
+ Flapjack::Data::Entity.add({'id' => '5000',
25
+ 'name' => name,
26
+ 'contacts' => ['362']},
27
+ :redis => @redis)
28
+
29
+ entity = Flapjack::Data::Entity.find_by_id('5000', :redis => @redis)
30
+ entity.should_not be_nil
31
+ contacts = entity.contacts
32
+ contacts.should_not be_nil
33
+ contacts.should be_an(Array)
34
+ contacts.should have(1).contact
35
+ contacts.first.name.should == 'John Johnson'
36
+ end
37
+
38
+ it "does not add a registered contact with an entity if the contact is unknown" do
39
+ Flapjack::Data::Entity.add({'id' => '5000',
40
+ 'name' => name,
41
+ 'contacts' => ['362']},
42
+ :redis => @redis)
43
+
44
+ entity = Flapjack::Data::Entity.find_by_id('5000', :redis => @redis)
45
+ entity.should_not be_nil
46
+ contacts = entity.contacts
47
+ contacts.should_not be_nil
48
+ contacts.should be_an(Array)
49
+ contacts.should be_empty
50
+ end
51
+
17
52
  it "finds an entity by id" do
18
53
  Flapjack::Data::Entity.add({'id' => '5000',
19
54
  'name' => name},
@@ -35,10 +70,6 @@ describe Flapjack::Data::Entity, :redis => true do
35
70
  end
36
71
 
37
72
  it "returns a list of all entities" do
38
-
39
- pending "Broken with redis 2.6, which changes the default ordering. " +
40
- "I have a fix for this in another branch, will handle on merge."
41
-
42
73
  Flapjack::Data::Entity.add({'id' => '5000',
43
74
  'name' => name},
44
75
  :redis => @redis)
@@ -86,4 +117,22 @@ describe Flapjack::Data::Entity, :redis => true do
86
117
  check_count.should == 2
87
118
  end
88
119
 
120
+ it "finds entity names matching a pattern" do
121
+ Flapjack::Data::Entity.add({'id' => '5000',
122
+ 'name' => 'abc-123',
123
+ 'contacts' => []},
124
+ :redis => @redis)
125
+
126
+ Flapjack::Data::Entity.add({'id' => '5001',
127
+ 'name' => 'def-456',
128
+ 'contacts' => []},
129
+ :redis => @redis)
130
+
131
+ entities = Flapjack::Data::Entity.find_all_name_matching('abc', :redis => @redis)
132
+ entities.should_not be_nil
133
+ entities.should be_an(Array)
134
+ entities.should have(1).entity
135
+ entities.first.should == 'abc-123'
136
+ end
137
+
89
138
  end
@@ -1,10 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'flapjack/api/entity_check_presenter'
2
+ require 'flapjack/gateways/api/entity_check_presenter'
3
3
 
4
- # require 'flapjack/data/entity'
5
- # require 'flapjack/data/entity_check'
6
-
7
- describe 'Flapjack::API::EntityCheck::Presenter' do
4
+ describe 'Flapjack::Gateways::API::EntityCheck::Presenter' do
8
5
 
9
6
  let(:entity_check) { mock(Flapjack::Data::EntityCheck) }
10
7
 
@@ -47,7 +44,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
47
44
  entity_check.should_receive(:historical_state_before).
48
45
  with(time - (4 * 60 * 60)).and_return(nil)
49
46
 
50
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
47
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
51
48
  outages = ecp.outages(time - (5 * 60 * 60), time - (2 * 60 * 60))
52
49
  outages.should_not be_nil
53
50
  outages.should be_an(Array)
@@ -63,7 +60,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
63
60
  entity_check.should_receive(:historical_state_before).
64
61
  with(time - (4 * 60 * 60)).and_return(nil)
65
62
 
66
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
63
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
67
64
  outages = ecp.outages(nil, nil)
68
65
  outages.should_not be_nil
69
66
  outages.should be_an(Array)
@@ -78,7 +75,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
78
75
  entity_check.should_receive(:historical_state_before).
79
76
  with(time - (4 * 60 * 60)).and_return(nil)
80
77
 
81
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
78
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
82
79
  outages = ecp.outages(nil, nil)
83
80
  outages.should_not be_nil
84
81
  outages.should be_an(Array)
@@ -92,7 +89,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
92
89
  entity_check.should_receive(:maintenances).
93
90
  with(nil, time - (12 * 60 * 60), :scheduled => false).and_return([])
94
91
 
95
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
92
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
96
93
  unsched_maint = ecp.unscheduled_maintenance(time - (12 * 60 * 60), time)
97
94
 
98
95
  unsched_maint.should be_an(Array)
@@ -108,7 +105,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
108
105
  entity_check.should_receive(:maintenances).
109
106
  with(nil, time - (12 * 60 * 60), :scheduled => true).and_return([])
110
107
 
111
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
108
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
112
109
  sched_maint = ecp.scheduled_maintenance(time - (12 * 60 * 60), time)
113
110
 
114
111
  sched_maint.should be_an(Array)
@@ -130,7 +127,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
130
127
  entity_check.should_receive(:maintenances).
131
128
  with(nil, time - (12 * 60 * 60), :scheduled => true).and_return([])
132
129
 
133
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
130
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
134
131
  downtimes = ecp.downtime(time - (12 * 60 * 60), time)
135
132
 
136
133
  # 22 minutes, 3 + 8 + 11
@@ -155,7 +152,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
155
152
  entity_check.should_receive(:maintenances).
156
153
  with(nil, nil, :scheduled => true).and_return(maintenances)
157
154
 
158
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
155
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
159
156
  downtimes = ecp.downtime(nil, nil)
160
157
 
161
158
  # 22 minutes, 3 + 8 + 11
@@ -182,7 +179,7 @@ describe 'Flapjack::API::EntityCheck::Presenter' do
182
179
  entity_check.should_receive(:maintenances).
183
180
  with(nil, nil, :scheduled => true).and_return([])
184
181
 
185
- ecp = Flapjack::API::EntityCheckPresenter.new(entity_check)
182
+ ecp = Flapjack::Gateways::API::EntityCheckPresenter.new(entity_check)
186
183
  downtimes = ecp.downtime(nil, nil)
187
184
 
188
185
  downtimes.should be_a(Hash)
@@ -1,15 +1,15 @@
1
1
  require 'spec_helper'
2
- require 'flapjack/api/entity_presenter'
2
+ require 'flapjack/gateways/api/entity_presenter'
3
3
 
4
- describe 'Flapjack::API::Entity::Presenter' do
4
+ describe 'Flapjack::Gateways::API::Entity::Presenter' do
5
5
 
6
6
  let(:entity) { mock(Flapjack::Data::Entity) }
7
7
 
8
8
  let(:check_a) { mock(Flapjack::Data::EntityCheck) }
9
9
  let(:check_b) { mock(Flapjack::Data::EntityCheck) }
10
10
 
11
- let(:checkpres_a) { mock(Flapjack::API::EntityCheckPresenter) }
12
- let(:checkpres_b) { mock(Flapjack::API::EntityCheckPresenter) }
11
+ let(:checkpres_a) { mock(Flapjack::Gateways::API::EntityCheckPresenter) }
12
+ let(:checkpres_b) { mock(Flapjack::Gateways::API::EntityCheckPresenter) }
13
13
 
14
14
  let(:time) { Time.now.to_i }
15
15
 
@@ -23,9 +23,9 @@ describe 'Flapjack::API::Entity::Presenter' do
23
23
  Flapjack::Data::EntityCheck.should_receive(:for_entity).
24
24
  with(entity, 'ping', anything).and_return(check_b)
25
25
 
26
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
26
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
27
27
  with(check_a).and_return(checkpres_a)
28
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
28
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
29
29
  with(check_b).and_return(checkpres_b)
30
30
  end
31
31
 
@@ -38,7 +38,7 @@ describe 'Flapjack::API::Entity::Presenter' do
38
38
  checkpres_b.should_receive(:outages).with(start_time, end_time).
39
39
  and_return(outages_b)
40
40
 
41
- ep = Flapjack::API::EntityPresenter.new(entity)
41
+ ep = Flapjack::Gateways::API::EntityPresenter.new(entity)
42
42
  outages = ep.outages(start_time, end_time)
43
43
  outages.should == [{:check => 'ssh', :outages => outages_a},
44
44
  {:check => 'ping', :outages => outages_b}]
@@ -53,7 +53,7 @@ describe 'Flapjack::API::Entity::Presenter' do
53
53
  checkpres_b.should_receive(:unscheduled_maintenance).with(start_time, end_time).
54
54
  and_return(unsched_maint_b)
55
55
 
56
- ep = Flapjack::API::EntityPresenter.new(entity)
56
+ ep = Flapjack::Gateways::API::EntityPresenter.new(entity)
57
57
  unsched_maint = ep.unscheduled_maintenance(start_time, end_time)
58
58
  unsched_maint.should == [{:check => 'ssh', :unscheduled_maintenance => unsched_maint_a},
59
59
  {:check => 'ping', :unscheduled_maintenance => unsched_maint_b}]
@@ -68,7 +68,7 @@ describe 'Flapjack::API::Entity::Presenter' do
68
68
  checkpres_b.should_receive(:scheduled_maintenance).with(start_time, end_time).
69
69
  and_return(sched_maint_b)
70
70
 
71
- ep = Flapjack::API::EntityPresenter.new(entity)
71
+ ep = Flapjack::Gateways::API::EntityPresenter.new(entity)
72
72
  sched_maint = ep.scheduled_maintenance(start_time, end_time)
73
73
  sched_maint.should == [{:check => 'ssh', :scheduled_maintenance => sched_maint_a},
74
74
  {:check => 'ping', :scheduled_maintenance => sched_maint_b}]
@@ -83,7 +83,7 @@ describe 'Flapjack::API::Entity::Presenter' do
83
83
  checkpres_b.should_receive(:downtime).with(start_time, end_time).
84
84
  and_return(downtime_b)
85
85
 
86
- ep = Flapjack::API::EntityPresenter.new(entity)
86
+ ep = Flapjack::Gateways::API::EntityPresenter.new(entity)
87
87
  downtime = ep.downtime(start_time, end_time)
88
88
  downtime.should == [{:check => 'ssh', :downtime => downtime_a},
89
89
  {:check => 'ping', :downtime => downtime_b}]
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
- require 'flapjack/api'
2
+ require 'flapjack/gateways/api'
3
3
 
4
- describe 'Flapjack::API', :sinatra => true do
4
+ describe 'Flapjack::Gateways::API', :sinatra => true do
5
5
 
6
6
  def app
7
- Flapjack::API
7
+ Flapjack::Gateways::API
8
8
  end
9
9
 
10
10
  let(:entity) { mock(Flapjack::Data::Entity) }
@@ -14,14 +14,14 @@ describe 'Flapjack::API', :sinatra => true do
14
14
  let(:entity_name_esc) { URI.escape(entity_name) }
15
15
  let(:check) { 'ping' }
16
16
 
17
- let(:entity_presenter) { mock(Flapjack::API::EntityPresenter) }
18
- let(:entity_check_presenter) { mock(Flapjack::API::EntityCheckPresenter) }
17
+ let(:entity_presenter) { mock(Flapjack::Gateways::API::EntityPresenter) }
18
+ let(:entity_check_presenter) { mock(Flapjack::Gateways::API::EntityCheckPresenter) }
19
19
 
20
20
  let(:redis) { mock(::Redis) }
21
21
 
22
22
  before(:each) do
23
23
  Flapjack::RedisPool.should_receive(:new).and_return(redis)
24
- Flapjack::API.bootstrap(:config => {})
24
+ Flapjack::Gateways::API.bootstrap(:config => {})
25
25
  end
26
26
 
27
27
  it "returns a list of checks for an entity" do
@@ -40,7 +40,7 @@ describe 'Flapjack::API', :sinatra => true do
40
40
  result_json = %q{"result"}
41
41
  result.should_receive(:to_json).and_return(result_json)
42
42
  entity_presenter.should_receive(:scheduled_maintenance).with(nil, nil).and_return(result)
43
- Flapjack::API::EntityPresenter.should_receive(:new).
43
+ Flapjack::Gateways::API::EntityPresenter.should_receive(:new).
44
44
  with(entity, :redis => redis).and_return(entity_presenter)
45
45
  Flapjack::Data::Entity.should_receive(:find_by_name).
46
46
  with(entity_name, :redis => redis).and_return(entity)
@@ -68,7 +68,7 @@ describe 'Flapjack::API', :sinatra => true do
68
68
  result_json = %q{"result"}
69
69
  result.should_receive(:to_json).and_return(result_json)
70
70
  entity_check_presenter.should_receive(:scheduled_maintenance).with(nil, nil).and_return(result)
71
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
71
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
72
72
  with(entity_check).and_return(entity_check_presenter)
73
73
  Flapjack::Data::Entity.should_receive(:find_by_name).
74
74
  with(entity_name, :redis => redis).and_return(entity)
@@ -85,7 +85,7 @@ describe 'Flapjack::API', :sinatra => true do
85
85
  result_json = %q{"result"}
86
86
  result.should_receive(:to_json).and_return(result_json)
87
87
  entity_presenter.should_receive(:unscheduled_maintenance).with(nil, nil).and_return(result)
88
- Flapjack::API::EntityPresenter.should_receive(:new).
88
+ Flapjack::Gateways::API::EntityPresenter.should_receive(:new).
89
89
  with(entity, :redis => redis).and_return(entity_presenter)
90
90
  Flapjack::Data::Entity.should_receive(:find_by_name).
91
91
  with(entity_name, :redis => redis).and_return(entity)
@@ -100,7 +100,7 @@ describe 'Flapjack::API', :sinatra => true do
100
100
  result_json = %q{"result"}
101
101
  result.should_receive(:to_json).and_return(result_json)
102
102
  entity_check_presenter.should_receive(:unscheduled_maintenance).with(nil, nil).and_return(result)
103
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
103
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
104
104
  with(entity_check).and_return(entity_check_presenter)
105
105
  Flapjack::Data::Entity.should_receive(:find_by_name).
106
106
  with(entity_name, :redis => redis).and_return(entity)
@@ -120,7 +120,7 @@ describe 'Flapjack::API', :sinatra => true do
120
120
  result_json = %q{"result"}
121
121
  result.should_receive(:to_json).and_return(result_json)
122
122
  entity_presenter.should_receive(:outages).with(nil, nil).and_return(result)
123
- Flapjack::API::EntityPresenter.should_receive(:new).
123
+ Flapjack::Gateways::API::EntityPresenter.should_receive(:new).
124
124
  with(entity, :redis => redis).and_return(entity_presenter)
125
125
  Flapjack::Data::Entity.should_receive(:find_by_name).
126
126
  with(entity_name, :redis => redis).and_return(entity)
@@ -135,7 +135,7 @@ describe 'Flapjack::API', :sinatra => true do
135
135
  result_json = %q{"result"}
136
136
  result.should_receive(:to_json).and_return(result_json)
137
137
  entity_check_presenter.should_receive(:outages).with(nil, nil).and_return(result)
138
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
138
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
139
139
  with(entity_check).and_return(entity_check_presenter)
140
140
  Flapjack::Data::Entity.should_receive(:find_by_name).
141
141
  with(entity_name, :redis => redis).and_return(entity)
@@ -152,7 +152,7 @@ describe 'Flapjack::API', :sinatra => true do
152
152
  result_json = %q{"result"}
153
153
  result.should_receive(:to_json).and_return(result_json)
154
154
  entity_presenter.should_receive(:downtime).with(nil, nil).and_return(result)
155
- Flapjack::API::EntityPresenter.should_receive(:new).
155
+ Flapjack::Gateways::API::EntityPresenter.should_receive(:new).
156
156
  with(entity, :redis => redis).and_return(entity_presenter)
157
157
  Flapjack::Data::Entity.should_receive(:find_by_name).
158
158
  with(entity_name, :redis => redis).and_return(entity)
@@ -167,7 +167,7 @@ describe 'Flapjack::API', :sinatra => true do
167
167
  result_json = %q{"result"}
168
168
  result.should_receive(:to_json).and_return(result_json)
169
169
  entity_check_presenter.should_receive(:downtime).with(nil, nil).and_return(result)
170
- Flapjack::API::EntityCheckPresenter.should_receive(:new).
170
+ Flapjack::Gateways::API::EntityCheckPresenter.should_receive(:new).
171
171
  with(entity_check).and_return(entity_check_presenter)
172
172
  Flapjack::Data::Entity.should_receive(:find_by_name).
173
173
  with(entity_name, :redis => redis).and_return(entity)
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+ require 'flapjack/gateways/email'
3
+
4
+ describe Flapjack::Gateways::Email do
5
+
6
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'flapjack/jabber'
2
+ require 'flapjack/gateways/jabber'
3
3
 
4
- describe Flapjack::Jabber do
4
+ describe Flapjack::Gateways::Jabber do
5
5
 
6
6
  let(:config) { {'queue' => 'jabber_notifications',
7
7
  'server' => 'example.com',
@@ -18,7 +18,7 @@ describe Flapjack::Jabber do
18
18
  it "hooks up event handlers to the appropriate methods" do
19
19
  Socket.should_receive(:gethostname).and_return('thismachine')
20
20
 
21
- fj = Flapjack::Jabber.new
21
+ fj = Flapjack::Gateways::Jabber.new
22
22
  Flapjack::RedisPool.should_receive(:new)
23
23
  fj.bootstrap(:config => config)
24
24
 
@@ -40,7 +40,7 @@ describe Flapjack::Jabber do
40
40
  end
41
41
 
42
42
  it "joins a chat room after connecting" do
43
- fj = Flapjack::Jabber.new
43
+ fj = Flapjack::Gateways::Jabber.new
44
44
  Flapjack::RedisPool.should_receive(:new).twice
45
45
  fj.bootstrap(:config => config)
46
46
 
@@ -72,7 +72,7 @@ describe Flapjack::Jabber do
72
72
  with('main-example.com:ping', :redis => redis).
73
73
  and_return(entity_check)
74
74
 
75
- fj = Flapjack::Jabber.new
75
+ fj = Flapjack::Gateways::Jabber.new
76
76
  Flapjack::RedisPool.should_receive(:new)
77
77
  fj.bootstrap(:config => config)
78
78
  fj.instance_variable_set('@redis_handler', redis)
@@ -89,7 +89,7 @@ describe Flapjack::Jabber do
89
89
  from.should_receive(:stripped).and_return('sender')
90
90
  stanza.should_receive(:from).and_return(from)
91
91
 
92
- fj = Flapjack::Jabber.new
92
+ fj = Flapjack::Gateways::Jabber.new
93
93
  Flapjack::RedisPool.should_receive(:new)
94
94
  fj.bootstrap(:config => config)
95
95
 
@@ -100,7 +100,7 @@ describe Flapjack::Jabber do
100
100
  end
101
101
 
102
102
  it "reconnects when disconnected (if not quitting)" do
103
- fj = Flapjack::Jabber.new
103
+ fj = Flapjack::Gateways::Jabber.new
104
104
  Flapjack::RedisPool.should_receive(:new)
105
105
  fj.bootstrap(:config => config)
106
106
 
@@ -115,7 +115,7 @@ describe Flapjack::Jabber do
115
115
  redis = mock('redis')
116
116
  redis.should_receive(:rpush).with('jabber_notifications', %q{{"notification_type":"shutdown"}})
117
117
 
118
- fj = Flapjack::Jabber.new
118
+ fj = Flapjack::Gateways::Jabber.new
119
119
  Flapjack::RedisPool.should_receive(:new)
120
120
  fj.bootstrap(:config => config)
121
121
 
@@ -133,7 +133,7 @@ describe Flapjack::Jabber do
133
133
  redis = mock('redis')
134
134
  redis.should_receive(:empty!)
135
135
 
136
- fj = Flapjack::Jabber.new
136
+ fj = Flapjack::Gateways::Jabber.new
137
137
  Flapjack::RedisPool.should_receive(:new).and_return(redis)
138
138
  fj.bootstrap(:config => config)
139
139
  fj.should_receive(:register_handler).exactly(4).times
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'flapjack/oobetet'
2
+ require 'flapjack/gateways/oobetet'
3
3
 
4
- describe Flapjack::Oobetet do
4
+ describe Flapjack::Gateways::Oobetet do
5
5
 
6
6
  let(:config) { {'server' => 'example.com',
7
7
  'port' => '5222',
@@ -19,7 +19,7 @@ describe Flapjack::Oobetet do
19
19
  it "raises an error if a required config setting is not set" do
20
20
  Socket.should_receive(:gethostname).and_return('thismachine')
21
21
 
22
- fo = Flapjack::Oobetet.new
22
+ fo = Flapjack::Gateways::Oobetet.new
23
23
  fo.bootstrap(:config => config.delete('watched_check'))
24
24
 
25
25
  lambda {
@@ -28,7 +28,7 @@ describe Flapjack::Oobetet do
28
28
  end
29
29
 
30
30
  it "hooks up event handlers to the appropriate methods" do
31
- fo = Flapjack::Oobetet.new
31
+ fo = Flapjack::Gateways::Oobetet.new
32
32
  fo.bootstrap(:config => config)
33
33
 
34
34
  EventMachine::Synchrony.should_receive(:next_tick).exactly(3).times.and_yield
@@ -46,7 +46,7 @@ describe Flapjack::Oobetet do
46
46
  end
47
47
 
48
48
  it "joins a chat room after connecting" do
49
- fo = Flapjack::Oobetet.new
49
+ fo = Flapjack::Gateways::Oobetet.new
50
50
  fo.bootstrap(:config => config)
51
51
 
52
52
  fo.should_receive(:write).with(an_instance_of(Blather::Stanza::Presence))
@@ -56,7 +56,7 @@ describe Flapjack::Oobetet do
56
56
  end
57
57
 
58
58
  it "reconnects when disconnected (if not quitting)" do
59
- fo = Flapjack::Oobetet.new
59
+ fo = Flapjack::Gateways::Oobetet.new
60
60
  fo.bootstrap(:config => config)
61
61
 
62
62
  EventMachine::Timer.should_receive(:new).with(1).and_yield
@@ -67,7 +67,7 @@ describe Flapjack::Oobetet do
67
67
  end
68
68
 
69
69
  it "records times of a problem status messages" do
70
- fo = Flapjack::Oobetet.new
70
+ fo = Flapjack::Gateways::Oobetet.new
71
71
  fo.bootstrap(:config => config)
72
72
 
73
73
  fo.setup
@@ -85,7 +85,7 @@ describe Flapjack::Oobetet do
85
85
  end
86
86
 
87
87
  it "records times of a recovery status messages" do
88
- fo = Flapjack::Oobetet.new
88
+ fo = Flapjack::Gateways::Oobetet.new
89
89
  fo.bootstrap(:config => config)
90
90
 
91
91
  fo.setup
@@ -103,7 +103,7 @@ describe Flapjack::Oobetet do
103
103
  end
104
104
 
105
105
  it "records times of an acknowledgement status messages" do
106
- fo = Flapjack::Oobetet.new
106
+ fo = Flapjack::Gateways::Oobetet.new
107
107
  fo.bootstrap(:config => config)
108
108
 
109
109
  fo.setup
@@ -125,7 +125,7 @@ describe Flapjack::Oobetet do
125
125
  timer.should_receive(:cancel)
126
126
  EM::Synchrony.should_receive(:add_periodic_timer).with(60).and_return(timer)
127
127
 
128
- fo = Flapjack::Oobetet.new
128
+ fo = Flapjack::Gateways::Oobetet.new
129
129
  fo.bootstrap(:config => config)
130
130
  fo.should_receive(:register_handler).exactly(3).times
131
131