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)
Exemple #2
0
 def userDetailsServiceExporter(self):
     exporter = PyroServiceExporter()
     exporter.service_name = "UserDetails"
     exporter.service = self.remoteUserDetailsService()
     return exporter
Exemple #3
0
 def controllerExporter(self):
     exporter = PyroServiceExporter()
     exporter.service_name = "Controller"
     exporter.service = self.remoteController()
     return exporter
 def mySampleServiceExporter(self):
     return PyroServiceExporter(self.mySampleService(), "service",
                                "localhost", 7000)
Exemple #5
0
    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)
Exemple #6
0
 def userDetailsServiceExporter(self):
     exporter = PyroServiceExporter()
     exporter.service_name = "UserDetails"
     exporter.service = self.remoteUserDetailsService()
     return exporter
Exemple #7
0
 def controllerExporter(self):
     exporter = PyroServiceExporter()
     exporter.service_name = "Controller"
     exporter.service = self.remoteController()
     return exporter