You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2014/12/05 23:07:41 UTC

svn commit: r1643444 - in /qpid/dispatch/trunk: python/qpid_dispatch/management/ python/qpid_dispatch_internal/management/ tests/ tests/management/

Author: aconway
Date: Fri Dec  5 22:07:41 2014
New Revision: 1643444

URL: http://svn.apache.org/r1643444
Log:
NO-JIRA: Rename Entity classes in different management modules distinctly.

Modified:
    qpid/dispatch/trunk/python/qpid_dispatch/management/client.py
    qpid/dispatch/trunk/python/qpid_dispatch/management/entity.py
    qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py
    qpid/dispatch/trunk/python/qpid_dispatch_internal/management/schema.py
    qpid/dispatch/trunk/tests/management/entity.py
    qpid/dispatch/trunk/tests/router_engine_test.py

Modified: qpid/dispatch/trunk/python/qpid_dispatch/management/client.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch/management/client.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/management/client.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch/management/client.py Fri Dec  5 22:07:41 2014
@@ -24,7 +24,7 @@ AMQP management client for Qpid dispatch
 import proton, threading
 from proton import Url
 from .error import *
-from .entity import Entity as BaseEntity, clean_dict
+from .entity import EntityBase, clean_dict
 
 class MessengerImpl(object):
     """
@@ -66,7 +66,7 @@ class MessengerImpl(object):
         self.messenger.stop()
 
 
-class Entity(BaseEntity):
+class Entity(EntityBase):
     """
     Proxy for an AMQP manageable entity.
 

Modified: qpid/dispatch/trunk/python/qpid_dispatch/management/entity.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch/management/entity.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/management/entity.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch/management/entity.py Fri Dec  5 22:07:41 2014
@@ -32,7 +32,7 @@ def clean_dict(items, **kwargs):
     return dict((unicode(k), v) for k, v in itertools.chain(items, kwargs.iteritems())
                 if v is not None)
 
-class Entity(object):
+class EntityBase(object):
     """
     A collection of named attributes.
 
@@ -43,7 +43,7 @@ class Entity(object):
 
     @ivar attributes: Map of attribute values for this entity.
 
-    NOTE: Entity does not itself implement the python map protocol because map
+    NOTE: EntityBase does not itself implement the python map protocol because map
     methods (in particular 'update') can clash with AMQP methods and attributes.
     """
 

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/management/agent.py Fri Dec  5 22:07:41 2014
@@ -58,7 +58,7 @@ from qpid_dispatch.management.error impo
     BadRequestStatus, InternalServerErrorStatus, NotImplementedStatus, NotFoundStatus
 from qpid_dispatch.management.entity import camelcase
 from .. import dispatch_c
-from .schema import ValidationError, Entity as SchemaEntity, EntityType
+from .schema import ValidationError, SchemaEntity, EntityType
 from .qdrouter import QdSchema
 from ..router.message import Message
 
@@ -88,7 +88,7 @@ class AtomicCount(object):
             self.count += 1
             return self.count
 
-class Entity(SchemaEntity):
+class AgentEntity(SchemaEntity):
     """
     Base class for agent entities with operations as well as attributes.
     """
@@ -105,7 +105,7 @@ class Entity(SchemaEntity):
         @param attributes: Attribute name:value map
         @param pointer: Pointer to C object that can be used to refresh attributes.
         """
-        super(Entity, self).__init__(entity_type, attributes, validate=validate)
+        super(AgentEntity, self).__init__(entity_type, attributes, validate=validate)
         # Direct __dict__ access to avoid validation as schema attributes
         self.__dict__['_agent'] = agent
         self.__dict__['_qd'] = agent.qd
@@ -153,16 +153,16 @@ class Entity(SchemaEntity):
         """Subclasses implement delete logic here"""
         pass
 
-class ContainerEntity(Entity): pass
+class ContainerEntity(AgentEntity): pass
 
 
-class RouterEntity(Entity):
+class RouterEntity(AgentEntity):
     def __init__(self, *args, **kwargs):
         kwargs['validate'] = False
         super(RouterEntity, self).__init__(*args, **kwargs)
         self._set_pointer(self._dispatch)
 
-class LogEntity(Entity):
+class LogEntity(AgentEntity):
     def __init__(self, agent, entity_type, attributes=None, validate=True):
         module = attributes.get('module')
         if module:
@@ -179,29 +179,29 @@ class LogEntity(Entity):
         """Can't actually delete a log source but return it to the default state"""
         self._qd.qd_log_source_reset(self.attributes['module'])
 
-class ListenerEntity(Entity):
+class ListenerEntity(AgentEntity):
     def create(self, request):
         self._qd.qd_dispatch_configure_listener(self._dispatch, self)
         self._qd.qd_connection_manager_start(self._dispatch)
 
 
-class ConnectorEntity(Entity):
+class ConnectorEntity(AgentEntity):
     def create(self, request):
         self._qd.qd_dispatch_configure_connector(self._dispatch, self)
         self._qd.qd_connection_manager_start(self._dispatch)
 
 
-class FixedAddressEntity(Entity):
+class FixedAddressEntity(AgentEntity):
     def create(self, request):
         self._qd.qd_dispatch_configure_address(self._dispatch, self)
 
 
