From 6e8112123129253e58cf5bc90250daa9e708a70e Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Tue, 4 Jan 2011 14:07:46 -0800 Subject: [PATCH] rename Easy API to Direct API --- bin/{nova-easy-api => nova-direct-api} | 20 +++++------ .../{easy_unittest.py => test_direct.py} | 36 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) rename bin/{nova-easy-api => nova-direct-api} (75%) rename nova/tests/{easy_unittest.py => test_direct.py} (77%) diff --git a/bin/nova-easy-api b/bin/nova-direct-api similarity index 75% rename from bin/nova-easy-api rename to bin/nova-direct-api index e8e86b4f..43046e6c 100755 --- a/bin/nova-easy-api +++ b/bin/nova-direct-api @@ -37,25 +37,25 @@ gettext.install('nova', unicode=1) from nova import flags from nova import utils from nova import wsgi -from nova.api import easy +from nova.api import direct from nova.compute import api as compute_api FLAGS = flags.FLAGS -flags.DEFINE_integer('easy_port', 8001, 'Easy API port') -flags.DEFINE_string('easy_host', '0.0.0.0', 'Easy API host') +flags.DEFINE_integer('direct_port', 8001, 'Direct API port') +flags.DEFINE_string('direct_host', '0.0.0.0', 'Direct API host') if __name__ == '__main__': utils.default_flagfile() FLAGS(sys.argv) - easy.register_service('compute', compute_api.ComputeAPI()) - easy.register_service('reflect', easy.Reflection()) - router = easy.SundayMorning() - with_json = easy.JsonParamsMiddleware(router) - with_req = easy.ReqParamsMiddleware(with_json) - with_auth = easy.DelegatedAuthMiddleware(with_req) + direct.register_service('compute', compute_api.ComputeAPI()) + direct.register_service('reflect', direct.Reflection()) + router = direct.Router() + with_json = direct.JsonParamsMiddleware(router) + with_req = direct.PostParamsMiddleware(with_json) + with_auth = direct.DelegatedAuthMiddleware(with_req) server = wsgi.Server() - server.start(with_auth, FLAGS.easy_port, host=FLAGS.easy_host) + server.start(with_auth, FLAGS.direct_port, host=FLAGS.direct_host) server.wait() diff --git a/nova/tests/easy_unittest.py b/nova/tests/test_direct.py similarity index 77% rename from nova/tests/easy_unittest.py rename to nova/tests/test_direct.py index cd13c771..d73c64ce 100644 --- a/nova/tests/easy_unittest.py +++ b/nova/tests/test_direct.py @@ -16,7 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Tests for Easy API.""" +"""Tests for Direct API.""" import json import logging @@ -27,7 +27,7 @@ from nova import context from nova import exception from nova import test from nova import utils -from nova.api import easy +from nova.api import direct from nova.compute import api as compute_api from nova.tests import cloud_unittest @@ -41,18 +41,18 @@ class FakeService(object): 'project': context.project_id} -class EasyTestCase(test.TestCase): +class DirectTestCase(test.TestCase): def setUp(self): - super(EasyTestCase, self).setUp() - easy.register_service('fake', FakeService()) - self.router = easy.ReqParamsMiddleware( - easy.JsonParamsMiddleware( - easy.SundayMorning())) - self.auth_router = easy.DelegatedAuthMiddleware(self.router) + super(DirectTestCase, self).setUp() + direct.register_service('fake', FakeService()) + self.router = direct.PostParamsMiddleware( + direct.JsonParamsMiddleware( + direct.Router())) + self.auth_router = direct.DelegatedAuthMiddleware(self.router) self.context = context.RequestContext('user1', 'proj1') def tearDown(self): - easy.EASY_ROUTES = {} + direct.ROUTES = {} def test_delegated_auth(self): req = webob.Request.blank('/fake/context') @@ -82,21 +82,21 @@ class EasyTestCase(test.TestCase): self.assertEqual(resp_parsed['data'], 'foo') def test_proxy(self): - proxy = easy.Proxy(self.router) + proxy = direct.Proxy(self.router) rv = proxy.fake.echo(self.context, data='baz') self.assertEqual(rv['data'], 'baz') -class EasyCloudTestCase(cloud_unittest.CloudTestCase): +class DirectCloudTestCase(cloud_unittest.CloudTestCase): def setUp(self): - super(EasyCloudTestCase, self).setUp() + super(DirectCloudTestCase, self).setUp() compute_handle = compute_api.ComputeAPI(self.cloud.network_manager, self.cloud.image_service) - easy.register_service('compute', compute_handle) - self.router = easy.JsonParamsMiddleware(easy.SundayMorning()) - proxy = easy.Proxy(self.router) + direct.register_service('compute', compute_handle) + self.router = direct.JsonParamsMiddleware(direct.Router()) + proxy = direct.Proxy(self.router) self.cloud.compute_api = proxy.compute def tearDown(self): - super(EasyCloudTestCase, self).tearDown() - easy.EASY_ROUTES = {} + super(DirectCloudTestCase, self).tearDown() + direct.ROUTES = {}