You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2016/06/14 17:58:07 UTC

qpid-dispatch git commit: DISPATCH-388 - Added deprecated flag to entities and attributes in the schema

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 1c3c1f5be -> 884de91ff


DISPATCH-388 - Added deprecated flag to entities and attributes in the schema


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/884de91f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/884de91f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/884de91f

Branch: refs/heads/master
Commit: 884de91ff4f7bd32123e24309d6fedbe86e02ae0
Parents: 1c3c1f5
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Tue Jun 14 13:57:41 2016 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Tue Jun 14 13:57:41 2016 -0400

----------------------------------------------------------------------
 python/qpid_dispatch/management/qdrouter.json   | 11 ++++-
 .../qpid_dispatch_internal/management/schema.py |  8 +++-
 tests/management/schema.py                      | 44 ++++++++++++++++----
 3 files changed, 51 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/884de91f/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index c7cf8e5..f600829 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -10,6 +10,7 @@
             "attributes": {
                 "addr": {
                     "description":"(DEPRECATED)IP address: ipv4 or ipv6 literal or a host name. This attribute has been deprecated. Use host instead",
+                    "deprecated": true,
                     "type": "string",
                     "default": "127.0.0.1",
                     "create": true
@@ -480,7 +481,7 @@
         "container": {
             "description":"(DEPRECATED)Attributes related to the AMQP container. This entity has been deprecated. Use the router entity instead.",
             "extends": "configurationEntity",
-
+            "deprecated": true,
             "singleton": true,
             "attributes": {
 
@@ -527,6 +528,7 @@
                     "description":"(DEPRECATED) Router's unique identity. This attribute has been deprecated. Use id instead",
                     "type": "string",
                     "required": false,
+                    "deprecated": true,
                     "create": true
                 },
                 "id": {
@@ -582,6 +584,7 @@
                 "mobileAddrMaxAge": {
                     "type": "integer",
                     "default": 60,
+                    "deprecated": true,
                     "description": "(DEPRECATED) This value is no longer used in the router.",
                     "create": true
                 },
@@ -684,16 +687,19 @@
                 "requirePeerAuth": {
                     "type": "boolean",
                     "create": true,
+                    "deprecated": true,
                     "description": "(DEPRECATED) This attribute is now controlled by the authenticatePeer attribute."
                 },
                 "allowUnsecured": {
                     "type": "boolean",
                     "create": true,
+                    "deprecated": true,
                     "description": "(DEPRECATED) This attribute is now controlled by the requireEncryption attribute."
                 },
                 "allowNoSasl": {
                     "type": "boolean",
                     "create": true,
+                    "deprecated": true,
                     "description": "(DEPRECATED) This attribute is now controlled by the authenticatePeer attribute."
                 },
                 "stripAnnotations": {
@@ -832,6 +838,7 @@
         "fixedAddress": {
             "description":"(DEPRECATED) Establishes treatment for addresses starting with a prefix. This entity has been deprecated. Use address instead",
             "extends": "configurationEntity",
+            "deprecated": true,
             "operations": ["CREATE"],
             "attributes": {
                 "prefix": {
@@ -868,6 +875,7 @@
 
         "waypoint": {
             "description":"(DEPRECATED) A remote node that messages for an address pass through. This entity has been deprecated. Use autoLink instead",
+            "deprecated": true,
             "extends": "configurationEntity",
             "operations": ["CREATE", "DELETE"],
             "attributes": {
@@ -900,6 +908,7 @@
 
         "linkRoutePattern": {
             "description":"(DEPRECATED) An address pattern to match against link sources and targets to cause the router to link-route the attach across the network to a remote node. This entity has been deprecated. Use linkRoute instead",
+            "deprecated": true,
             "extends": "configurationEntity",
             "operations": ["CREATE"],
             "attributes": {

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/884de91f/python/qpid_dispatch_internal/management/schema.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/schema.py b/python/qpid_dispatch_internal/management/schema.py
index fe81ffb..51aa97c 100644
--- a/python/qpid_dispatch_internal/management/schema.py
+++ b/python/qpid_dispatch_internal/management/schema.py
@@ -207,7 +207,8 @@ class AttributeType(object):
     @ivar graph: If true the attribute could be graphed by a console.
     """
 
-    def __init__(self, name, type=None, defined_in=None, default=None, required=False, unique=False, hidden=False,
+    def __init__(self, name, type=None, defined_in=None, default=None,
+                 required=False, unique=False, hidden=False, deprecated=False,
                  value=None, description="", create=False, update=False, graph=False):
         """
         See L{AttributeType} instance variables.
@@ -218,6 +219,7 @@ class AttributeType(object):
             self.atype = get_type(type)
             self.required = required
             self.hidden = hidden
+            self.deprecated = deprecated
             self.default = default
             self.value = value
             self.unique = unique
@@ -318,7 +320,8 @@ class EntityType(object):
     @ivar referential: True if an entity/annotation can be referred to by name.
     @ivar annotations: List of names of sections annotationd by this entity.
     """
-    def __init__(self, name, schema, attributes=None, operations=None, operationDefs=None, description="", fullName=True, singleton=False, annotations=None, extends=None, referential=False, **kwargs):
+    def __init__(self, name, schema, attributes=None, operations=None, operationDefs=None, description="",
+                 fullName=True, singleton=False, deprecated=False, annotations=None, extends=None, referential=False, **kwargs):
         """
         @param name: name of the entity type.
         @param schema: schema for this type.
@@ -349,6 +352,7 @@ class EntityType(object):
             # List of annotations that are singletons
             self.references = []
             self.singleton = singleton
+            self.deprecated = deprecated
             self.referential = referential
             self._init = False      # Have not yet initialized from base and attributes.
             # Operation definitions

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/884de91f/tests/management/schema.py
----------------------------------------------------------------------
diff --git a/tests/management/schema.py b/tests/management/schema.py
index 8e88437..6c32f89 100644
--- a/tests/management/schema.py
+++ b/tests/management/schema.py
@@ -34,33 +34,46 @@ def replace_od(thing):
     return thing
 
 SCHEMA_1 = {
-    "prefix":"org.example",
+    "prefix": "org.example",
     "annotations": {
         "entityId": {
             "attributes": {
-                "name": {"type":"string", "required": True, "unique":True},
-                "type": {"type":"string", "required": True}
+                "name": {"type": "string",
+                         "required": True,
+                         "unique": True},
+                "type": {"type":"string",
+                         "required": True}
             }
         }
     },
     "entityTypes": {
         "container": {
+            "deprecated": True,
             "singleton": True,
-            "annotations" : ["entityId"],
+            "annotations": ["entityId"],
             "attributes": {
-                "workerThreads" : {"type":"integer", "default": 1}
+                "workerThreads": {"type": "integer", "default": 1},
+                "routerId": {
+                    "description":"(DEPRECATED) Router's unique identity. This attribute has been deprecated. Use id instead",
+                    "type": "string",
+                    "required": False,
+                    "deprecated": True,
+                    "create": True
+                },
             }
         },
         "listener": {
-            "annotations" : ["entityId"],
+            "annotations": ["entityId"],
             "attributes": {
-                "host" : {"type":"string"}
+                "host": {
+                    "type": "string"
+                }
             }
         },
         "connector": {
-            "annotations" : ["entityId"],
+            "annotations": ["entityId"],
             "attributes": {
-                "host" : {"type":"string"}
+                "host": {"type": "string"}
             }
         }
     }
@@ -153,6 +166,19 @@ class SchemaTest(unittest.TestCase):
         self.assertEqual(e.attributes, {'type': 'org.example.listener', 'name':'x', 'host':'foo'})
         self.assertEqual(e['host'], 'foo')
         self.assertRaises(ValidationError, e.__setitem__, 'nosuch', 'x')
+
+        # The container entity itself has been deprecated
+        self.assertTrue(s.entity_types['org.example.container'].deprecated)
+
+        # The routerId attribute of the container entity has been deprecated
+        self.assertTrue(s.entity_types['org.example.container'].attributes['routerId'].deprecated)
+
+        # This will make sure that deprecated flag defaults to false for entities
+        self.assertFalse(s.entity_types['org.example.connector'].deprecated)
+        
+        # This will make sure that deprecated flag defaults to false for attributes of entities
+        self.assertFalse(s.entity_types['org.example.listener'].attributes['host'].deprecated)
+
         try:
             e.nosuch = 'x'
             self.fail("Expected exception")


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