-class WaypointEntity(Entity):
+class WaypointEntity(AgentEntity):
     def create(self, request):
         self._qd.qd_dispatch_configure_waypoint(self._dispatch, self)
         self._qd.qd_waypoint_activate_all(self._dispatch)
 
-class DummyEntity(Entity):
+class DummyEntity(AgentEntity):
 
     id_count = AtomicCount()
 
@@ -214,7 +214,7 @@ class DummyEntity(Entity):
         return (OK, dict(**request.properties))
 
 
-class CEntity(Entity):
+class CEntity(AgentEntity):
     """
     Entity that is registered from C code rather than created via management.
     """

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/management/schema.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/management/schema.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/management/schema.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/management/schema.py Fri Dec  5 22:07:41 2014
@@ -27,7 +27,7 @@ A Schema can be loaded/dumped to a json
 """
 
 import sys
-from qpid_dispatch.management import entity
+from qpid_dispatch.management.entity import EntityBase
 from qpid_dispatch.management.error import ForbiddenStatus
 from ..compat import OrderedDict
 
@@ -399,7 +399,7 @@ class EntityType(AttrsAndOps):
         @param kwargs: See L{Schema.validate_all}
         """
 
-        if isinstance(attributes, Entity): attributes = attributes.attributes
+        if isinstance(attributes, SchemaEntity): attributes = attributes.attributes
 
         if self.singleton and not _is_unique(check_singleton, self.name):
             raise ValidationError("Multiple instances of singleton '%s'"%self.name)
@@ -551,12 +551,12 @@ class Schema(object):
                                  check_singleton=check_singleton)
 
     def entity(self, attributes):
-        """Convert an attribute map into an L{Entity}"""
+        """Convert an attribute map into an L{SchemaEntity}"""
         attributes = dict((k, v) for k, v in attributes.iteritems() if v is not None)
-        return Entity(self.entity_type(attributes['type']), attributes)
+        return SchemaEntity(self.entity_type(attributes['type']), attributes)
 
     def entities(self, attribute_maps):
-        """Convert a list of attribute maps into a list of L{Entity}"""
+        """Convert a list of attribute maps into a list of L{SchemaEntity}"""
         return [self.entity(m) for m in attribute_maps]
 
     def by_type(self, type):
@@ -565,16 +565,16 @@ class Schema(object):
         return (t for t in self.entity_types.itervalues() if not type or t.is_a(type))
 
 
-class Entity(entity.Entity):
+class SchemaEntity(EntityBase):
     """A map of attributes associated with an L{EntityType}"""
     def __init__(self, entity_type, attributes=None, validate=True, **kwattrs):
-        super(Entity, self).__init__(attributes, **kwattrs)
+        super(SchemaEntity, self).__init__(attributes, **kwattrs)
         self.__dict__['entity_type'] = entity_type
         self.attributes.setdefault('type', entity_type.name)
         if validate: self.validate()
 
     def __setitem__(self, name, value):
-        super(Entity, self).__setitem__(name, value)
+        super(SchemaEntity, self).__setitem__(name, value)
         self.validate()
 
     def validate(self):

Modified: qpid/dispatch/trunk/tests/management/entity.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/management/entity.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/management/entity.py (original)
+++ qpid/dispatch/trunk/tests/management/entity.py Fri Dec  5 22:07:41 2014
@@ -18,7 +18,7 @@
 #
 
 import unittest
-from qpid_dispatch.management.entity import Entity, camelcase
+from qpid_dispatch.management.entity import EntityBase, camelcase
 
 class EntityTest(unittest.TestCase):
 
@@ -36,7 +36,7 @@ class EntityTest(unittest.TestCase):
         self.assertEqual('FooBar', camelcase('fooBar', capital=True))
 
     def test_entity(self):
-        e = Entity({'foo-bar': 'baz'}, type='container', name='x')
+        e = EntityBase({'foo-bar': 'baz'}, type='container', name='x')
         self.assertEqual(e.attributes, {'type': 'container', 'name':'x', 'foo-bar': 'baz'})
         self.assertEqual(e.name, 'x')
         self.assertEqual(e['name'], 'x')

Modified: qpid/dispatch/trunk/tests/router_engine_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/router_engine_test.py?rev=1643444&r1=1643443&r2=1643444&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/router_engine_test.py (original)
+++ qpid/dispatch/trunk/tests/router_engine_test.py Fri Dec  5 22:07:41 2014
@@ -26,7 +26,7 @@ sys.path.append(os.path.join(os.path.dir
 
 from qpid_dispatch_internal.router.engine import NeighborEngine, PathEngine, NodeTracker
 from qpid_dispatch_internal.router.data import LinkState, MessageHELLO
-from qpid_dispatch.management.entity import Entity
+from qpid_dispatch.management.entity import EntityBase
 from system_test import main_module
 
 class Adapter(object):
@@ -268,7 +268,7 @@ class NeighborTest(unittest.TestCase):
         self.id = "R1"
         self.area = "area"
         # Fake configuration
-        self.config = Entity({
+        self.config = EntityBase({
             'helloInterval'      :  1.0,
             'helloMaxAge'       :  3.0,
             'raInterval'         : 30.0,



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org