Class: Moqueue::MockBroker

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/moqueue/mock_broker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMockBroker

Returns a new instance of MockBroker.



9
10
11
# File 'lib/moqueue/mock_broker.rb', line 9

def initialize
  reset!
end

Instance Attribute Details

#registered_queuesObject (readonly)

Returns the value of attribute registered_queues.



7
8
9
# File 'lib/moqueue/mock_broker.rb', line 7

def registered_queues
  @registered_queues
end

Instance Method Details

#find_direct_exchange(name) ⇒ Object



32
33
34
# File 'lib/moqueue/mock_broker.rb', line 32

def find_direct_exchange(name)
  @registered_direct_exchanges[name]
end

#find_fanout_exchange(fanout_name) ⇒ Object



48
49
50
# File 'lib/moqueue/mock_broker.rb', line 48

def find_fanout_exchange(fanout_name)
  @registered_fanout_exchanges[fanout_name]
end

#find_queue(name) ⇒ Object



20
21
22
# File 'lib/moqueue/mock_broker.rb', line 20

def find_queue(name)
  @registered_queues[name]
end

#find_topic_exchange(topic) ⇒ Object



40
41
42
# File 'lib/moqueue/mock_broker.rb', line 40

def find_topic_exchange(topic)
  @registered_topic_exchanges[topic]
end

#register_direct_exchange(exchange) ⇒ Object



28
29
30
# File 'lib/moqueue/mock_broker.rb', line 28

def register_direct_exchange(exchange)
  @registered_direct_exchanges[exchange.direct] = exchange
end

#register_fanout_exchange(exchange) ⇒ Object



44
45
46
# File 'lib/moqueue/mock_broker.rb', line 44

def register_fanout_exchange(exchange)
  @registered_fanout_exchanges[exchange.fanout] = exchange
end

#register_queue(queue) ⇒ Object



24
25
26
# File 'lib/moqueue/mock_broker.rb', line 24

def register_queue(queue)
  @registered_queues[queue.name] = queue
end

#register_topic_exchange(exchange) ⇒ Object



36
37
38
# File 'lib/moqueue/mock_broker.rb', line 36

def register_topic_exchange(exchange)
  @registered_topic_exchanges[exchange.topic] = exchange
end

#reset!Object



13
14
15
16
17
18
# File 'lib/moqueue/mock_broker.rb', line 13

def reset!
  @registered_queues = {}
  @registered_direct_exchanges = {}
  @registered_topic_exchanges = {}
  @registered_fanout_exchanges = {}
end