issue #56 - make topology class configure statement optional
This commit is contained in:
parent
2926dc55ff
commit
f7da4e1d99
|
@ -127,8 +127,14 @@ module RedStorm
|
||||||
self.components << bolt
|
self.components << bolt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# hook into the class lifecycle "inherited" method to automatically set the
|
||||||
|
# topology class into the Configuration object.
|
||||||
|
# this now makes the topology configure block optional.
|
||||||
|
def self.inherited(subclass)
|
||||||
|
Configuration.topology_class = subclass
|
||||||
|
end
|
||||||
|
|
||||||
def self.configure(name = nil, &configure_block)
|
def self.configure(name = nil, &configure_block)
|
||||||
Configuration.topology_class = self
|
|
||||||
@topology_name = name if name
|
@topology_name = name if name
|
||||||
@configure_block = configure_block if block_given?
|
@configure_block = configure_block if block_given?
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,6 +32,10 @@ describe RedStorm::SimpleTopology do
|
||||||
Topology1.topology_name.should == "topology1"
|
Topology1.topology_name.should == "topology1"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should set topology class in Configuration object" do
|
||||||
|
class UnconfiguredTopology < RedStorm::SimpleTopology; end
|
||||||
|
RedStorm::Configuration.topology_class.name.should == "UnconfiguredTopology"
|
||||||
|
end
|
||||||
|
|
||||||
describe "interface" do
|
describe "interface" do
|
||||||
it "should implement topology proxy" do
|
it "should implement topology proxy" do
|
||||||
|
|
Loading…
Reference in New Issue