Exemple #1
0
    def setUp(self):
        # Initiating config objects without any filename
        # will lead to setting defaults and that's what we
        # need to run the tests
        AMQPServiceConfigInstance = AmqpConfig()
        AMQPServiceConfigInstance.reconnectOnConnectionLoss = False

        self.amqpBroker = AmqpFactory(AMQPServiceConfigInstance)
        yield self.amqpBroker.connect()
        yield self.amqpBroker.getChannelReadyDeferred()

        # Initiating config objects without any filename
        # will lead to setting defaults and that's what we
        # need to run the tests
        deliverSmHttpThrowerConfigInstance = deliverSmHttpThrowerConfig()
        # Lower the timeout config to pass the timeout tests quickly
        deliverSmHttpThrowerConfigInstance.timeout = 2
        deliverSmHttpThrowerConfigInstance.retry_delay = 1
        deliverSmHttpThrowerConfigInstance.max_retries = 2

        # Launch the deliverSmHttpThrower
        self.deliverSmHttpThrower = deliverSmHttpThrower()
        self.deliverSmHttpThrower.setConfig(deliverSmHttpThrowerConfigInstance)

        # Add the broker to the deliverSmHttpThrower
        yield self.deliverSmHttpThrower.addAmqpBroker(self.amqpBroker)

        # Test vars:
        self.testDeliverSMPdu = DeliverSM(source_addr="1234", destination_addr="4567", short_message="hello !")
    def startDeliverSmHttpThrowerService(self):
        "Start deliverSmHttpThrower"
        
        deliverThrowerConfigInstance = deliverSmHttpThrowerConfig(self.options['config'])
        self.components['deliversm-thrower'] = deliverSmHttpThrower()
        self.components['deliversm-thrower'].setConfig(deliverThrowerConfigInstance)

        # AMQP Broker is used to listen to deliver_sm queue
        return self.components['deliversm-thrower'].addAmqpBroker(self.components['amqp-broker-factory'])