def testExportingAServiceThroughProgrammatically(self): remoteService1 = RemoteService1() serviceExporter1 = PyroServiceExporter() serviceExporter1.service_name = "RemoteService1" serviceExporter1.service = remoteService1 serviceExporter1.after_properties_set() clientSideProxy1 = PyroProxyFactory() clientSideProxy1.service_url = "PYROLOC://localhost:7766/RemoteService1" remoteService2 = RemoteService2() serviceExporter2 = PyroServiceExporter() serviceExporter2.service_name = "RemoteService2" serviceExporter2.service = remoteService2 serviceExporter2.after_properties_set() clientSideProxy2 = PyroProxyFactory() clientSideProxy2.service_url = "PYROLOC://localhost:7766/RemoteService2" time.sleep(0.01) argument1 = ['a', 1, 'b'] self.assertEquals(remoteService1.getData(argument1), "You got remote data => %s" % argument1) self.assertEquals(remoteService1.getMoreData(argument1), "You got more remote data => %s" % argument1) self.assertEquals(clientSideProxy1.getData(argument1), "You got remote data => %s" % argument1) self.assertEquals(clientSideProxy1.getMoreData(argument1), "You got more remote data => %s" % argument1) routineToRun = "testit" self.assertEquals(remoteService2.executeOperation(routineToRun), "Operation %s has been carried out" % routineToRun) self.assertEquals(remoteService2.executeOtherOperation(routineToRun), "Other operation %s has been carried out" % routineToRun) self.assertEquals(clientSideProxy2.executeOperation(routineToRun), "Operation %s has been carried out" % routineToRun) self.assertEquals(clientSideProxy2.executeOtherOperation(routineToRun), "Other operation %s has been carried out" % routineToRun)
def testExportingAServiceThroughProgrammaticallyWithNonStandardPortsAndStrings( self): remoteService1 = RemoteService1() serviceExporter1 = PyroServiceExporter() serviceExporter1.service_name = "RemoteService1" serviceExporter1.service = remoteService1 serviceExporter1.service_host = "127.0.0.1" serviceExporter1.service_port = 7000 serviceExporter1.after_properties_set() clientSideProxy1 = PyroProxyFactory() clientSideProxy1.service_url = "PYROLOC://localhost:7000/RemoteService1" remoteService2 = RemoteService2() serviceExporter2 = PyroServiceExporter() serviceExporter2.service_name = "RemoteService2" serviceExporter2.service = remoteService2 serviceExporter2.service_host = "127.0.0.1" serviceExporter2.service_port = 7000 serviceExporter2.after_properties_set() clientSideProxy2 = PyroProxyFactory() clientSideProxy2.service_url = "PYROLOC://localhost:7000/RemoteService2" time.sleep(0.01) argument1 = ['a', 1, 'b'] self.assertEquals(remoteService1.getData(argument1), "You got remote data => %s" % argument1) self.assertEquals(remoteService1.getMoreData(argument1), "You got more remote data => %s" % argument1) self.assertEquals(clientSideProxy1.getData(argument1), "You got remote data => %s" % argument1) self.assertEquals(clientSideProxy1.getMoreData(argument1), "You got more remote data => %s" % argument1) routineToRun = "testit" self.assertEquals(remoteService2.executeOperation(routineToRun), "Operation %s has been carried out" % routineToRun) self.assertEquals( remoteService2.executeOtherOperation(routineToRun), "Other operation %s has been carried out" % routineToRun) self.assertEquals(clientSideProxy2.executeOperation(routineToRun), "Operation %s has been carried out" % routineToRun) self.assertEquals( clientSideProxy2.executeOtherOperation(routineToRun), "Other operation %s has been carried out" % routineToRun)
def userDetailsService(self): userDetailsService = PyroProxyFactory() userDetailsService.service_url = "PYROLOC://localhost:7766/UserDetails" return userDetailsService
def controller(self): proxy = PyroProxyFactory() proxy.service_url = "PYROLOC://localhost:7766/Controller" return proxy