Permalink
Browse files

Updating Cucub::Configuration

  • Loading branch information...
1 parent c6bbb65 commit 28fa7ce4faf911f7a3a78087a84753f5424bebb7 @krakatoa krakatoa committed Oct 22, 2012
Showing with 97 additions and 0 deletions.
  1. +26 −0 config/protocol.ini
  2. +3 −0 lib/dispatcher.rb
  3. +51 −0 spec/configuration_spec.rb
  4. +17 −0 spec/spec_helper.rb
View
@@ -0,0 +1,26 @@
+[engine]
+ role = receiver
+ default_uses = mailbox
+ serialize = msgpack
+ compression = gzip
+; cp = 1425
+
+[engine#create_vps]
+ from = core
+ respond_to = class+object
+ uses_board = true
+ serialize = none
+ read_by = core
+
+[agent]
+ default_uses = board
+ role = emitter
+
+[agent#metric]
+ serialize = none
+
+[agent#adelantar_metric]
+ from = trigger
+; respond_to = broadcast
+ respond_to = box
+ read_by = monitor
View
@@ -31,6 +31,9 @@ def start(block=nil)
end
@ipc_get = Cucub::Channel.ipc_get
=end
+ if Cucub::Configuration.uses.include? ("box")
+ @box = Cucub::Channel.reply
+ end
####
=begin
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+describe Cucub::Configuration do
+ describe "#uses" do
+ subject { Cucub::Configuration.instance }
+ context "when parsing a valid config" do
+ #before { subject.set_path(@filepath + "/mock/protocol.ini") }
+ it { subject.uses.should be_a Array }
+ end
+
+=begin
+ it "should return a valid SpecificationSet" do
+ @loader = Cucub::Protocol::Loader.instance
+ @loader.set_path(@filepath + "/mock/protocol.ini")
+ specification_set = @loader.parse
+ specification_set.object_specifications.each {|obj_spec|
+ puts "object: #{obj_spec.class_name}"
+ puts "serialize: #{obj_spec.serialize}"
+ obj_spec.action_specifications.each {|act|
+ puts "\taction: #{act.action_name}"
+ puts "\tserialize: #{act.serialize}"
+ }
+ puts "\n"
+ #puts obj_spec.inspect
+ }
+ end
+=end
+
+=begin
+ it "should return a valid SpecificationSet" do
+ @loader = Cucub::Protocol::Loader.instance
+ @loader.set_path(@filepath + "/mock/protocol.ini")
+ specification_set = @loader.parse
+ specification_set.object_specifications.each {|obj_spec|
+ puts "object: #{obj_spec.class_name}"
+ puts "uses box: #{obj_spec.uses_box}"
+ puts "uses mailbox: #{obj_spec.uses_mailbox}"
+ puts "uses board: #{obj_spec.uses_board}"
+ obj_spec.action_specifications.each {|act|
+ puts "\taction: #{act.action_name}"
+ puts "\tuses box: #{act.uses_box}"
+ puts "\tuses mailbox: #{act.uses_mailbox}"
+ puts "\tuses board: #{act.uses_board}"
+ }
+ puts "\n"
+ #puts obj_spec.inspect
+ }
+ end
+=end
+ end
+end
View
@@ -0,0 +1,17 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+require 'rspec'
+
+require 'bundler'
+Bundler.require(:default, :development)
+
+Dir["#{File.dirname(__FILE__)}/../lib/*.rb"].each {|f| require f}
+#Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each {|f| require f}
+
+# Requires supporting files with custom matchers and macros, etc,
+# in ./support/ and its subdirectories.
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+
+RSpec.configure do |config|
+
+end

0 comments on commit 28fa7ce

Please sign in to comment.