Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/170#discussion_r124780487
  
    --- Diff: tests/system_tests_three_routers.py ---
    @@ -373,5 +433,189 @@ def run(self):
     
     
     
    +
    +class Entity(object):
    +    def __init__(self, status_code, status_description, attrs):
    +        self.status_code        = status_code
    +        self.status_description = status_description
    +        self.attrs              = attrs
    +
    +    def __getattr__(self, key):
    +        return self.attrs[key]
    +
    +
    +
    +
    +class RouterProxy(object):
    +    def __init__(self, reply_addr):
    +        self.reply_addr = reply_addr
    +
    +    def response(self, msg):
    +        ap = msg.properties
    +        return Entity(ap['statusCode'], ap['statusDescription'], msg.body)
    +
    +    def read_address(self, name):
    +        ap = {'operation': 'READ', 'type': 
'org.apache.qpid.dispatch.router.address', 'name': name}
    +        return Message(properties=ap, reply_to=self.reply_addr)
    +
    +    def query_addresses(self):
    +        ap = {'operation': 'QUERY', 'type': 
'org.apache.qpid.dispatch.router.address'}
    +        return Message(properties=ap, reply_to=self.reply_addr)
    +
    +
    +
    +
    +class PollTimeout(object):
    +    def __init__(self, parent):
    +        self.parent = parent
    +
    +    def on_timer_task(self, event):
    +        self.parent.poll_timeout()
    +
    +
    +
    +class Timeout(object):
    +    def __init__(self, parent):
    +        self.parent = parent
    +
    +    def on_timer_task(self, event):
    +        self.parent.timeout()
    +
    +
    +class LinkRoute ( MessagingHandler ):
    +
    +    """
    +        Set up and use a link-route, to send a message this way:
    +            receiver <--- A <--- B <--- C <--- sender
    +
    +        Check for appearance of the link-route at router A with a
    +        technique that is appropriate to the 'proactor' style,
    +        i.e. do not take control away from the proactor for an extended
    +        period of time.
    +    """
    +
    +    def __init__ ( self, route_container, linkroute_prefix, 
route_check_address, send_address ):
    +        super(LinkRoute, self).__init__(prefetch=0)
    +        self.route_container        = route_container
    +        self.send_address           = send_address
    +        self.linkroute_prefix       = linkroute_prefix
    +        self.route_check_address    = route_check_address
    +        self.true_statement         = "This IS the message you are looking 
for."
    +        self.error                  = None
    +        self.send_connection        = None
    +        self.recv_connection        = None
    +        self.route_check_connection = None
    +        self.route_check_sender     = None
    +        self.sender                 = None
    +        self.route_check_timer      = None
    +        self.route_check_receiver   = None
    +        self.count                  = 1
    +        self.sent                   = 0
    +        self.route_checks_sent      = 0
    +
    +
    +    def bail ( self, error_text ) :
    +        self.error = error_text
    +        self.recv_connection.close()
    +        self.route_check_connection.close()
    +        self.send_connection.close()
    +        self.timer.cancel()
    +        if self.route_check_timer :
    +            self.route_check_timer.cancel()
    +            self.route_check_timer = None
    +
    +
    +    def timeout(self):
    +        self.bail ( "Timeout Expired" )
    +
    +
    +    def poll_timeout ( self ) :
    +        self.poll()
    +
    +
    +    def on_start(self, event):
    +        # Iff this timer expires, the test fails.
    +        self.timer = event.reactor.schedule ( TIMEOUT, Timeout(self) )
    +
    +        # At startup, create only the receivers and the sender that checks 
for
    +        # the route being ready.  Creation of the payload message sender
    +        # has to wait until we know the address is available, to avoid a
    +        # 'no route to destination' error.
    +        self.recv_connection = event.container.connect ( 
self.route_container )
    +
    +        self.route_check_connection  = event.container.connect ( 
self.route_check_address )
    +        self.route_check_receiver = event.container.create_receiver ( 
self.route_check_connection,
    +                                                                
dynamic=True
    +                                                              )
    +        self.route_check_sender = event.container.create_sender ( 
self.route_check_connection,
    +                                                                  
"$management"
    +                                                                )
    +
    +
    +
    +    def poll ( self ):
    +        # The router prepends this 'D' to the address.  If we want
    +        # to look for it down at router A, we have to do likewise.
    +        doctored_linkroute_prefix = 'D' + self.linkroute_prefix
    +        request = self.proxy.read_address ( doctored_linkroute_prefix )
    +        self.route_check_sender.send ( request )
    +
    +
    +
    +    def on_link_opened ( self, event ):
    +
    +        if event.receiver:
    +            event.receiver.flow ( self.count )
    +
    +        if event.receiver == self.route_check_receiver:
    +            self.proxy = RouterProxy ( 
self.route_check_receiver.remote_source.address )
    +            self.poll()
    +
    +
    +    def on_link_opening ( self, event ):
    +        if event.receiver:
    +            event.receiver.target.address = self.route_container
    --- End diff --
    
    self.route_container is a host address (0.0.0.0:<some-port>), not an AMQP 
address.  If you look at the trace of the test, you will see that the addresses 
in the paired attach frames are different.  This should not be the case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to