示例#1
0
 def clientConnected(protocol):
     proxy = txprotobuf.Proxy(TestService_Stub(protocol))
     request = TestRequest()
     request.text = "proxycall"
     d = proxy.TestMethod(request)
     d.addCallback(lambda response: self.assertEquals(response.text, request.text))
     return d
示例#2
0
 def clientConnected(protocol):
     proxy = txprotobuf.Proxy(TestService_Stub(protocol))
     request = TestRequest()
     request.text = "proxycall"
     d = proxy.TestMethod(request)
     d.addCallback(lambda response: self.assertEquals(
         response.text, request.text))
     return d
示例#3
0
 def clientConnected(protocol):
     protocol.service = ClientTestService()
     channel = self.service.factory.protocols[0]
     controller = txprotobuf.Controller()
     service = TestService_Stub(channel)
     request = TestRequest()
     request.text = "reverse"
     wait = Deferred()
     wait.addCallback(lambda response: self.assertEquals(response.text, request.text))
     service.TestMethod(controller, request, wait.callback)
     return wait
示例#4
0
 def clientConnected(protocol):
     protocol.service = ClientTestService()
     channel = self.service.factory.protocols[0]
     controller = txprotobuf.Controller()
     service = TestService_Stub(channel)
     request = TestRequest()
     request.text = "reverse"
     wait = Deferred()
     wait.addCallback(lambda response: self.assertEquals(
         response.text, request.text))
     service.TestMethod(controller, request, wait.callback)
     return wait
示例#5
0
 def callTestMethod(protocol):
     channel = protocol
     controller = txprotobuf.Controller()
     service = TestService_Stub(channel)
     requestFoo = TestRequest()
     requestFoo.text = "foo"
     waitFoo = Deferred()
     waitFoo.addCallback(lambda responseFoo: self.assertEquals(responseFoo.text, requestFoo.text))
     service.TestMethod(controller, requestFoo, waitFoo.callback)
     requestBar = TestRequest()
     requestBar.text = "bar"
     waitBar = Deferred()
     waitBar.addCallback(lambda responseBar: self.assertEquals(responseBar.text, requestBar.text))
     service.TestMethod(controller, requestBar, waitBar.callback)
     return DeferredList([waitFoo, waitBar])
示例#6
0
 def callTestMethod(protocol):
     channel = protocol
     controller = txprotobuf.Controller()
     service = TestService_Stub(channel)
     request = TestRequest()
     request.text = "foo"
     d = self.service.waitFromTestMethodCall()
     def checkTestMethodCalled(text):
         self.assertEquals(request.text, text)
     d.addCallback(checkTestMethodCalled)
     waitForMethodResponse = Deferred()
     d.addCallback(lambda x: waitForMethodResponse)
     waitForMethodResponse.addCallback(lambda response: self.assertEquals(request.text, response.text))
     def callback(response):
         waitForMethodResponse.callback(response)
     service.TestMethod(controller, request, callback)
     return d
示例#7
0
        def callTestMethod(protocol):
            channel = protocol
            controller = txprotobuf.Controller()
            service = TestService_Stub(channel)
            request = TestRequest()
            request.text = "foo"
            d = self.service.waitFromTestMethodCall()

            def checkTestMethodCalled(text):
                self.assertEquals(request.text, text)

            d.addCallback(checkTestMethodCalled)
            waitForMethodResponse = Deferred()
            d.addCallback(lambda x: waitForMethodResponse)
            waitForMethodResponse.addCallback(
                lambda response: self.assertEquals(request.text, response.text
                                                   ))

            def callback(response):
                waitForMethodResponse.callback(response)

            service.TestMethod(controller, request, callback)
            return d
示例#8
0
 def callTestMethod(protocol):
     channel = protocol
     controller = txprotobuf.Controller()
     service = TestService_Stub(channel)
     requestFoo = TestRequest()
     requestFoo.text = "foo"
     waitFoo = Deferred()
     waitFoo.addCallback(lambda responseFoo: self.assertEquals(
         responseFoo.text, requestFoo.text))
     service.TestMethod(controller, requestFoo, waitFoo.callback)
     requestBar = TestRequest()
     requestBar.text = "bar"
     waitBar = Deferred()
     waitBar.addCallback(lambda responseBar: self.assertEquals(
         responseBar.text, requestBar.text))
     service.TestMethod(controller, requestBar, waitBar.callback)
     return DeferredList([waitFoo, waitBar])