summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/indirector/rest.rb8
-rw-r--r--lib/puppet/indirector/rest/node.rb6
-rw-r--r--lib/puppet/network/rest_controller.rb2
-rw-r--r--lib/puppet/network/rest_server.rb2
-rwxr-xr-xspec/unit/indirector/rest.rb30
-rwxr-xr-xspec/unit/indirector/rest/node.rb13
-rw-r--r--spec/unit/network/rest_controller.rb14
-rw-r--r--spec/unit/network/rest_server.rb37
8 files changed, 112 insertions, 0 deletions
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb
new file mode 100644
index 000000000..8d51aff09
--- /dev/null
+++ b/lib/puppet/indirector/rest.rb
@@ -0,0 +1,8 @@
+require 'puppet/indirector/rest'
+
+# Access objects via REST
+class Puppet::Indirector::REST < Puppet::Indirector::Terminus
+ def find(name)
+ indirection.model.new(name)
+ end
+end
diff --git a/lib/puppet/indirector/rest/node.rb b/lib/puppet/indirector/rest/node.rb
new file mode 100644
index 000000000..ce809f77a
--- /dev/null
+++ b/lib/puppet/indirector/rest/node.rb
@@ -0,0 +1,6 @@
+require 'puppet/indirector/rest'
+
+class Puppet::Indirector::REST::Node < Puppet::Indirector::REST
+ desc "TODO: FIXME"
+ # TODO/FIXME
+end
diff --git a/lib/puppet/network/rest_controller.rb b/lib/puppet/network/rest_controller.rb
new file mode 100644
index 000000000..76a9830ea
--- /dev/null
+++ b/lib/puppet/network/rest_controller.rb
@@ -0,0 +1,2 @@
+class Puppet::Network::RESTController # :nodoc:
+end
diff --git a/lib/puppet/network/rest_server.rb b/lib/puppet/network/rest_server.rb
new file mode 100644
index 000000000..e415e8bcb
--- /dev/null
+++ b/lib/puppet/network/rest_server.rb
@@ -0,0 +1,2 @@
+class Puppet::Network::RESTServer # :nodoc:
+end
diff --git a/spec/unit/indirector/rest.rb b/spec/unit/indirector/rest.rb
new file mode 100755
index 000000000..cf29577b9
--- /dev/null
+++ b/spec/unit/indirector/rest.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+require 'puppet/indirector/rest'
+
+describe Puppet::Indirector::REST do
+ # FIXME : TODO / look through this, does this make sense?
+ before do
+ Puppet::Indirector::Terminus.stubs(:register_terminus_class)
+ @model = mock 'model'
+ @indirection = stub 'indirection', :name => :mystuff, :register_terminus_type => nil, :model => @model
+ Puppet::Indirector::Indirection.stubs(:instance).returns(@indirection)
+
+ @rest_class = Class.new(Puppet::Indirector::REST) do
+ def self.to_s
+ "Testing"
+ end
+ end
+
+ @searcher = @rest_class.new
+ end
+
+ it "should return an instance of the indirected model"
+ it "should deserialize result data after a call into a Model instance for find"
+ it "should deserialize result data after a call into a list of Model instances for search"
+ it "should deserialize result data after a call into a boolean for save"
+ it "should deserialize result data after a call into a boolean for destroy"
+ it "should generate an error when result data deserializes improperly"
+ it "should generate an error when result data specifies an error"
+end
diff --git a/spec/unit/indirector/rest/node.rb b/spec/unit/indirector/rest/node.rb
new file mode 100755
index 000000000..c78556ada
--- /dev/null
+++ b/spec/unit/indirector/rest/node.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+require 'puppet/indirector/rest/node'
+
+describe Puppet::Indirector::REST::Node do
+ before do
+ @searcher = Puppet::Indirector::REST::Node.new
+ end
+
+
+end
diff --git a/spec/unit/network/rest_controller.rb b/spec/unit/network/rest_controller.rb
new file mode 100644
index 000000000..86bdd8b58
--- /dev/null
+++ b/spec/unit/network/rest_controller.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+#
+# Created by Rick Bradley on 2007-10-03.
+# Copyright (c) 2007. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/network/rest_controller'
+
+describe Puppet::Network::RESTController, "in general" do
+ it "should take arguments from server, call the appropriate method with correct arguments (parameter passing)"
+ it "should serialize result data when methods are handled"
+ it "should serialize an error condition when indirection method call generates an exception"
+end
diff --git a/spec/unit/network/rest_server.rb b/spec/unit/network/rest_server.rb
new file mode 100644
index 000000000..156e11b08
--- /dev/null
+++ b/spec/unit/network/rest_server.rb
@@ -0,0 +1,37 @@
+#!/usr/bin/env ruby
+#
+# Created by Rick Bradley on 2007-10-03.
+# Copyright (c) 2007. All rights reserved.
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+require 'puppet/network/rest_server'
+
+describe Puppet::Network::RESTServer, "in general" do
+ it "should provide a way to specify that an indirection is to be made accessible to clients"
+ it "should provide a way to specify that an indirection is to no longer be made accessible to clients"
+end
+
+describe Puppet::Network::RESTServer, "when listening is not turned on" do
+ it "should allow picking which technology to use to make indirections accessible to clients"
+ it "should allow listening to be turned on"
+ it "should not allow listening to be turned off"
+ it "should not route HTTP GET requests on indirector's name to indirector find for the specified technology"
+ it "should not route HTTP GET requests on indirector's plural name to indirector search for the specified technology"
+ it "should not route HTTP DELETE requests on indirector's name to indirector destroy for the specified technology"
+ it "should not route HTTP POST requests on indirector's name to indirector save for the specified technology"
+
+ # TODO: FIXME write integrations which fire up actual webrick / mongrel servers and are thus webrick / mongrel specific?]
+end
+
+describe Puppet::Network::RESTServer, "when listening is turned on" do
+ it "should not allow picking which technology to use to make indirections accessible to clients"
+ it "should allow listening to be turned off"
+ it "should not allow listening to be turned on"
+ it "should route HTTP GET requests on indirector's name to indirector find for the specified technology"
+ it "should route HTTP GET requests on indirector's plural name to indirector search for the specified technology"
+ it "should route HTTP DELETE requests on indirector's name to indirector destroy for the specified technology"
+ it "should route HTTP POST requests on indirector's name to indirector save for the specified technology"
+
+ # TODO: FIXME [ write integrations which fire up actual webrick / mongrel servers and are thus webrick / mongrel specific?]
+end